rspec-core 2.0.0.beta.20 → 2.0.0.beta.22

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.
Files changed (48) hide show
  1. data/.rspec +1 -1
  2. data/Gemfile +7 -6
  3. data/History.md +30 -0
  4. data/Rakefile +3 -43
  5. data/bin/rspec +2 -1
  6. data/features/configuration/{options_file.feature → read_options_from_file.feature} +29 -25
  7. data/features/example_groups/shared_example_group.feature +10 -6
  8. data/features/hooks/before_and_after_hooks.feature +38 -0
  9. data/lib/autotest/rspec2.rb +10 -2
  10. data/lib/rspec/core.rb +8 -0
  11. data/lib/rspec/core/configuration.rb +16 -10
  12. data/lib/rspec/core/configuration_options.rb +7 -3
  13. data/lib/rspec/core/example.rb +7 -0
  14. data/lib/rspec/core/example_group.rb +15 -2
  15. data/lib/rspec/core/extensions/module_eval_with_args.rb +9 -29
  16. data/lib/rspec/core/extensions/object.rb +0 -2
  17. data/lib/rspec/core/formatters/base_formatter.rb +8 -6
  18. data/lib/rspec/core/formatters/base_text_formatter.rb +18 -10
  19. data/lib/rspec/core/formatters/documentation_formatter.rb +9 -9
  20. data/lib/rspec/core/option_parser.rb +0 -4
  21. data/lib/rspec/core/rake_task.rb +85 -39
  22. data/lib/rspec/core/reporter.rb +18 -5
  23. data/lib/rspec/core/runner.rb +8 -18
  24. data/lib/rspec/core/shared_example_group.rb +2 -1
  25. data/lib/rspec/core/version.rb +1 -1
  26. data/rspec-core.gemspec +33 -233
  27. data/spec/autotest/failed_results_re_spec.rb +1 -2
  28. data/spec/autotest/rspec_spec.rb +62 -42
  29. data/spec/rspec/core/configuration_options_spec.rb +12 -29
  30. data/spec/rspec/core/configuration_spec.rb +8 -8
  31. data/spec/rspec/core/example_group_spec.rb +38 -7
  32. data/spec/rspec/core/example_spec.rb +16 -1
  33. data/spec/rspec/core/formatters/base_formatter_spec.rb +6 -0
  34. data/spec/rspec/core/formatters/base_text_formatter_spec.rb +125 -10
  35. data/spec/rspec/core/formatters/documentation_formatter_spec.rb +36 -0
  36. data/spec/rspec/core/formatters/html_formatted-1.8.7-jruby.html +282 -0
  37. data/spec/rspec/core/formatters/html_formatted-1.9.1.html +22 -2
  38. data/spec/rspec/core/formatters/text_mate_formatted-1.8.7-jruby.html +280 -0
  39. data/spec/rspec/core/formatters/text_mate_formatted-1.9.1.html +280 -0
  40. data/spec/rspec/core/rake_task_spec.rb +128 -0
  41. data/spec/rspec/core/reporter_spec.rb +36 -0
  42. data/spec/rspec/core/runner_spec.rb +0 -18
  43. data/spec/rspec/core/shared_example_group_spec.rb +22 -2
  44. data/spec/rspec/core/world_spec.rb +13 -15
  45. data/spec/spec_helper.rb +2 -1
  46. metadata +110 -13
  47. data/VERSION +0 -1
  48. data/lib/rspec/autorun.rb +0 -2
@@ -22,7 +22,8 @@ module RSpec
22
22
  end
23
23
 
24
24
  def self.included(kls)
25
- kls.module_eval(&@shared_block)
25
+ kls.describe(&@shared_block)
26
+ kls.children.first.metadata[:shared_group_name] = name
26
27
  end
27
28
  end
28
29
 
@@ -1,7 +1,7 @@
1
1
  module RSpec # :nodoc:
2
2
  module Core # :nodoc:
3
3
  module Version # :nodoc:
4
- STRING = File.readlines(File.expand_path('../../../../VERSION', __FILE__)).first
4
+ STRING = '2.0.0.beta.22'
5
5
  end
6
6
  end
7
7
  end
@@ -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 = %q{rspec-core}
8
- s.version = "2.0.0.beta.20"
9
-
10
- s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["Chad Humphries", "David Chelimsky"]
12
- s.date = %q{2010-08-24}
13
- s.default_executable = %q{rspec}
14
- s.description = %q{RSpec runner and example groups}
15
- s.email = %q{dchelimsky@gmail.com;chad.humphries@gmail.com}
16
- s.executables = ["rspec"]
17
- s.extra_rdoc_files = [
18
- "README.markdown"
19
- ]
20
- s.files = [
21
- ".document",
22
- ".gitignore",
23
- ".rspec",
24
- ".treasure_map.rb",
25
- "Gemfile",
26
- "License.txt",
27
- "README.markdown",
28
- "Rakefile",
29
- "Upgrade.markdown",
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
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
228
- s.add_development_dependency(%q<rspec-expectations>, [">= 2.0.0.beta.20"])
229
- s.add_development_dependency(%q<rspec-mocks>, [">= 2.0.0.beta.20"])
230
- s.add_development_dependency(%q<cucumber>, [">= 0.5.3"])
231
- s.add_development_dependency(%q<autotest>, [">= 4.2.9"])
232
- else
233
- s.add_dependency(%q<rspec-expectations>, [">= 2.0.0.beta.20"])
234
- s.add_dependency(%q<rspec-mocks>, [">= 2.0.0.beta.20"])
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 == "./spec/autotest/failed_results_re_spec.rb"
19
+ $2.should == __FILE__.sub(File.expand_path('.'),'.')
20
20
  end
21
-
22
21
  end
@@ -1,112 +1,132 @@
1
1
  require "spec_helper"
2
2
 
3
3
  describe Autotest::Rspec2 do
4
- describe "commands" do
5
- before(:each) do
6
- @rspec_autotest = Autotest::Rspec2.new
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
- @ruby = @rspec_autotest.ruby
10
- @spec_cmd = File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'bin', 'rspec'))
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
- @rspec_autotest.files_to_test = @files_to_test
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 "should make the appropriate test command" do
22
- actual = @rspec_autotest.make_test_cmd(@files_to_test)
23
- expected = /#{@ruby}.*#{@spec_cmd} (.*)/
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
- actual.should match(expected)
25
+ actual_command.should match(expected_command)
26
26
 
27
- actual =~ expected
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 "should return a blank command for no files" do
33
- @rspec_autotest.make_test_cmd({}).should == ''
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
- @rspec_autotest = Autotest::Rspec2.new
43
- @rspec_autotest.hook :initialize
48
+ rspec_autotest.hook :initialize
44
49
  end
45
50
 
46
- it "should find the spec file for a given lib file" do
47
- @rspec_autotest.should map_specs([@spec_file]).to(@lib_file)
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 "should find the spec file if given a spec file" do
51
- @rspec_autotest.should map_specs([@spec_file]).to(@spec_file)
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 "should ignore files in spec dir that aren't specs" do
55
- @rspec_autotest.should map_specs([]).to("spec/spec_helper.rb")
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 "should ignore untracked files (in @file)" do
59
- @rspec_autotest.should map_specs([]).to("lib/untracked_file")
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(:each) do
65
- @rspec_autotest = Autotest::Rspec2.new
66
-
69
+ before do
67
70
  @spec_file = "spec/autotest/some_spec.rb"
68
- @rspec_autotest.instance_variable_set("@files", {@spec_file => Time.now})
69
- @rspec_autotest.stub!(:find_files_to_test).and_return true
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 "should return no failures if no failures were given in the output" do
73
- @rspec_autotest.consolidate_failures([[]]).should == {}
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 "should return a hash with the spec filename => spec name for each failure or error" do
77
- @rspec_autotest.stub!(:test_files_for).and_return "spec/autotest/some_spec.rb"
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
- @rspec_autotest.consolidate_failures(failures).should == {
87
+ rspec_autotest.consolidate_failures(failures).should == {
85
88
  @spec_file => ["false should be false"]
86
89
  }
87
90
  end
88
91
 
89
- it "should not include the subject file" do
92
+ it "does not include the subject file" do
90
93
  subject_file = "lib/autotest/some.rb"
91
- @rspec_autotest.stub!(:test_files_for).and_return "spec/autotest/some_spec.rb"
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
- @rspec_autotest.consolidate_failures(failures).keys.should_not include(subject_file)
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 "should ensure that a single file appears in files_to_test only once" do
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
- @rspec_autotest.normalize(@files_to_test).should have(1).file
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