rspec-core 2.5.0 → 2.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.travis.yml +7 -0
- data/Gemfile +12 -14
- data/README.md +4 -1
- data/Rakefile +29 -12
- data/cucumber.yml +1 -1
- data/features/.nav +15 -9
- data/features/Autotest.md +26 -32
- data/features/Changelog.md +62 -2
- data/features/Upgrade.md +35 -2
- data/features/command_line/README.md +22 -0
- data/features/command_line/configure.feature +2 -2
- data/features/command_line/example_name_option.feature +10 -10
- data/features/command_line/exit_status.feature +4 -4
- data/features/command_line/format_option.feature +4 -4
- data/features/command_line/line_number_appended_to_path.feature +11 -11
- data/features/command_line/line_number_option.feature +2 -2
- data/features/command_line/rake_task.feature +3 -3
- data/features/command_line/tag.feature +30 -14
- data/features/configuration/alias_example_to.feature +48 -0
- data/features/configuration/custom_settings.feature +3 -3
- data/features/configuration/fail_fast.feature +3 -3
- data/features/configuration/read_options_from_file.feature +4 -4
- data/features/example_groups/basic_structure.feature +11 -15
- data/features/example_groups/shared_context.feature +74 -0
- data/features/example_groups/shared_example_group.feature +21 -17
- data/features/expectation_framework_integration/configure_expectation_framework.feature +15 -4
- data/features/filtering/exclusion_filters.feature +28 -4
- data/features/filtering/{implicit_filters.feature → if_and_unless.feature} +9 -7
- data/features/filtering/inclusion_filters.feature +26 -3
- data/features/filtering/run_all_when_everything_filtered.feature +2 -2
- data/features/formatters/custom_formatter.feature +1 -1
- data/features/formatters/text_formatter.feature +43 -0
- data/features/helper_methods/arbitrary_methods.feature +2 -2
- data/features/helper_methods/let.feature +2 -2
- data/features/helper_methods/modules.feature +149 -0
- data/features/hooks/around_hooks.feature +18 -11
- data/features/hooks/before_and_after_hooks.feature +15 -19
- data/features/hooks/filtering.feature +160 -124
- data/features/metadata/current_example.feature +17 -0
- data/features/metadata/described_class.feature +2 -2
- data/features/metadata/user_defined.feature +111 -0
- data/features/mock_framework_integration/use_any_framework.feature +1 -1
- data/features/mock_framework_integration/use_flexmock.feature +83 -10
- data/features/mock_framework_integration/use_mocha.feature +84 -10
- data/features/mock_framework_integration/use_rr.feature +85 -10
- data/features/mock_framework_integration/use_rspec.feature +84 -10
- data/features/pending/pending_examples.feature +8 -8
- data/features/spec_files/arbitrary_file_suffix.feature +1 -1
- data/features/step_definitions/additional_cli_steps.rb +11 -1
- data/features/subject/attribute_of_subject.feature +24 -4
- data/features/subject/explicit_subject.feature +5 -5
- data/features/subject/implicit_receiver.feature +2 -2
- data/features/subject/implicit_subject.feature +2 -2
- data/features/support/env.rb +6 -1
- data/lib/autotest/rspec2.rb +2 -51
- data/lib/rspec/core/backward_compatibility.rb +12 -2
- data/lib/rspec/core/command_line.rb +2 -5
- data/lib/rspec/core/configuration.rb +70 -38
- data/lib/rspec/core/configuration_options.rb +6 -23
- data/lib/rspec/core/drb_command_line.rb +5 -11
- data/lib/rspec/core/example.rb +29 -21
- data/lib/rspec/core/example_group.rb +40 -8
- data/lib/rspec/core/extensions/object.rb +0 -1
- data/lib/rspec/core/formatters/base_formatter.rb +6 -0
- data/lib/rspec/core/formatters/base_text_formatter.rb +1 -1
- data/lib/rspec/core/formatters/helpers.rb +0 -4
- data/lib/rspec/core/hooks.rb +14 -4
- data/lib/rspec/core/metadata.rb +1 -1
- data/lib/rspec/core/metadata_hash_builder.rb +93 -0
- data/lib/rspec/core/mocking/with_flexmock.rb +2 -0
- data/lib/rspec/core/mocking/with_mocha.rb +2 -0
- data/lib/rspec/core/mocking/with_rr.rb +2 -0
- data/lib/rspec/core/mocking/with_rspec.rb +3 -1
- data/lib/rspec/core/option_parser.rb +9 -2
- data/lib/rspec/core/pending.rb +10 -3
- data/lib/rspec/core/reporter.rb +2 -2
- data/lib/rspec/core/runner.rb +38 -13
- data/lib/rspec/core/shared_example_group.rb +18 -4
- data/lib/rspec/core/subject.rb +4 -6
- data/lib/rspec/core/version.rb +1 -1
- data/lib/rspec/core/world.rb +70 -18
- data/lib/rspec/core.rb +29 -0
- data/lib/rspec/monkey/spork/test_framework/rspec.rb +1 -0
- data/rspec-core.gemspec +3 -5
- data/spec/autotest/failed_results_re_spec.rb +2 -2
- data/spec/autotest/rspec_spec.rb +4 -126
- data/spec/rspec/core/command_line_spec.rb +36 -2
- data/spec/rspec/core/configuration_spec.rb +150 -70
- data/spec/rspec/core/deprecations_spec.rb +21 -0
- data/spec/rspec/core/drb_command_line_spec.rb +21 -56
- data/spec/rspec/core/example_group_spec.rb +213 -56
- data/spec/rspec/core/example_spec.rb +110 -0
- data/spec/rspec/core/formatters/base_formatter_spec.rb +23 -2
- data/spec/rspec/core/formatters/base_text_formatter_spec.rb +9 -0
- data/spec/rspec/core/formatters/helpers_spec.rb +1 -1
- data/spec/rspec/core/formatters/html_formatted-1.8.6.html +5 -5
- data/spec/rspec/core/formatters/html_formatted-1.8.7-jruby.html +8 -10
- data/spec/rspec/core/formatters/html_formatted-1.8.7.html +5 -5
- data/spec/rspec/core/formatters/html_formatted-1.9.1.html +5 -5
- data/spec/rspec/core/formatters/html_formatted-1.9.2.html +5 -5
- data/spec/rspec/core/formatters/progress_formatter_spec.rb +0 -1
- data/spec/rspec/core/formatters/text_mate_formatted-1.8.6.html +5 -5
- data/spec/rspec/core/formatters/text_mate_formatted-1.8.7-jruby.html +8 -10
- data/spec/rspec/core/formatters/text_mate_formatted-1.8.7.html +5 -5
- data/spec/rspec/core/formatters/text_mate_formatted-1.9.1.html +5 -5
- data/spec/rspec/core/formatters/text_mate_formatted-1.9.2.html +5 -5
- data/spec/rspec/core/hooks_spec.rb +86 -0
- data/spec/rspec/core/metadata_spec.rb +7 -7
- data/spec/rspec/core/option_parser_spec.rb +26 -15
- data/spec/rspec/core/pending_example_spec.rb +12 -51
- data/spec/rspec/core/reporter_spec.rb +19 -3
- data/spec/rspec/core/resources/formatter_specs.rb +7 -1
- data/spec/rspec/core/rspec_matchers_spec.rb +45 -0
- data/spec/rspec/core/runner_spec.rb +42 -10
- data/spec/rspec/core/shared_example_group_spec.rb +57 -21
- data/spec/rspec/core/subject_spec.rb +32 -11
- data/spec/rspec/core/world_spec.rb +147 -15
- data/spec/rspec/core_spec.rb +28 -0
- data/spec/spec_helper.rb +22 -2
- data/spec/support/matchers.rb +44 -13
- data/spec/support/shared_example_groups.rb +41 -0
- data/spec/support/spec_files.rb +44 -0
- data/spec.txt +1126 -0
- metadata +34 -15
- data/spec/ruby_forker.rb +0 -13
data/spec/autotest/rspec_spec.rb
CHANGED
|
@@ -6,135 +6,13 @@ describe Autotest::Rspec2 do
|
|
|
6
6
|
let(:ruby_cmd) { "ruby" }
|
|
7
7
|
|
|
8
8
|
before do
|
|
9
|
-
RSpec.stub(:warn_deprecation)
|
|
10
9
|
File.stub(:exist?) { false }
|
|
11
|
-
@orig_argv = ARGV.dup; ARGV.clear
|
|
12
10
|
end
|
|
13
11
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
ARGV.concat(%w[-c -f d])
|
|
19
|
-
rspec_autotest.cl_args.should eq(%w[-c -f d --tty])
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
context "with --skip-bundler" do
|
|
23
|
-
before do
|
|
24
|
-
ARGV.concat(%w[--skip-bundler])
|
|
25
|
-
end
|
|
26
|
-
it "extracts --skip-bundler" do
|
|
27
|
-
rspec_autotest.cl_args.should eq(%w[--tty])
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
it "sets skip_bundler? true" do
|
|
31
|
-
rspec_autotest.skip_bundler?.should be_true
|
|
32
|
-
end
|
|
33
|
-
end
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
describe "handling bundler" do
|
|
37
|
-
context "gemfile, no prefix" do
|
|
38
|
-
before do
|
|
39
|
-
File.stub(:exist?).with("./Gemfile") { true }
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
it "warns of deprecation of implicit inclusion of 'bundle exec'" do
|
|
43
|
-
RSpec.should_receive(:warn_deprecation)
|
|
44
|
-
rspec_autotest.make_test_cmd({})
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
it "includes bundle exec" do
|
|
48
|
-
rspec_autotest.
|
|
49
|
-
make_test_cmd({'a' => 'b'}).should match(/bundle exec/)
|
|
50
|
-
end
|
|
51
|
-
end
|
|
52
|
-
|
|
53
|
-
context "gemfile, no prefix, --skip-bundler" do
|
|
54
|
-
before do
|
|
55
|
-
File.stub(:exist?).with("./Gemfile") { true }
|
|
56
|
-
ARGV.concat(%w[--skip-bundler])
|
|
57
|
-
end
|
|
58
|
-
|
|
59
|
-
it "does not warn" do
|
|
60
|
-
RSpec.should_not_receive(:warn_deprecation)
|
|
61
|
-
rspec_autotest.make_test_cmd({})
|
|
62
|
-
end
|
|
63
|
-
|
|
64
|
-
it "does not include bundle exec" do
|
|
65
|
-
rspec_autotest.
|
|
66
|
-
make_test_cmd({'a' => 'b'}).should_not match(/bundle exec/)
|
|
67
|
-
end
|
|
68
|
-
end
|
|
69
|
-
|
|
70
|
-
context "no gemfile, prefix" do
|
|
71
|
-
before do
|
|
72
|
-
File.stub(:exist?).with("./Gemfile") { false }
|
|
73
|
-
end
|
|
74
|
-
|
|
75
|
-
it "does not warn" do
|
|
76
|
-
RSpec.should_not_receive(:warn_deprecation)
|
|
77
|
-
rspec_autotest.make_test_cmd({'a' => 'b'})
|
|
78
|
-
end
|
|
79
|
-
|
|
80
|
-
it "includes bundle exec" do
|
|
81
|
-
rspec_autotest.prefix = "bundle exec "
|
|
82
|
-
rspec_autotest.
|
|
83
|
-
make_test_cmd({'a' => 'b'}).should match(/bundle exec/)
|
|
84
|
-
end
|
|
85
|
-
end
|
|
86
|
-
|
|
87
|
-
context "gemfile, prefix" do
|
|
88
|
-
before do
|
|
89
|
-
File.stub(:exist?).with("./Gemfile") { true }
|
|
90
|
-
rspec_autotest.prefix = "bundle exec "
|
|
91
|
-
end
|
|
92
|
-
|
|
93
|
-
it "does not warn" do
|
|
94
|
-
RSpec.should_not_receive(:warn_deprecation)
|
|
95
|
-
rspec_autotest.make_test_cmd({'a' => 'b'})
|
|
96
|
-
end
|
|
97
|
-
|
|
98
|
-
it "includes bundle exec" do
|
|
99
|
-
rspec_autotest.prefix = "bundle exec "
|
|
100
|
-
rspec_autotest.
|
|
101
|
-
make_test_cmd({'a' => 'b'}).should match(/bundle exec/)
|
|
102
|
-
end
|
|
103
|
-
end
|
|
104
|
-
|
|
105
|
-
context "gemfile, prefix, --skip-bundler" do
|
|
106
|
-
before do
|
|
107
|
-
File.stub(:exist?).with("./Gemfile") { true }
|
|
108
|
-
rspec_autotest.prefix = "bundle exec "
|
|
109
|
-
rspec_autotest.stub(:skip_bundler?) { true }
|
|
110
|
-
end
|
|
111
|
-
|
|
112
|
-
it "does not warn" do
|
|
113
|
-
RSpec.should_not_receive(:warn_deprecation)
|
|
114
|
-
rspec_autotest.make_test_cmd({'a' => 'b'})
|
|
115
|
-
end
|
|
116
|
-
|
|
117
|
-
it "does not include bundle exec" do
|
|
118
|
-
rspec_autotest.
|
|
119
|
-
make_test_cmd({'a' => 'b'}).should_not match(/bundle exec/)
|
|
120
|
-
end
|
|
121
|
-
end
|
|
122
|
-
|
|
123
|
-
context "no gemfile, no prefix" do
|
|
124
|
-
before do
|
|
125
|
-
File.stub(:exist?).with("./Gemfile") { false }
|
|
126
|
-
end
|
|
127
|
-
|
|
128
|
-
it "does not warn" do
|
|
129
|
-
RSpec.should_not_receive(:warn_deprecation)
|
|
130
|
-
rspec_autotest.make_test_cmd({'a' => 'b'})
|
|
131
|
-
end
|
|
132
|
-
|
|
133
|
-
it "does not include bundle exec" do
|
|
134
|
-
rspec_autotest.
|
|
135
|
-
make_test_cmd({'a' => 'b'}).should_not match(/bundle exec/)
|
|
136
|
-
end
|
|
137
|
-
end
|
|
12
|
+
it "uses autotest's prefix" do
|
|
13
|
+
rspec_autotest.prefix = "this is the prefix "
|
|
14
|
+
rspec_autotest.
|
|
15
|
+
make_test_cmd({'a' => 'b'}).should match(/this is the prefix/)
|
|
138
16
|
end
|
|
139
17
|
|
|
140
18
|
describe "commands" do
|
|
@@ -4,6 +4,42 @@ require 'tmpdir'
|
|
|
4
4
|
|
|
5
5
|
module RSpec::Core
|
|
6
6
|
describe CommandLine do
|
|
7
|
+
|
|
8
|
+
describe "#run" do
|
|
9
|
+
include_context "spec files"
|
|
10
|
+
|
|
11
|
+
let(:out) { StringIO.new }
|
|
12
|
+
let(:err) { StringIO.new }
|
|
13
|
+
|
|
14
|
+
def config_options(argv=[])
|
|
15
|
+
options = RSpec::Core::ConfigurationOptions.new(argv)
|
|
16
|
+
options.parse_options
|
|
17
|
+
options
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def command_line(args)
|
|
21
|
+
RSpec::Core::CommandLine.new(config_options(args))
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def config_options(argv=[])
|
|
25
|
+
options = RSpec::Core::ConfigurationOptions.new(argv)
|
|
26
|
+
options.parse_options
|
|
27
|
+
options
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
it "returns 0 if spec passes" do
|
|
31
|
+
err, out = StringIO.new, StringIO.new
|
|
32
|
+
result = command_line([passing_spec_filename]).run(err, out)
|
|
33
|
+
result.should be(0)
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
it "returns 1 if spec passes" do
|
|
37
|
+
err, out = StringIO.new, StringIO.new
|
|
38
|
+
result = command_line([failing_spec_filename]).run(err, out)
|
|
39
|
+
result.should be(1)
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
|
|
7
43
|
context "given an Array of options" do
|
|
8
44
|
it "assigns ConfigurationOptions built from Array to @options" do
|
|
9
45
|
config_options = ConfigurationOptions.new(%w[--color])
|
|
@@ -50,8 +86,6 @@ module RSpec::Core
|
|
|
50
86
|
config.stub(:run_hook)
|
|
51
87
|
|
|
52
88
|
config.should_receive(:load_spec_files)
|
|
53
|
-
config.should_receive(:configure_mock_framework)
|
|
54
|
-
config.should_receive(:configure_expectation_framework)
|
|
55
89
|
|
|
56
90
|
world.should_receive(:announce_inclusion_filter)
|
|
57
91
|
world.should_receive(:announce_exclusion_filter)
|
|
@@ -5,7 +5,7 @@ module RSpec::Core
|
|
|
5
5
|
|
|
6
6
|
describe Configuration do
|
|
7
7
|
|
|
8
|
-
let(:config) {
|
|
8
|
+
let(:config) { Configuration.new }
|
|
9
9
|
|
|
10
10
|
describe "#load_spec_files" do
|
|
11
11
|
|
|
@@ -30,6 +30,17 @@ module RSpec::Core
|
|
|
30
30
|
end
|
|
31
31
|
end
|
|
32
32
|
|
|
33
|
+
describe "#treat_symbols_as_metadata_keys_with_true_values?" do
|
|
34
|
+
it 'defaults to false' do
|
|
35
|
+
config.treat_symbols_as_metadata_keys_with_true_values?.should be_false
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
it 'can be set to true' do
|
|
39
|
+
config.treat_symbols_as_metadata_keys_with_true_values = true
|
|
40
|
+
config.treat_symbols_as_metadata_keys_with_true_values?.should be_true
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
|
|
33
44
|
describe "#mock_framework" do
|
|
34
45
|
it "defaults to :rspec" do
|
|
35
46
|
config.should_receive(:require).with('rspec/core/mocking/with_rspec')
|
|
@@ -100,16 +111,46 @@ module RSpec::Core
|
|
|
100
111
|
end
|
|
101
112
|
end
|
|
102
113
|
|
|
103
|
-
|
|
114
|
+
describe "#expecting_with_rspec?" do
|
|
115
|
+
before(:each) do
|
|
116
|
+
# prevent minitest assertions from being required and included,
|
|
117
|
+
# as that causes problems in some of our specs.
|
|
118
|
+
config.stub(:require)
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
it "returns false by default" do
|
|
122
|
+
config.should_not be_expecting_with_rspec
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
it "returns true when `expect_with :rspec` has been configured" do
|
|
126
|
+
config.expect_with :rspec
|
|
127
|
+
config.should be_expecting_with_rspec
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
it "returns true when `expect_with :rspec, :stdlib` has been configured" do
|
|
131
|
+
config.expect_with :rspec, :stdlib
|
|
132
|
+
config.should be_expecting_with_rspec
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
it "returns true when `expect_with :stdlib, :rspec` has been configured" do
|
|
136
|
+
config.expect_with :stdlib, :rspec
|
|
137
|
+
config.should be_expecting_with_rspec
|
|
138
|
+
end
|
|
104
139
|
|
|
140
|
+
it "returns false when `expect_with :stdlib` has been configured" do
|
|
141
|
+
config.expect_with :stdlib
|
|
142
|
+
config.should_not be_expecting_with_rspec
|
|
143
|
+
end
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
describe "#files_to_run" do
|
|
105
147
|
it "loads files not following pattern if named explicitly" do
|
|
106
148
|
file = "./spec/rspec/core/resources/a_bar.rb"
|
|
107
149
|
config.files_or_directories_to_run = file
|
|
108
150
|
config.files_to_run.should == [file]
|
|
109
151
|
end
|
|
110
152
|
|
|
111
|
-
|
|
112
|
-
|
|
153
|
+
context "with default pattern" do
|
|
113
154
|
it "loads files named _spec.rb" do
|
|
114
155
|
dir = "./spec/rspec/core/resources"
|
|
115
156
|
config.files_or_directories_to_run = dir
|
|
@@ -121,80 +162,70 @@ module RSpec::Core
|
|
|
121
162
|
config.files_or_directories_to_run = file
|
|
122
163
|
config.files_to_run.should == [file]
|
|
123
164
|
end
|
|
124
|
-
|
|
125
165
|
end
|
|
166
|
+
end
|
|
126
167
|
|
|
127
|
-
|
|
168
|
+
%w[pattern= filename_pattern=].each do |setter|
|
|
169
|
+
describe "##{setter}" do
|
|
170
|
+
context "with single pattern" do
|
|
171
|
+
before { config.send(setter, "**/*_foo.rb") }
|
|
172
|
+
it "loads files following pattern" do
|
|
173
|
+
file = File.expand_path(File.dirname(__FILE__) + "/resources/a_foo.rb")
|
|
174
|
+
config.files_or_directories_to_run = file
|
|
175
|
+
config.files_to_run.should include(file)
|
|
176
|
+
end
|
|
128
177
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
178
|
+
it "loads files in directories following pattern" do
|
|
179
|
+
dir = File.expand_path(File.dirname(__FILE__) + "/resources")
|
|
180
|
+
config.files_or_directories_to_run = dir
|
|
181
|
+
config.files_to_run.should include("#{dir}/a_foo.rb")
|
|
182
|
+
end
|
|
132
183
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
184
|
+
it "does not load files in directories not following pattern" do
|
|
185
|
+
dir = File.expand_path(File.dirname(__FILE__) + "/resources")
|
|
186
|
+
config.files_or_directories_to_run = dir
|
|
187
|
+
config.files_to_run.should_not include("#{dir}/a_bar.rb")
|
|
188
|
+
end
|
|
137
189
|
end
|
|
138
190
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
191
|
+
context "with multiple patterns" do
|
|
192
|
+
it "supports comma separated values" do
|
|
193
|
+
config.send(setter, "**/*_foo.rb,**/*_bar.rb")
|
|
194
|
+
dir = File.expand_path(File.dirname(__FILE__) + "/resources")
|
|
195
|
+
config.files_or_directories_to_run = dir
|
|
196
|
+
config.files_to_run.should include("#{dir}/a_foo.rb")
|
|
197
|
+
config.files_to_run.should include("#{dir}/a_bar.rb")
|
|
198
|
+
end
|
|
144
199
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
200
|
+
it "supports comma separated values with spaces" do
|
|
201
|
+
config.send(setter, "**/*_foo.rb, **/*_bar.rb")
|
|
202
|
+
dir = File.expand_path(File.dirname(__FILE__) + "/resources")
|
|
203
|
+
config.files_or_directories_to_run = dir
|
|
204
|
+
config.files_to_run.should include("#{dir}/a_foo.rb")
|
|
205
|
+
config.files_to_run.should include("#{dir}/a_bar.rb")
|
|
206
|
+
end
|
|
149
207
|
end
|
|
150
|
-
|
|
151
208
|
end
|
|
209
|
+
end
|
|
152
210
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
end
|
|
158
|
-
|
|
159
|
-
it "supports comma separated values" do
|
|
160
|
-
dir = File.expand_path(File.dirname(__FILE__) + "/resources")
|
|
161
|
-
config.files_or_directories_to_run = dir
|
|
162
|
-
config.files_to_run.should include("#{dir}/a_foo.rb")
|
|
163
|
-
config.files_to_run.should include("#{dir}/a_bar.rb")
|
|
164
|
-
end
|
|
165
|
-
|
|
166
|
-
it "supports comma separated values with spaces" do
|
|
167
|
-
dir = File.expand_path(File.dirname(__FILE__) + "/resources")
|
|
168
|
-
config.files_or_directories_to_run = dir
|
|
169
|
-
config.files_to_run.should include("#{dir}/a_foo.rb")
|
|
170
|
-
config.files_to_run.should include("#{dir}/a_bar.rb")
|
|
171
|
-
end
|
|
172
|
-
|
|
211
|
+
describe "path with line number" do
|
|
212
|
+
it "assigns the line number as the filter" do
|
|
213
|
+
config.files_or_directories_to_run = "path/to/a_spec.rb:37"
|
|
214
|
+
config.filter.should == {:line_number => 37}
|
|
173
215
|
end
|
|
216
|
+
end
|
|
174
217
|
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
end
|
|
181
|
-
|
|
218
|
+
context "with full_description" do
|
|
219
|
+
it "overrides :focused" do
|
|
220
|
+
config.filter_run :focused => true
|
|
221
|
+
config.full_description = "foo"
|
|
222
|
+
config.filter.should_not have_key(:focused)
|
|
182
223
|
end
|
|
183
224
|
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
config.full_description = "foo"
|
|
188
|
-
config.filter.should_not have_key(:focused)
|
|
189
|
-
end
|
|
190
|
-
|
|
191
|
-
it "assigns the example name as the filter on description" do
|
|
192
|
-
config.full_description = "foo"
|
|
193
|
-
config.filter.should == {:full_description => /foo/}
|
|
194
|
-
end
|
|
195
|
-
|
|
225
|
+
it "assigns the example name as the filter on description" do
|
|
226
|
+
config.full_description = "foo"
|
|
227
|
+
config.filter.should == {:full_description => /foo/}
|
|
196
228
|
end
|
|
197
|
-
|
|
198
229
|
end
|
|
199
230
|
|
|
200
231
|
describe "#include" do
|
|
@@ -205,6 +236,13 @@ module RSpec::Core
|
|
|
205
236
|
end
|
|
206
237
|
end
|
|
207
238
|
|
|
239
|
+
it_behaves_like "metadata hash builder" do
|
|
240
|
+
def metadata_hash(*args)
|
|
241
|
+
config.include(InstanceLevelMethods, *args)
|
|
242
|
+
config.include_or_extend_modules.last.last
|
|
243
|
+
end
|
|
244
|
+
end
|
|
245
|
+
|
|
208
246
|
context "with no filter" do
|
|
209
247
|
it "includes the given module into each example group" do
|
|
210
248
|
RSpec.configure do |c|
|
|
@@ -238,6 +276,13 @@ module RSpec::Core
|
|
|
238
276
|
end
|
|
239
277
|
end
|
|
240
278
|
|
|
279
|
+
it_behaves_like "metadata hash builder" do
|
|
280
|
+
def metadata_hash(*args)
|
|
281
|
+
config.extend(ThatThingISentYou, *args)
|
|
282
|
+
config.include_or_extend_modules.last.last
|
|
283
|
+
end
|
|
284
|
+
end
|
|
285
|
+
|
|
241
286
|
it "extends the given module into each matching example group" do
|
|
242
287
|
RSpec.configure do |c|
|
|
243
288
|
c.extend(ThatThingISentYou, :magic_key => :extend)
|
|
@@ -249,7 +294,7 @@ module RSpec::Core
|
|
|
249
294
|
|
|
250
295
|
end
|
|
251
296
|
|
|
252
|
-
describe "run_all_when_everything_filtered?" do
|
|
297
|
+
describe "#run_all_when_everything_filtered?" do
|
|
253
298
|
|
|
254
299
|
it "defaults to false" do
|
|
255
300
|
config.run_all_when_everything_filtered?.should be_false
|
|
@@ -350,14 +395,14 @@ module RSpec::Core
|
|
|
350
395
|
end
|
|
351
396
|
end
|
|
352
397
|
|
|
353
|
-
describe 'formatter=' do
|
|
398
|
+
describe '#formatter=' do
|
|
354
399
|
it "delegates to add_formatter (better API for user-facing configuration)" do
|
|
355
400
|
config.should_receive(:add_formatter).with('these','options')
|
|
356
401
|
config.add_formatter('these','options')
|
|
357
402
|
end
|
|
358
403
|
end
|
|
359
404
|
|
|
360
|
-
describe "add_formatter" do
|
|
405
|
+
describe "#add_formatter" do
|
|
361
406
|
|
|
362
407
|
it "adds to the list of formatters" do
|
|
363
408
|
config.add_formatter :documentation
|
|
@@ -421,6 +466,13 @@ module RSpec::Core
|
|
|
421
466
|
end
|
|
422
467
|
|
|
423
468
|
describe "#filter_run" do
|
|
469
|
+
it_behaves_like "metadata hash builder" do
|
|
470
|
+
def metadata_hash(*args)
|
|
471
|
+
config.filter_run *args
|
|
472
|
+
config.filter
|
|
473
|
+
end
|
|
474
|
+
end
|
|
475
|
+
|
|
424
476
|
it "sets the filter" do
|
|
425
477
|
config.filter_run :focus => true
|
|
426
478
|
config.filter[:focus].should == true
|
|
@@ -454,6 +506,13 @@ module RSpec::Core
|
|
|
454
506
|
end
|
|
455
507
|
|
|
456
508
|
describe "#filter_run_excluding" do
|
|
509
|
+
it_behaves_like "metadata hash builder" do
|
|
510
|
+
def metadata_hash(*args)
|
|
511
|
+
config.filter_run_excluding *args
|
|
512
|
+
config.exclusion_filter
|
|
513
|
+
end
|
|
514
|
+
end
|
|
515
|
+
|
|
457
516
|
it "sets the filter" do
|
|
458
517
|
config.filter_run_excluding :slow => true
|
|
459
518
|
config.exclusion_filter[:slow].should == true
|
|
@@ -502,7 +561,7 @@ module RSpec::Core
|
|
|
502
561
|
end
|
|
503
562
|
end
|
|
504
563
|
|
|
505
|
-
describe "line_number=" do
|
|
564
|
+
describe "#line_number=" do
|
|
506
565
|
before { config.stub(:warn) }
|
|
507
566
|
|
|
508
567
|
it "sets the line number" do
|
|
@@ -524,9 +583,18 @@ module RSpec::Core
|
|
|
524
583
|
end
|
|
525
584
|
|
|
526
585
|
describe "#full_backtrace=" do
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
586
|
+
context "given true" do
|
|
587
|
+
it "clears the backtrace clean patterns" do
|
|
588
|
+
config.full_backtrace = true
|
|
589
|
+
config.backtrace_clean_patterns.should == []
|
|
590
|
+
end
|
|
591
|
+
end
|
|
592
|
+
|
|
593
|
+
context "given false" do
|
|
594
|
+
it "restores backtrace clean patterns" do
|
|
595
|
+
config.full_backtrace = false
|
|
596
|
+
config.backtrace_clean_patterns.should == RSpec::Core::Configuration::DEFAULT_BACKTRACE_PATTERNS
|
|
597
|
+
end
|
|
530
598
|
end
|
|
531
599
|
|
|
532
600
|
it "doesn't impact other instances of config" do
|
|
@@ -712,5 +780,17 @@ module RSpec::Core
|
|
|
712
780
|
group.included_modules.should include(mod2)
|
|
713
781
|
end
|
|
714
782
|
end
|
|
783
|
+
|
|
784
|
+
describe "#alias_example_to" do
|
|
785
|
+
it_behaves_like "metadata hash builder" do
|
|
786
|
+
def metadata_hash(*args)
|
|
787
|
+
config.alias_example_to :my_example, *args
|
|
788
|
+
group = ExampleGroup.describe("group")
|
|
789
|
+
example = group.my_example("description")
|
|
790
|
+
example.metadata
|
|
791
|
+
end
|
|
792
|
+
end
|
|
793
|
+
end
|
|
794
|
+
|
|
715
795
|
end
|
|
716
796
|
end
|
|
@@ -11,6 +11,16 @@ describe "deprecations" do
|
|
|
11
11
|
RSpec.stub(:warn_deprecation)
|
|
12
12
|
Spec.should == RSpec
|
|
13
13
|
end
|
|
14
|
+
|
|
15
|
+
it "doesn't include backward compatibility in const_missing backtrace" do
|
|
16
|
+
RSpec.stub(:warn_deprecation)
|
|
17
|
+
exception = nil
|
|
18
|
+
begin
|
|
19
|
+
ConstantThatDoesNotExist
|
|
20
|
+
rescue Exception => exception
|
|
21
|
+
end
|
|
22
|
+
exception.backtrace.find { |l| l =~ /lib\/rspec\/core\/backward_compatibility/ }.should be_nil
|
|
23
|
+
end
|
|
14
24
|
end
|
|
15
25
|
|
|
16
26
|
describe RSpec::Core::ExampleGroup do
|
|
@@ -41,5 +51,16 @@ describe "deprecations" do
|
|
|
41
51
|
RSpec.should_receive(:deprecate)
|
|
42
52
|
Spec::Rake::SpecTask
|
|
43
53
|
end
|
|
54
|
+
|
|
55
|
+
it "doesn't include backward compatibility in const_missing backtrace" do
|
|
56
|
+
RSpec.stub(:warn_deprecation)
|
|
57
|
+
exception = nil
|
|
58
|
+
begin
|
|
59
|
+
Spec::Rake::ConstantThatDoesNotExist
|
|
60
|
+
rescue Exception => exception
|
|
61
|
+
end
|
|
62
|
+
exception.backtrace.find { |l| l =~ /lib\/rspec\/core\/backward_compatibility/ }.should be_nil
|
|
63
|
+
end
|
|
44
64
|
end
|
|
65
|
+
|
|
45
66
|
end
|