rspec-core 2.0.0.beta.20 → 2.0.0.beta.22
Sign up to get free protection for your applications and to get access to all the features.
- data/.rspec +1 -1
- data/Gemfile +7 -6
- data/History.md +30 -0
- data/Rakefile +3 -43
- data/bin/rspec +2 -1
- data/features/configuration/{options_file.feature → read_options_from_file.feature} +29 -25
- data/features/example_groups/shared_example_group.feature +10 -6
- data/features/hooks/before_and_after_hooks.feature +38 -0
- data/lib/autotest/rspec2.rb +10 -2
- data/lib/rspec/core.rb +8 -0
- data/lib/rspec/core/configuration.rb +16 -10
- data/lib/rspec/core/configuration_options.rb +7 -3
- data/lib/rspec/core/example.rb +7 -0
- data/lib/rspec/core/example_group.rb +15 -2
- data/lib/rspec/core/extensions/module_eval_with_args.rb +9 -29
- data/lib/rspec/core/extensions/object.rb +0 -2
- data/lib/rspec/core/formatters/base_formatter.rb +8 -6
- data/lib/rspec/core/formatters/base_text_formatter.rb +18 -10
- data/lib/rspec/core/formatters/documentation_formatter.rb +9 -9
- data/lib/rspec/core/option_parser.rb +0 -4
- data/lib/rspec/core/rake_task.rb +85 -39
- data/lib/rspec/core/reporter.rb +18 -5
- data/lib/rspec/core/runner.rb +8 -18
- data/lib/rspec/core/shared_example_group.rb +2 -1
- data/lib/rspec/core/version.rb +1 -1
- data/rspec-core.gemspec +33 -233
- data/spec/autotest/failed_results_re_spec.rb +1 -2
- data/spec/autotest/rspec_spec.rb +62 -42
- data/spec/rspec/core/configuration_options_spec.rb +12 -29
- data/spec/rspec/core/configuration_spec.rb +8 -8
- data/spec/rspec/core/example_group_spec.rb +38 -7
- data/spec/rspec/core/example_spec.rb +16 -1
- data/spec/rspec/core/formatters/base_formatter_spec.rb +6 -0
- data/spec/rspec/core/formatters/base_text_formatter_spec.rb +125 -10
- data/spec/rspec/core/formatters/documentation_formatter_spec.rb +36 -0
- data/spec/rspec/core/formatters/html_formatted-1.8.7-jruby.html +282 -0
- data/spec/rspec/core/formatters/html_formatted-1.9.1.html +22 -2
- data/spec/rspec/core/formatters/text_mate_formatted-1.8.7-jruby.html +280 -0
- data/spec/rspec/core/formatters/text_mate_formatted-1.9.1.html +280 -0
- data/spec/rspec/core/rake_task_spec.rb +128 -0
- data/spec/rspec/core/reporter_spec.rb +36 -0
- data/spec/rspec/core/runner_spec.rb +0 -18
- data/spec/rspec/core/shared_example_group_spec.rb +22 -2
- data/spec/rspec/core/world_spec.rb +13 -15
- data/spec/spec_helper.rb +2 -1
- metadata +110 -13
- data/VERSION +0 -1
- data/lib/rspec/autorun.rb +0 -2
data/lib/rspec/core/version.rb
CHANGED
data/rspec-core.gemspec
CHANGED
@@ -1,245 +1,45 @@
|
|
1
|
-
# Generated by jeweler
|
2
|
-
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
1
|
# -*- encoding: utf-8 -*-
|
2
|
+
$LOAD_PATH.unshift File.expand_path("../lib", __FILE__)
|
3
|
+
require "rspec/core/version"
|
5
4
|
|
6
5
|
Gem::Specification.new do |s|
|
7
|
-
s.name
|
8
|
-
s.version
|
9
|
-
|
10
|
-
s.
|
11
|
-
s.
|
12
|
-
s.
|
13
|
-
s.
|
14
|
-
s.description =
|
15
|
-
|
16
|
-
s.
|
17
|
-
s.
|
18
|
-
|
19
|
-
|
20
|
-
s.files
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
"
|
25
|
-
"
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
"VERSION",
|
31
|
-
"autotest/discover.rb",
|
32
|
-
"bin/rspec",
|
33
|
-
"cucumber.yml",
|
34
|
-
"features/README.markdown",
|
35
|
-
"features/command_line/configure.feature",
|
36
|
-
"features/command_line/example_name_option.feature",
|
37
|
-
"features/command_line/exit_status.feature",
|
38
|
-
"features/command_line/line_number_appended_to_path.feature",
|
39
|
-
"features/command_line/line_number_option.feature",
|
40
|
-
"features/configuration/custom_settings.feature",
|
41
|
-
"features/configuration/options_file.feature",
|
42
|
-
"features/example_groups/describe_aliases.feature",
|
43
|
-
"features/example_groups/nested_groups.feature",
|
44
|
-
"features/example_groups/shared_example_group.feature",
|
45
|
-
"features/filtering/exclusion_filters.feature",
|
46
|
-
"features/filtering/inclusion_filters.feature",
|
47
|
-
"features/formatters/custom_formatter.feature",
|
48
|
-
"features/hooks/around_hooks.feature",
|
49
|
-
"features/hooks/before_and_after_hooks.feature",
|
50
|
-
"features/hooks/described_class.feature",
|
51
|
-
"features/hooks/halt.feature",
|
52
|
-
"features/mock_framework_integration/use_flexmock.feature",
|
53
|
-
"features/mock_framework_integration/use_mocha.feature",
|
54
|
-
"features/mock_framework_integration/use_rr.feature",
|
55
|
-
"features/mock_framework_integration/use_rspec.feature",
|
56
|
-
"features/pending/pending_examples.feature",
|
57
|
-
"features/spec_files/arbitrary_file_suffix.feature",
|
58
|
-
"features/subject/attribute_of_subject.feature",
|
59
|
-
"features/subject/explicit_subject.feature",
|
60
|
-
"features/subject/implicit_subject.feature",
|
61
|
-
"features/support/env.rb",
|
62
|
-
"lib/autotest/rspec2.rb",
|
63
|
-
"lib/rspec/autorun.rb",
|
64
|
-
"lib/rspec/core.rb",
|
65
|
-
"lib/rspec/core/around_proxy.rb",
|
66
|
-
"lib/rspec/core/backward_compatibility.rb",
|
67
|
-
"lib/rspec/core/command_line.rb",
|
68
|
-
"lib/rspec/core/command_line_configuration.rb",
|
69
|
-
"lib/rspec/core/configuration.rb",
|
70
|
-
"lib/rspec/core/configuration_options.rb",
|
71
|
-
"lib/rspec/core/deprecation.rb",
|
72
|
-
"lib/rspec/core/drb_command_line.rb",
|
73
|
-
"lib/rspec/core/errors.rb",
|
74
|
-
"lib/rspec/core/example.rb",
|
75
|
-
"lib/rspec/core/example_group.rb",
|
76
|
-
"lib/rspec/core/extensions.rb",
|
77
|
-
"lib/rspec/core/extensions/instance_eval_with_args.rb",
|
78
|
-
"lib/rspec/core/extensions/kernel.rb",
|
79
|
-
"lib/rspec/core/extensions/module_eval_with_args.rb",
|
80
|
-
"lib/rspec/core/extensions/object.rb",
|
81
|
-
"lib/rspec/core/formatters.rb",
|
82
|
-
"lib/rspec/core/formatters/base_formatter.rb",
|
83
|
-
"lib/rspec/core/formatters/base_text_formatter.rb",
|
84
|
-
"lib/rspec/core/formatters/documentation_formatter.rb",
|
85
|
-
"lib/rspec/core/formatters/helpers.rb",
|
86
|
-
"lib/rspec/core/formatters/html_formatter.rb",
|
87
|
-
"lib/rspec/core/formatters/progress_formatter.rb",
|
88
|
-
"lib/rspec/core/formatters/snippet_extractor.rb",
|
89
|
-
"lib/rspec/core/formatters/text_mate_formatter.rb",
|
90
|
-
"lib/rspec/core/hooks.rb",
|
91
|
-
"lib/rspec/core/let.rb",
|
92
|
-
"lib/rspec/core/load_path.rb",
|
93
|
-
"lib/rspec/core/metadata.rb",
|
94
|
-
"lib/rspec/core/mocking/with_absolutely_nothing.rb",
|
95
|
-
"lib/rspec/core/mocking/with_flexmock.rb",
|
96
|
-
"lib/rspec/core/mocking/with_mocha.rb",
|
97
|
-
"lib/rspec/core/mocking/with_rr.rb",
|
98
|
-
"lib/rspec/core/mocking/with_rspec.rb",
|
99
|
-
"lib/rspec/core/option_parser.rb",
|
100
|
-
"lib/rspec/core/pending.rb",
|
101
|
-
"lib/rspec/core/rake_task.rb",
|
102
|
-
"lib/rspec/core/reporter.rb",
|
103
|
-
"lib/rspec/core/ruby_project.rb",
|
104
|
-
"lib/rspec/core/runner.rb",
|
105
|
-
"lib/rspec/core/shared_example_group.rb",
|
106
|
-
"lib/rspec/core/subject.rb",
|
107
|
-
"lib/rspec/core/version.rb",
|
108
|
-
"lib/rspec/core/world.rb",
|
109
|
-
"lib/rspec/monkey.rb",
|
110
|
-
"lib/rspec/monkey/spork/test_framework/rspec.rb",
|
111
|
-
"rspec-core.gemspec",
|
112
|
-
"script/console",
|
113
|
-
"spec/autotest/failed_results_re_spec.rb",
|
114
|
-
"spec/autotest/rspec_spec.rb",
|
115
|
-
"spec/rspec/core/command_line_configuration_spec.rb",
|
116
|
-
"spec/rspec/core/command_line_spec.rb",
|
117
|
-
"spec/rspec/core/command_line_spec_output.txt",
|
118
|
-
"spec/rspec/core/configuration_options_spec.rb",
|
119
|
-
"spec/rspec/core/configuration_spec.rb",
|
120
|
-
"spec/rspec/core/deprecations_spec.rb",
|
121
|
-
"spec/rspec/core/drb_command_line_spec.rb",
|
122
|
-
"spec/rspec/core/example_group_spec.rb",
|
123
|
-
"spec/rspec/core/example_spec.rb",
|
124
|
-
"spec/rspec/core/formatters/base_formatter_spec.rb",
|
125
|
-
"spec/rspec/core/formatters/base_text_formatter_spec.rb",
|
126
|
-
"spec/rspec/core/formatters/documentation_formatter_spec.rb",
|
127
|
-
"spec/rspec/core/formatters/helpers_spec.rb",
|
128
|
-
"spec/rspec/core/formatters/html_formatted-1.8.6.html",
|
129
|
-
"spec/rspec/core/formatters/html_formatted-1.8.7.html",
|
130
|
-
"spec/rspec/core/formatters/html_formatted-1.9.1.html",
|
131
|
-
"spec/rspec/core/formatters/html_formatted-1.9.2.html",
|
132
|
-
"spec/rspec/core/formatters/html_formatter_spec.rb",
|
133
|
-
"spec/rspec/core/formatters/progress_formatter_spec.rb",
|
134
|
-
"spec/rspec/core/formatters/snippet_extractor_spec.rb",
|
135
|
-
"spec/rspec/core/formatters/text_mate_formatted-1.8.6.html",
|
136
|
-
"spec/rspec/core/formatters/text_mate_formatted-1.8.7.html",
|
137
|
-
"spec/rspec/core/formatters/text_mate_formatted-1.9.2.html",
|
138
|
-
"spec/rspec/core/formatters/text_mate_formatter_spec.rb",
|
139
|
-
"spec/rspec/core/hooks_filtering_spec.rb",
|
140
|
-
"spec/rspec/core/hooks_spec.rb",
|
141
|
-
"spec/rspec/core/kernel_extensions_spec.rb",
|
142
|
-
"spec/rspec/core/let_spec.rb",
|
143
|
-
"spec/rspec/core/metadata_spec.rb",
|
144
|
-
"spec/rspec/core/option_parser_spec.rb",
|
145
|
-
"spec/rspec/core/pending_example_spec.rb",
|
146
|
-
"spec/rspec/core/reporter_spec.rb",
|
147
|
-
"spec/rspec/core/resources/a_bar.rb",
|
148
|
-
"spec/rspec/core/resources/a_foo.rb",
|
149
|
-
"spec/rspec/core/resources/a_spec.rb",
|
150
|
-
"spec/rspec/core/resources/custom_example_group_runner.rb",
|
151
|
-
"spec/rspec/core/resources/formatter_specs.rb",
|
152
|
-
"spec/rspec/core/resources/utf8_encoded.rb",
|
153
|
-
"spec/rspec/core/ruby_project_spec.rb",
|
154
|
-
"spec/rspec/core/runner_spec.rb",
|
155
|
-
"spec/rspec/core/shared_example_group_spec.rb",
|
156
|
-
"spec/rspec/core/subject_spec.rb",
|
157
|
-
"spec/rspec/core/world_spec.rb",
|
158
|
-
"spec/rspec/core_spec.rb",
|
159
|
-
"spec/ruby_forker.rb",
|
160
|
-
"spec/spec_helper.rb",
|
161
|
-
"spec/support/matchers.rb",
|
162
|
-
"specs.watchr"
|
163
|
-
]
|
164
|
-
s.homepage = %q{http://github.com/rspec/rspec-core}
|
165
|
-
s.post_install_message = %q{**************************************************
|
166
|
-
|
167
|
-
Thank you for installing rspec-core-2.0.0.beta.20
|
6
|
+
s.name = "rspec-core"
|
7
|
+
s.version = RSpec::Core::Version::STRING
|
8
|
+
s.platform = Gem::Platform::RUBY
|
9
|
+
s.authors = ["Chad Humphries", "David Chelimsky"]
|
10
|
+
s.email = "dchelimsky@gmail.com;chad.humphries@gmail.com"
|
11
|
+
s.homepage = "http://github.com/rspec/rspec-core"
|
12
|
+
s.summary = "rspec-core-#{RSpec::Core::Version::STRING}"
|
13
|
+
s.description = "RSpec runner and example groups"
|
14
|
+
|
15
|
+
s.rubygems_version = "1.3.7"
|
16
|
+
s.rubyforge_project = "rspec"
|
17
|
+
s.default_executable = "rspec"
|
18
|
+
|
19
|
+
s.files = `git ls-files`.split("\n")
|
20
|
+
s.test_files = `git ls-files -- {spec,features}/*`.split("\n")
|
21
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
22
|
+
s.extra_rdoc_files = [ "README.markdown" ]
|
23
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
24
|
+
s.require_path = "lib"
|
25
|
+
|
26
|
+
s.post_install_message = %Q{**************************************************
|
27
|
+
|
28
|
+
Thank you for installing #{s.summary}
|
168
29
|
|
169
30
|
Please be sure to look at Upgrade.markdown to see what might have changed
|
170
31
|
since the last release.
|
171
32
|
|
172
33
|
**************************************************
|
173
34
|
}
|
174
|
-
s.rdoc_options = ["--charset=UTF-8"]
|
175
|
-
s.require_paths = ["lib"]
|
176
|
-
s.rubyforge_project = %q{rspec}
|
177
|
-
s.rubygems_version = %q{1.3.7}
|
178
|
-
s.summary = %q{rspec-core-2.0.0.beta.20}
|
179
|
-
s.test_files = [
|
180
|
-
"spec/autotest/failed_results_re_spec.rb",
|
181
|
-
"spec/autotest/rspec_spec.rb",
|
182
|
-
"spec/rspec/core/command_line_configuration_spec.rb",
|
183
|
-
"spec/rspec/core/command_line_spec.rb",
|
184
|
-
"spec/rspec/core/configuration_options_spec.rb",
|
185
|
-
"spec/rspec/core/configuration_spec.rb",
|
186
|
-
"spec/rspec/core/deprecations_spec.rb",
|
187
|
-
"spec/rspec/core/drb_command_line_spec.rb",
|
188
|
-
"spec/rspec/core/example_group_spec.rb",
|
189
|
-
"spec/rspec/core/example_spec.rb",
|
190
|
-
"spec/rspec/core/formatters/base_formatter_spec.rb",
|
191
|
-
"spec/rspec/core/formatters/base_text_formatter_spec.rb",
|
192
|
-
"spec/rspec/core/formatters/documentation_formatter_spec.rb",
|
193
|
-
"spec/rspec/core/formatters/helpers_spec.rb",
|
194
|
-
"spec/rspec/core/formatters/html_formatter_spec.rb",
|
195
|
-
"spec/rspec/core/formatters/progress_formatter_spec.rb",
|
196
|
-
"spec/rspec/core/formatters/snippet_extractor_spec.rb",
|
197
|
-
"spec/rspec/core/formatters/text_mate_formatter_spec.rb",
|
198
|
-
"spec/rspec/core/hooks_filtering_spec.rb",
|
199
|
-
"spec/rspec/core/hooks_spec.rb",
|
200
|
-
"spec/rspec/core/kernel_extensions_spec.rb",
|
201
|
-
"spec/rspec/core/let_spec.rb",
|
202
|
-
"spec/rspec/core/metadata_spec.rb",
|
203
|
-
"spec/rspec/core/option_parser_spec.rb",
|
204
|
-
"spec/rspec/core/pending_example_spec.rb",
|
205
|
-
"spec/rspec/core/reporter_spec.rb",
|
206
|
-
"spec/rspec/core/resources/a_bar.rb",
|
207
|
-
"spec/rspec/core/resources/a_foo.rb",
|
208
|
-
"spec/rspec/core/resources/a_spec.rb",
|
209
|
-
"spec/rspec/core/resources/custom_example_group_runner.rb",
|
210
|
-
"spec/rspec/core/resources/formatter_specs.rb",
|
211
|
-
"spec/rspec/core/resources/utf8_encoded.rb",
|
212
|
-
"spec/rspec/core/ruby_project_spec.rb",
|
213
|
-
"spec/rspec/core/runner_spec.rb",
|
214
|
-
"spec/rspec/core/shared_example_group_spec.rb",
|
215
|
-
"spec/rspec/core/subject_spec.rb",
|
216
|
-
"spec/rspec/core/world_spec.rb",
|
217
|
-
"spec/rspec/core_spec.rb",
|
218
|
-
"spec/ruby_forker.rb",
|
219
|
-
"spec/spec_helper.rb",
|
220
|
-
"spec/support/matchers.rb"
|
221
|
-
]
|
222
|
-
|
223
|
-
if s.respond_to? :specification_version then
|
224
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
225
|
-
s.specification_version = 3
|
226
35
|
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
s.add_dependency(%q<cucumber>, [">= 0.5.3"])
|
236
|
-
s.add_dependency(%q<autotest>, [">= 4.2.9"])
|
237
|
-
end
|
238
|
-
else
|
239
|
-
s.add_dependency(%q<rspec-expectations>, [">= 2.0.0.beta.20"])
|
240
|
-
s.add_dependency(%q<rspec-mocks>, [">= 2.0.0.beta.20"])
|
241
|
-
s.add_dependency(%q<cucumber>, [">= 0.5.3"])
|
242
|
-
s.add_dependency(%q<autotest>, [">= 4.2.9"])
|
243
|
-
end
|
36
|
+
s.add_development_dependency "rspec-expectations", ">= #{RSpec::Core::Version::STRING}"
|
37
|
+
s.add_development_dependency "rspec-mocks", ">= #{RSpec::Core::Version::STRING}"
|
38
|
+
s.add_development_dependency "cucumber", ">= 0.5.3"
|
39
|
+
s.add_development_dependency "autotest", ">= 4.2.9"
|
40
|
+
s.add_development_dependency "syntax", ">= 1.0.0"
|
41
|
+
s.add_development_dependency "flexmock"
|
42
|
+
s.add_development_dependency "mocha"
|
43
|
+
s.add_development_dependency "rr"
|
244
44
|
end
|
245
45
|
|
@@ -16,7 +16,6 @@ describe "failed_results_re for autotest" do
|
|
16
16
|
re = Autotest::Rspec2.new.failed_results_re
|
17
17
|
re =~ example_output
|
18
18
|
$1.should == "group name example name\n Failure/Error: example = group.example(\"example name\") { \"this\".should eq(\"that\") }"
|
19
|
-
$2.should ==
|
19
|
+
$2.should == __FILE__.sub(File.expand_path('.'),'.')
|
20
20
|
end
|
21
|
-
|
22
21
|
end
|
data/spec/autotest/rspec_spec.rb
CHANGED
@@ -1,112 +1,132 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
3
|
describe Autotest::Rspec2 do
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
@rspec_autotest.stub!(:ruby).and_return "ruby"
|
4
|
+
let(:rspec_autotest) { Autotest::Rspec2.new }
|
5
|
+
let(:spec_cmd) { File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'bin', 'rspec')) }
|
6
|
+
let(:ruby_cmd) { "ruby" }
|
8
7
|
|
9
|
-
|
10
|
-
|
8
|
+
describe "commands" do
|
9
|
+
before do
|
10
|
+
rspec_autotest.stub(:ruby => ruby_cmd)
|
11
11
|
files = %w[file_one file_two]
|
12
12
|
@files_to_test = {
|
13
13
|
files[0] => [],
|
14
14
|
files[1] => []
|
15
15
|
}
|
16
16
|
# this is not the inner representation of Autotest!
|
17
|
-
|
17
|
+
rspec_autotest.files_to_test = @files_to_test
|
18
18
|
@to_test = files.map { |f| File.expand_path(f) }.join ' '
|
19
19
|
end
|
20
20
|
|
21
|
-
it "
|
22
|
-
|
23
|
-
|
21
|
+
it "makes the appropriate test command" do
|
22
|
+
actual_command = rspec_autotest.make_test_cmd(@files_to_test)
|
23
|
+
expected_command = /#{ruby_cmd}.*#{spec_cmd} (.*)/
|
24
24
|
|
25
|
-
|
25
|
+
actual_command.should match(expected_command)
|
26
26
|
|
27
|
-
|
27
|
+
actual_command =~ expected_command
|
28
28
|
$1.should =~ /#{File.expand_path('file_one')}/
|
29
29
|
$1.should =~ /#{File.expand_path('file_two')}/
|
30
30
|
end
|
31
31
|
|
32
|
-
it "
|
33
|
-
|
32
|
+
it "returns a blank command for no files" do
|
33
|
+
rspec_autotest.make_test_cmd({}).should eq('')
|
34
|
+
end
|
35
|
+
|
36
|
+
it "quotes the paths of files to test" do
|
37
|
+
cmd = rspec_autotest.make_test_cmd(@files_to_test)
|
38
|
+
@files_to_test.keys.each do |file_to_test|
|
39
|
+
cmd.should match(/'#{File.expand_path(file_to_test)}'/)
|
40
|
+
end
|
34
41
|
end
|
35
42
|
end
|
36
43
|
|
37
44
|
describe "mappings" do
|
38
|
-
|
39
|
-
before(:each) do
|
45
|
+
before do
|
40
46
|
@lib_file = "lib/something.rb"
|
41
47
|
@spec_file = "spec/something_spec.rb"
|
42
|
-
|
43
|
-
@rspec_autotest.hook :initialize
|
48
|
+
rspec_autotest.hook :initialize
|
44
49
|
end
|
45
50
|
|
46
|
-
it "
|
47
|
-
|
51
|
+
it "finds the spec file for a given lib file" do
|
52
|
+
rspec_autotest.should map_specs([@spec_file]).to(@lib_file)
|
48
53
|
end
|
49
54
|
|
50
|
-
it "
|
51
|
-
|
55
|
+
it "finds the spec file if given a spec file" do
|
56
|
+
rspec_autotest.should map_specs([@spec_file]).to(@spec_file)
|
52
57
|
end
|
53
58
|
|
54
|
-
it "
|
55
|
-
|
59
|
+
it "ignores files in spec dir that aren't specs" do
|
60
|
+
rspec_autotest.should map_specs([]).to("spec/spec_helper.rb")
|
56
61
|
end
|
57
62
|
|
58
|
-
it "
|
59
|
-
|
63
|
+
it "ignores untracked files (in @file)" do
|
64
|
+
rspec_autotest.should map_specs([]).to("lib/untracked_file")
|
60
65
|
end
|
61
66
|
end
|
62
67
|
|
63
68
|
describe "consolidating failures" do
|
64
|
-
before
|
65
|
-
@rspec_autotest = Autotest::Rspec2.new
|
66
|
-
|
69
|
+
before do
|
67
70
|
@spec_file = "spec/autotest/some_spec.rb"
|
68
|
-
|
69
|
-
|
71
|
+
rspec_autotest.instance_variable_set("@files", {@spec_file => Time.now})
|
72
|
+
rspec_autotest.stub!(:find_files_to_test).and_return true
|
70
73
|
end
|
71
74
|
|
72
|
-
it "
|
73
|
-
|
75
|
+
it "returns no failures if no failures were given in the output" do
|
76
|
+
rspec_autotest.consolidate_failures([[]]).should == {}
|
74
77
|
end
|
75
78
|
|
76
|
-
it "
|
77
|
-
|
79
|
+
it "returns a hash with the spec filename => spec name for each failure or error" do
|
80
|
+
rspec_autotest.stub!(:test_files_for).and_return "spec/autotest/some_spec.rb"
|
78
81
|
failures = [
|
79
82
|
[
|
80
83
|
"false should be false",
|
81
84
|
"#{@spec_file}"
|
82
85
|
]
|
83
86
|
]
|
84
|
-
|
87
|
+
rspec_autotest.consolidate_failures(failures).should == {
|
85
88
|
@spec_file => ["false should be false"]
|
86
89
|
}
|
87
90
|
end
|
88
91
|
|
89
|
-
it "
|
92
|
+
it "does not include the subject file" do
|
90
93
|
subject_file = "lib/autotest/some.rb"
|
91
|
-
|
94
|
+
rspec_autotest.stub!(:test_files_for).and_return "spec/autotest/some_spec.rb"
|
92
95
|
failures = [
|
93
96
|
[
|
94
97
|
"false should be false",
|
95
98
|
"expected: true,\n got: false (using ==)\n#{subject_file}:143:\n#{@spec_file}:203:"
|
96
99
|
]
|
97
100
|
]
|
98
|
-
|
101
|
+
rspec_autotest.consolidate_failures(failures).keys.should_not include(subject_file)
|
99
102
|
end
|
100
103
|
end
|
101
104
|
|
102
105
|
describe "normalizing file names" do
|
103
|
-
it "
|
104
|
-
@rspec_autotest = Autotest::Rspec2.new
|
106
|
+
it "ensures that a single file appears in files_to_test only once" do
|
105
107
|
@files_to_test = {}
|
106
108
|
['filename.rb', './filename.rb', File.expand_path('filename.rb')].each do |file|
|
107
109
|
@files_to_test[file] = []
|
108
110
|
end
|
109
|
-
|
111
|
+
rspec_autotest.normalize(@files_to_test).should have(1).file
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
describe "ruby command" do
|
116
|
+
context "using bundler" do
|
117
|
+
it "returns 'bundle exec'" do
|
118
|
+
File.stub(:exists?).with("./Gemfile") { true }
|
119
|
+
rspec_autotest.ruby.should eq("bundle exec")
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
context "not using bundler" do
|
124
|
+
it "returns the ruby command generated by Autotest" do
|
125
|
+
autotest = Autotest.new
|
126
|
+
autotest_ruby_command = autotest.ruby
|
127
|
+
File.stub(:exists?).with("./Gemfile") { false }
|
128
|
+
rspec_autotest.ruby.should eq(autotest_ruby_command)
|
129
|
+
end
|
110
130
|
end
|
111
131
|
end
|
112
132
|
end
|