rspec-core 2.8.0.rc1 → 2.8.0.rc2
Sign up to get free protection for your applications and to get access to all the features.
- data/License.txt +24 -0
- data/README.md +197 -37
- data/features/command_line/format_option.feature +3 -3
- data/features/command_line/init.feature +18 -0
- data/features/example_groups/shared_examples.feature +1 -1
- data/features/hooks/around_hooks.feature +4 -4
- data/features/pending/pending_examples.feature +5 -5
- data/features/support/env.rb +8 -1
- data/lib/autotest/rspec2.rb +2 -6
- data/lib/rspec/core.rb +48 -158
- data/lib/rspec/core/backward_compatibility.rb +2 -0
- data/lib/rspec/core/command_line.rb +4 -0
- data/lib/rspec/core/configuration.rb +201 -106
- data/lib/rspec/core/configuration_options.rb +2 -1
- data/lib/rspec/core/deprecation.rb +2 -3
- data/lib/rspec/core/drb_options.rb +69 -58
- data/lib/rspec/core/dsl.rb +12 -0
- data/lib/rspec/core/example.rb +53 -18
- data/lib/rspec/core/example_group.rb +144 -54
- data/lib/rspec/core/extensions.rb +4 -4
- data/lib/rspec/core/extensions/instance_eval_with_args.rb +5 -0
- data/lib/rspec/core/extensions/kernel.rb +1 -1
- data/lib/rspec/core/extensions/module_eval_with_args.rb +4 -0
- data/lib/rspec/core/extensions/ordered.rb +7 -2
- data/lib/rspec/core/filter_manager.rb +69 -36
- data/lib/rspec/core/formatters/base_text_formatter.rb +1 -1
- data/lib/rspec/core/formatters/html_formatter.rb +10 -4
- data/lib/rspec/core/hooks.rb +93 -34
- data/lib/rspec/core/let.rb +62 -61
- data/lib/rspec/core/metadata.rb +103 -80
- data/lib/rspec/core/metadata_hash_builder.rb +4 -0
- data/lib/rspec/core/option_parser.rb +42 -44
- data/lib/rspec/core/pending.rb +25 -3
- data/lib/rspec/core/project_initializer.rb +62 -0
- data/lib/rspec/core/rake_task.rb +7 -13
- data/lib/rspec/core/runner.rb +2 -2
- data/lib/rspec/core/shared_context.rb +1 -1
- data/lib/rspec/core/shared_example_group.rb +11 -5
- data/lib/rspec/core/subject.rb +3 -3
- data/lib/rspec/core/version.rb +1 -1
- data/lib/rspec/monkey.rb +1 -1
- data/lib/rspec/monkey/spork/test_framework/rspec.rb +2 -0
- data/spec/command_line/order_spec.rb +19 -13
- data/spec/rspec/core/command_line_spec.rb +1 -5
- data/spec/rspec/core/configuration_options_spec.rb +22 -27
- data/spec/rspec/core/configuration_spec.rb +32 -14
- data/spec/rspec/core/drb_command_line_spec.rb +20 -37
- data/spec/rspec/core/drb_options_spec.rb +51 -3
- data/spec/rspec/core/example_group_spec.rb +101 -84
- data/spec/rspec/core/example_spec.rb +14 -0
- data/spec/rspec/core/filter_manager_spec.rb +114 -33
- data/spec/rspec/core/formatters/html_formatted-1.8.7-jruby.html +17 -69
- data/spec/rspec/core/formatters/html_formatted-1.8.7.html +14 -4
- data/spec/rspec/core/formatters/html_formatted-1.9.2.html +14 -4
- data/spec/rspec/core/formatters/html_formatted-1.9.3.html +14 -4
- data/spec/rspec/core/formatters/html_formatter_spec.rb +1 -1
- data/spec/rspec/core/formatters/text_mate_formatted-1.8.7-jruby.html +20 -72
- data/spec/rspec/core/formatters/text_mate_formatted-1.8.7.html +24 -14
- data/spec/rspec/core/formatters/text_mate_formatted-1.9.2.html +29 -19
- data/spec/rspec/core/formatters/text_mate_formatted-1.9.3.html +29 -19
- data/spec/rspec/core/formatters/text_mate_formatter_spec.rb +1 -2
- data/spec/rspec/core/metadata_spec.rb +77 -45
- data/spec/rspec/core/option_parser_spec.rb +5 -0
- data/spec/rspec/core/pending_example_spec.rb +44 -12
- data/spec/rspec/core/project_initializer_spec.rb +130 -0
- data/spec/rspec/core/rake_task_spec.rb +1 -1
- data/spec/spec_helper.rb +2 -0
- data/spec/support/matchers.rb +2 -12
- metadata +18 -16
- data/features/command_line/configure.feature +0 -22
- data/lib/rspec/core/command_line_configuration.rb +0 -62
- data/lib/rspec/core/errors.rb +0 -13
- data/spec/rspec/core/command_line_configuration_spec.rb +0 -26
@@ -1,22 +0,0 @@
|
|
1
|
-
Feature: --configure option
|
2
|
-
|
3
|
-
Use the --configure option on the command line to generate configuration
|
4
|
-
files.
|
5
|
-
|
6
|
-
The only supported argument, so far, is "autotest", which creates a .rspec
|
7
|
-
file in your project root directory. When autotest sees this file, it knows
|
8
|
-
to load RSpec's Autotest subclass.
|
9
|
-
|
10
|
-
Scenario: generate .rspec file for autotest
|
11
|
-
When I run `rspec --configure autotest`
|
12
|
-
Then the following files should exist:
|
13
|
-
| .rspec |
|
14
|
-
And the output should contain ".rspec file did not exist, so it was created."
|
15
|
-
|
16
|
-
Scenario: .rspec file already exists
|
17
|
-
Given a file named ".rspec" with:
|
18
|
-
"""
|
19
|
-
--color
|
20
|
-
"""
|
21
|
-
When I run `rspec --configure autotest`
|
22
|
-
Then the output should contain ".rspec file already exists, so nothing was changed."
|
@@ -1,62 +0,0 @@
|
|
1
|
-
module RSpec
|
2
|
-
module Core
|
3
|
-
class CommandLineConfiguration
|
4
|
-
attr_reader :command
|
5
|
-
|
6
|
-
def initialize(cmd)
|
7
|
-
@command = cmd
|
8
|
-
end
|
9
|
-
|
10
|
-
def run
|
11
|
-
case @command
|
12
|
-
when 'autotest' then Autotest.generate
|
13
|
-
else raise ArgumentError, <<-MESSAGE
|
14
|
-
|
15
|
-
#{"*"*50}
|
16
|
-
"#{@command}" is not valid a valid argument to "rspec --configure".
|
17
|
-
Supported options are:
|
18
|
-
|
19
|
-
rspec --configure autotest # generates .rspec file
|
20
|
-
|
21
|
-
#{"*"*50}
|
22
|
-
MESSAGE
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
class Autotest
|
27
|
-
class << self
|
28
|
-
def generate
|
29
|
-
create_dot_rspec_file
|
30
|
-
remove_autotest_dir_if_present
|
31
|
-
end
|
32
|
-
|
33
|
-
def create_dot_rspec_file
|
34
|
-
puts "Autotest loads RSpec's Autotest subclass when there is a .rspec file in the project's root directory."
|
35
|
-
if File.exist?('./.rspec')
|
36
|
-
puts ".rspec file already exists, so nothing was changed."
|
37
|
-
else
|
38
|
-
FileUtils.touch('./.rspec')
|
39
|
-
puts ".rspec file did not exist, so it was created."
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
def remove_autotest_dir_if_present
|
44
|
-
if discover_file_exists?
|
45
|
-
print "Delete obsolete autotest/discover.rb [y/n]? "
|
46
|
-
exit if gets !~ /y/i
|
47
|
-
FileUtils.rm_rf(discover_file_path)
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
def discover_file_exists?
|
52
|
-
File.exist?(discover_file_path)
|
53
|
-
end
|
54
|
-
|
55
|
-
def discover_file_path
|
56
|
-
File.join('autotest', 'discover.rb')
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|
data/lib/rspec/core/errors.rb
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
module RSpec
|
2
|
-
module Core
|
3
|
-
# If Test::Unit is loaed, we'll use its error as baseclass, so that Test::Unit
|
4
|
-
# will report unmet RSpec expectations as failures rather than errors.
|
5
|
-
begin
|
6
|
-
class PendingExampleFixedError < Test::Unit::AssertionFailedError; end
|
7
|
-
rescue
|
8
|
-
class PendingExampleFixedError < StandardError; end
|
9
|
-
end
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
|
@@ -1,26 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
module RSpec::Core
|
4
|
-
describe CommandLineConfiguration do
|
5
|
-
describe '#run' do
|
6
|
-
context 'given autotest command' do
|
7
|
-
let(:config) { CommandLineConfiguration.new('autotest') }
|
8
|
-
|
9
|
-
it 'calls Autotest.generate' do
|
10
|
-
CommandLineConfiguration::Autotest.should_receive(:generate)
|
11
|
-
config.run
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
context 'given unsupported command' do
|
16
|
-
let(:config) { CommandLineConfiguration.new('unsupported') }
|
17
|
-
|
18
|
-
it 'raises ArgumentError' do
|
19
|
-
lambda { config.run }.should(
|
20
|
-
raise_error(ArgumentError, /"unsupported" is not valid/)
|
21
|
-
)
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|