rspec-core 2.6.0 → 2.7.0.rc1

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 (113) hide show
  1. data/README.md +1 -1
  2. data/features/Upgrade.md +11 -0
  3. data/features/command_line/exit_status.feature +20 -3
  4. data/features/command_line/format_option.feature +8 -0
  5. data/features/command_line/line_number_appended_to_path.feature +35 -1
  6. data/features/command_line/line_number_option.feature +16 -3
  7. data/features/command_line/pattern_option.feature +31 -0
  8. data/features/command_line/rake_task.feature +1 -1
  9. data/features/command_line/ruby.feature +22 -0
  10. data/features/configuration/default_path.feature +38 -0
  11. data/features/example_groups/{shared_example_group.feature → shared_examples.feature} +49 -26
  12. data/features/expectation_framework_integration/configure_expectation_framework.feature +1 -1
  13. data/features/filtering/inclusion_filters.feature +4 -5
  14. data/features/formatters/text_formatter.feature +16 -13
  15. data/features/helper_methods/let.feature +4 -4
  16. data/features/hooks/around_hooks.feature +1 -1
  17. data/features/hooks/before_and_after_hooks.feature +3 -3
  18. data/features/hooks/filtering.feature +13 -6
  19. data/features/metadata/user_defined.feature +12 -10
  20. data/features/pending/pending_examples.feature +21 -8
  21. data/features/step_definitions/additional_cli_steps.rb +1 -1
  22. data/features/subject/attribute_of_subject.feature +2 -2
  23. data/features/support/env.rb +1 -2
  24. data/lib/rspec/core/backward_compatibility.rb +1 -1
  25. data/lib/rspec/core/configuration.rb +71 -16
  26. data/lib/rspec/core/configuration_options.rb +46 -16
  27. data/lib/rspec/core/{extensions/object.rb → dsl.rb} +2 -4
  28. data/lib/rspec/core/example.rb +10 -7
  29. data/lib/rspec/core/example_group.rb +34 -18
  30. data/lib/rspec/core/expecting/with_rspec.rb +0 -2
  31. data/lib/rspec/core/extensions.rb +0 -1
  32. data/lib/rspec/core/formatters/base_formatter.rb +8 -4
  33. data/lib/rspec/core/formatters/base_text_formatter.rb +38 -18
  34. data/lib/rspec/core/formatters/html_formatter.rb +3 -1
  35. data/lib/rspec/core/formatters/snippet_extractor.rb +9 -3
  36. data/lib/rspec/core/formatters/text_mate_formatter.rb +20 -6
  37. data/lib/rspec/core/hooks.rb +7 -6
  38. data/lib/rspec/core/let.rb +5 -5
  39. data/lib/rspec/core/metadata.rb +136 -94
  40. data/lib/rspec/core/metadata_hash_builder.rb +1 -1
  41. data/lib/rspec/core/option_parser.rb +11 -7
  42. data/lib/rspec/core/pending.rb +2 -1
  43. data/lib/rspec/core/rake_task.rb +26 -15
  44. data/lib/rspec/core/reporter.rb +5 -6
  45. data/lib/rspec/core/runner.rb +1 -1
  46. data/lib/rspec/core/shared_example_group.rb +4 -4
  47. data/lib/rspec/core/subject.rb +7 -7
  48. data/lib/rspec/core/version.rb +1 -1
  49. data/lib/rspec/core/world.rb +9 -13
  50. data/lib/rspec/core.rb +14 -21
  51. data/spec/autotest/discover_spec.rb +2 -2
  52. data/spec/autotest/failed_results_re_spec.rb +29 -21
  53. data/spec/autotest/rspec_spec.rb +3 -3
  54. data/spec/rspec/core/command_line_spec.rb +1 -6
  55. data/spec/rspec/core/configuration_options_spec.rb +111 -27
  56. data/spec/rspec/core/configuration_spec.rb +161 -37
  57. data/spec/rspec/core/deprecations_spec.rb +2 -2
  58. data/spec/rspec/core/drb_command_line_spec.rb +6 -6
  59. data/spec/rspec/core/example_group_spec.rb +197 -61
  60. data/spec/rspec/core/example_spec.rb +33 -16
  61. data/spec/rspec/core/formatters/base_formatter_spec.rb +3 -3
  62. data/spec/rspec/core/formatters/base_text_formatter_spec.rb +222 -71
  63. data/spec/rspec/core/formatters/helpers_spec.rb +8 -8
  64. data/spec/rspec/core/formatters/html_formatted-1.8.7-jruby.html +90 -26
  65. data/spec/rspec/core/formatters/html_formatted-1.8.7.html +12 -11
  66. data/spec/rspec/core/formatters/html_formatted-1.9.2.html +12 -11
  67. data/spec/rspec/core/formatters/{html_formatted-1.9.1.html → html_formatted-1.9.3.html} +12 -11
  68. data/spec/rspec/core/formatters/html_formatter_spec.rb +5 -5
  69. data/spec/rspec/core/formatters/progress_formatter_spec.rb +2 -2
  70. data/spec/rspec/core/formatters/snippet_extractor_spec.rb +2 -2
  71. data/spec/rspec/core/formatters/text_mate_formatted-1.8.7-jruby.html +91 -27
  72. data/spec/rspec/core/formatters/text_mate_formatted-1.8.7.html +13 -12
  73. data/spec/rspec/core/formatters/text_mate_formatted-1.9.2.html +29 -28
  74. data/spec/rspec/core/formatters/{text_mate_formatted-1.9.1.html → text_mate_formatted-1.9.3.html} +29 -28
  75. data/spec/rspec/core/formatters/text_mate_formatter_spec.rb +2 -2
  76. data/spec/rspec/core/hooks_filtering_spec.rb +18 -18
  77. data/spec/rspec/core/let_spec.rb +19 -6
  78. data/spec/rspec/core/metadata_spec.rb +146 -61
  79. data/spec/rspec/core/pending_example_spec.rb +4 -4
  80. data/spec/rspec/core/rake_task_spec.rb +71 -50
  81. data/spec/rspec/core/reporter_spec.rb +2 -2
  82. data/spec/rspec/core/ruby_project_spec.rb +2 -2
  83. data/spec/rspec/core/runner_spec.rb +4 -1
  84. data/spec/rspec/core/shared_example_group_spec.rb +15 -119
  85. data/spec/rspec/core/subject_spec.rb +13 -13
  86. data/spec/rspec/core/world_spec.rb +31 -22
  87. data/spec/rspec/core_spec.rb +1 -29
  88. data/spec/spec_helper.rb +51 -50
  89. data/spec/support/shared_example_groups.rb +3 -3
  90. data/spec/support/spec_files.rb +8 -8
  91. metadata +79 -94
  92. data/.document +0 -5
  93. data/.gitignore +0 -12
  94. data/.rspec +0 -0
  95. data/.travis.yml +0 -7
  96. data/Gemfile +0 -50
  97. data/Guardfile +0 -5
  98. data/License.txt +0 -23
  99. data/Rakefile +0 -89
  100. data/cucumber.yml +0 -2
  101. data/features/.nav +0 -57
  102. data/features/Changelog.md +0 -269
  103. data/rspec-core.gemspec +0 -24
  104. data/script/FullBuildRakeFile +0 -63
  105. data/script/console +0 -8
  106. data/script/cucumber +0 -1
  107. data/script/full_build +0 -1
  108. data/script/spec +0 -1
  109. data/spec/rspec/core/formatters/html_formatted-1.8.6.html +0 -398
  110. data/spec/rspec/core/formatters/text_mate_formatted-1.8.6.html +0 -398
  111. data/spec.txt +0 -1126
  112. /data/{bin → exe}/autospec +0 -0
  113. /data/{bin → exe}/rspec +0 -0
@@ -1,5 +1,3 @@
1
- #!/usr/bin/env ruby
2
-
3
1
  require 'rspec/core'
4
2
  require 'rspec/core/deprecation'
5
3
  require 'rake'
@@ -8,6 +6,7 @@ require 'rake/tasklib'
8
6
  module RSpec
9
7
  module Core
10
8
  class RakeTask < ::Rake::TaskLib
9
+ include ::Rake::DSL if defined?(::Rake::DSL)
11
10
 
12
11
  # Name of task.
13
12
  #
@@ -21,19 +20,29 @@ module RSpec
21
20
  # 'spec/**/*_spec.rb'
22
21
  attr_accessor :pattern
23
22
 
23
+ # Deprecated and has no effect. The rake task now checks
24
+ # ENV['BUNDLE_GEMFILE'] instead.
25
+ #
24
26
  # By default, if there is a Gemfile, the generated command will include
25
27
  # 'bundle exec'. Set this to true to ignore the presence of a Gemfile, and
26
28
  # not add 'bundle exec' to the command.
27
29
  #
28
30
  # default:
29
31
  # false
30
- attr_accessor :skip_bundler
32
+ def skip_bundler=(*)
33
+ RSpec.deprecate("RSpec::Core::RakeTask#skip_bundler=", 'ENV["BUNDLE_GEMFILE"]')
34
+ end
31
35
 
32
- # Name of Gemfile to use
36
+ # Deprecated and has no effect. The rake task now checks
37
+ # ENV['BUNDLE_GEMFILE'] instead.
38
+ #
39
+ # Name of Gemfile to use.
33
40
  #
34
41
  # default:
35
42
  # Gemfile
36
- attr_accessor :gemfile
43
+ def gemfile=(*)
44
+ RSpec.deprecate("RSpec::Core::RakeTask#gemfile=", 'ENV["BUNDLE_GEMFILE"]')
45
+ end
37
46
 
38
47
  # Deprecated. Use ruby_opts="-w" instead.
39
48
  #
@@ -115,15 +124,14 @@ module RSpec
115
124
  def initialize(*args)
116
125
  @name = args.shift || :spec
117
126
  @pattern, @rcov_path, @rcov_opts, @ruby_opts, @rspec_opts = nil, nil, nil, nil, nil
118
- @warning, @rcov, @skip_bundler = false, false, false
127
+ @warning, @rcov = false, false
119
128
  @verbose, @fail_on_error = true, true
120
- @gemfile = 'Gemfile'
121
129
 
122
130
  yield self if block_given?
123
131
 
124
132
  @rcov_path ||= 'rcov'
125
133
  @rspec_path ||= 'rspec'
126
- @pattern ||= './spec/**/*_spec.rb'
134
+ @pattern ||= './spec{,/*/**}/*_spec.rb'
127
135
 
128
136
  desc("Run RSpec code examples") unless ::Rake.application.last_comment
129
137
 
@@ -133,11 +141,12 @@ module RSpec
133
141
  puts "No examples matching #{pattern} could be found"
134
142
  else
135
143
  begin
136
- ruby(spec_command)
144
+ puts spec_command if verbose
145
+ success = system(spec_command)
137
146
  rescue
138
147
  puts failure_message if failure_message
139
- raise("ruby #{spec_command} failed") if fail_on_error
140
148
  end
149
+ raise("ruby #{spec_command} failed") if fail_on_error unless success
141
150
  end
142
151
  end
143
152
  end
@@ -155,13 +164,15 @@ module RSpec
155
164
 
156
165
  def spec_command
157
166
  @spec_command ||= begin
158
- cmd_parts = [ruby_opts]
167
+ cmd_parts = []
168
+ cmd_parts << "bundle exec" if bundler?
169
+ cmd_parts << RUBY
170
+ cmd_parts << ruby_opts
159
171
  cmd_parts << "-w" if warning?
160
172
  cmd_parts << "-S"
161
- cmd_parts << "bundle exec" if gemfile? unless skip_bundler
162
173
  cmd_parts << runner
163
174
  if rcov
164
- cmd_parts << ["-Ispec#{File::PATH_SEPARATOR}lib", rcov_opts]
175
+ cmd_parts << ["-Ispec:lib", rcov_opts]
165
176
  else
166
177
  cmd_parts << rspec_opts
167
178
  end
@@ -187,8 +198,8 @@ module RSpec
187
198
  lambda {|s| s == ""}
188
199
  end
189
200
 
190
- def gemfile?
191
- File.exist?(gemfile)
201
+ def bundler?
202
+ ENV["BUNDLE_GEMFILE"] if ENV["BUNDLE_GEMFILE"] unless ENV["BUNDLE_GEMFILE"] == ""
192
203
  end
193
204
 
194
205
  end
@@ -3,7 +3,7 @@ module RSpec::Core
3
3
  def initialize(*formatters)
4
4
  @formatters = formatters
5
5
  @example_count = @failure_count = @pending_count = 0
6
- @duration = @start = nil
6
+ @duration = nil
7
7
  end
8
8
 
9
9
  def report(count)
@@ -11,11 +11,11 @@ module RSpec::Core
11
11
  begin
12
12
  yield self
13
13
  ensure
14
- conclude
14
+ finish
15
15
  end
16
16
  end
17
17
 
18
- def conclude
18
+ def finish
19
19
  begin
20
20
  stop
21
21
  notify :start_dump
@@ -27,10 +27,9 @@ module RSpec::Core
27
27
  end
28
28
  end
29
29
 
30
- alias_method :abort, :conclude
30
+ alias_method :abort, :finish
31
31
 
32
32
  def start(expected_example_count)
33
- @start = Time.now
34
33
  notify :start, expected_example_count
35
34
  end
36
35
 
@@ -66,7 +65,7 @@ module RSpec::Core
66
65
  end
67
66
 
68
67
  def stop
69
- @duration = Time.now - @start if @start
68
+ @duration = Time.now - $rspec_start_time
70
69
  notify :stop
71
70
  end
72
71
 
@@ -7,8 +7,8 @@ module RSpec
7
7
  # Register an at_exit hook that runs the suite.
8
8
  def self.autorun
9
9
  return if autorun_disabled? || installed_at_exit? || running_in_drb?
10
+ at_exit { exit run(ARGV, $stderr, $stdout).to_i }
10
11
  @installed_at_exit = true
11
- at_exit { exit(run(ARGV, $stderr, $stdout)) }
12
12
  end
13
13
  AT_EXIT_HOOK_BACKTRACE_LINE = "#{__FILE__}:#{__LINE__ - 2}:in `autorun'"
14
14
 
@@ -3,10 +3,10 @@ module RSpec
3
3
  module SharedExampleGroup
4
4
 
5
5
  def shared_context(*args, &block)
6
- if String === args.first || Symbol === args.first
7
- name = args.shift
8
- ensure_shared_example_group_name_not_taken(name)
9
- RSpec.world.shared_example_groups[name] = block
6
+ if [String, Symbol, Module].any? {|cls| cls === args.first }
7
+ object = args.shift
8
+ ensure_shared_example_group_name_not_taken(object)
9
+ RSpec.world.shared_example_groups[object] = block
10
10
  end
11
11
 
12
12
  unless args.empty?
@@ -75,14 +75,14 @@ module RSpec
75
75
  #
76
76
  # # This ...
77
77
  # describe Array do
78
- # its(:size) { should == 0 }
78
+ # its(:size) { should eq(0) }
79
79
  # end
80
80
  #
81
81
  # # ... generates the same runtime structure as this:
82
82
  # describe Array do
83
83
  # describe "size" do
84
- # it "should == 0" do
85
- # subject.size.should == 0
84
+ # it "should eq(0)" do
85
+ # subject.size.should eq(0)
86
86
  # end
87
87
  # end
88
88
  # end
@@ -98,7 +98,7 @@ module RSpec
98
98
  # end
99
99
  # end
100
100
  #
101
- # its("phone_numbers.first") { should == "555-1212" }
101
+ # its("phone_numbers.first") { should eq("555-1212") }
102
102
  # end
103
103
  #
104
104
  # When the subject is a +Hash+, you can refer to the Hash keys by
@@ -110,12 +110,12 @@ module RSpec
110
110
  # 'admin' => :all_permissions }
111
111
  # end
112
112
  #
113
- # its([:max_users]) { should == 3 }
114
- # its(['admin']) { should == :all_permissions }
113
+ # its([:max_users]) { should eq(3) }
114
+ # its(['admin']) { should eq(:all_permissions) }
115
115
  #
116
116
  # # You can still access to its regular methods this way:
117
117
  # its(:keys) { should include(:max_users) }
118
- # its(:count) { should == 2 }
118
+ # its(:count) { should eq(2) }
119
119
  # end
120
120
  def its(attribute, &block)
121
121
  describe(attribute) do
@@ -1,7 +1,7 @@
1
1
  module RSpec # :nodoc:
2
2
  module Core # :nodoc:
3
3
  module Version # :nodoc:
4
- STRING = '2.6.0'
4
+ STRING = '2.7.0.rc1'
5
5
  end
6
6
  end
7
7
  end
@@ -34,8 +34,8 @@ module RSpec
34
34
  @filtered_examples = Hash.new { |hash,group|
35
35
  hash[group] = begin
36
36
  examples = group.examples.dup
37
- examples = apply_exclusion_filters(examples, exclusion_filter) if exclusion_filter
38
- examples = apply_inclusion_filters(examples, inclusion_filter) if inclusion_filter
37
+ examples = apply_exclusion_filters(examples, exclusion_filter)
38
+ examples = apply_inclusion_filters(examples, inclusion_filter)
39
39
  examples.uniq
40
40
  end
41
41
  }
@@ -70,14 +70,14 @@ module RSpec
70
70
  example_groups.collect {|g| g.descendants}.flatten.inject(0) { |sum, g| sum += g.filtered_examples.size }
71
71
  end
72
72
 
73
- def apply_inclusion_filters(examples, conditions={})
74
- examples.select(&apply?(:any?, conditions))
73
+ def apply_inclusion_filters(examples, filters)
74
+ filters.empty? ? examples : examples.select {|e| e.metadata.any_apply?(filters)}
75
75
  end
76
76
 
77
77
  alias_method :find, :apply_inclusion_filters
78
78
 
79
- def apply_exclusion_filters(examples, conditions={})
80
- examples.reject(&apply?(:any?, conditions))
79
+ def apply_exclusion_filters(examples, filters)
80
+ filters.empty? ? examples : examples.reject {|e| e.metadata.any_apply?(filters)}
81
81
  end
82
82
 
83
83
  def preceding_declaration_line(filter_line)
@@ -106,13 +106,13 @@ module RSpec
106
106
  example_groups.clear
107
107
  if filter_announcements.empty?
108
108
  reporter.message("No examples found.")
109
- elsif inclusion_filter
109
+ elsif !inclusion_filter.empty?
110
110
  message = "No examples matched #{inclusion_filter.description}."
111
111
  if @configuration.run_all_when_everything_filtered?
112
112
  message << " Running all."
113
113
  end
114
114
  reporter.message(message)
115
- elsif exclusion_filter
115
+ elsif !exclusion_filter.empty?
116
116
  reporter.message(
117
117
  "No examples were matched. Perhaps #{exclusion_filter.description} is excluding everything?")
118
118
  end
@@ -122,7 +122,7 @@ module RSpec
122
122
  end
123
123
 
124
124
  def announce_inclusion_filter(announcements)
125
- if inclusion_filter
125
+ unless inclusion_filter.empty?
126
126
  announcements << "including #{inclusion_filter.description}"
127
127
  end
128
128
  end
@@ -139,10 +139,6 @@ module RSpec
139
139
 
140
140
  private
141
141
 
142
- def apply?(predicate, conditions)
143
- lambda {|example| example.metadata.apply?(predicate, conditions)}
144
- end
145
-
146
142
  def declaration_line_numbers
147
143
  @line_numbers ||= example_groups.inject([]) do |lines, g|
148
144
  lines + g.declaration_line_numbers
data/lib/rspec/core.rb CHANGED
@@ -1,3 +1,5 @@
1
+ $rspec_start_time ||= Time.now
2
+ require 'rspec/core/dsl'
1
3
  require 'rspec/core/extensions'
2
4
  require 'rspec/core/load_path'
3
5
  require 'rspec/core/deprecation'
@@ -37,14 +39,17 @@ module RSpec
37
39
  end
38
40
  end
39
41
 
42
+ # Used internally to determine what to do when a SIGINT is received
40
43
  def self.wants_to_quit
41
44
  world.wants_to_quit
42
45
  end
43
46
 
47
+ # Used internally to determine what to do when a SIGINT is received
44
48
  def self.wants_to_quit=(maybe)
45
49
  world.wants_to_quit=(maybe)
46
50
  end
47
51
 
52
+ # Internal container for global non-configuration data
48
53
  def self.world
49
54
  @world ||= RSpec::Core::World.new
50
55
  end
@@ -56,38 +61,26 @@ module RSpec
56
61
  configuration.reset
57
62
  end
58
63
 
64
+ # Returns the global configuration object
59
65
  def self.configuration
60
66
  @configuration ||= RSpec::Core::Configuration.new
61
67
  end
62
68
 
69
+ # Yields the global configuration object
70
+ #
71
+ # == Examples
72
+ #
73
+ # RSpec.configure do |config|
74
+ # config.format = 'documentation'
75
+ # end
63
76
  def self.configure
64
- warn_about_deprecated_configure if RSpec.world.example_groups.any?
65
77
  yield configuration if block_given?
66
78
  end
67
79
 
80
+ # Used internally to clear remaining groups when fail_fast is set
68
81
  def self.clear_remaining_example_groups
69
82
  world.example_groups.clear
70
83
  end
71
-
72
- private
73
-
74
- def self.warn_about_deprecated_configure
75
- warn <<-NOTICE
76
-
77
- *****************************************************************
78
- DEPRECATION WARNING: you are using deprecated behaviour that will
79
- be removed from RSpec 3.
80
-
81
- You have set some configuration options after an example group has
82
- already been defined. In RSpec 3, this will not be allowed. All
83
- configuration should happen before the first example group is
84
- defined. The configuration is happening at:
85
-
86
- #{caller[1]}
87
- *****************************************************************
88
-
89
- NOTICE
90
- end
91
84
  end
92
85
 
93
86
  require 'rspec/core/backward_compatibility'
@@ -1,7 +1,7 @@
1
1
  require "spec_helper"
2
2
 
3
3
  describe "autotest/discover.rb" do
4
- context "with /.rspec present" do
4
+ context "with ./.rspec present" do
5
5
  it "adds 'rspec2' to the list of discoveries" do
6
6
  File.stub(:exist?).with("./.rspec") { true }
7
7
  Autotest.should_receive(:add_discovery)
@@ -9,7 +9,7 @@ describe "autotest/discover.rb" do
9
9
  end
10
10
  end
11
11
 
12
- context "with /.rspec absent" do
12
+ context "with ./.rspec absent" do
13
13
  it "does not add 'rspec2' to the list of discoveries" do
14
14
  File.stub(:exist?) { false }
15
15
  Autotest.should_not_receive(:add_discovery)
@@ -1,37 +1,45 @@
1
1
  require "spec_helper"
2
2
 
3
3
  describe "failed_results_re for autotest" do
4
- let(:output) { StringIO.new }
5
- let(:formatter) { RSpec::Core::Formatters::BaseTextFormatter.new(output) }
6
- let(:example_output) do
7
- group = RSpec::Core::ExampleGroup.describe("group name")
8
- group.example("example name") { "this".should eq("that") }
9
- group.run(formatter)
10
- formatter.dump_failures
11
- output.string
4
+ def run_example
5
+ group = RSpec::Core::ExampleGroup.describe("group")
6
+ example = group.example("example") { yield }
7
+ io = StringIO.new
8
+ formatter = RSpec::Core::Formatters::BaseTextFormatter.new(io)
9
+ reporter = RSpec::Core::Reporter.new(formatter)
10
+
11
+ group.run(reporter)
12
+ reporter.report(1) {}
13
+ io.string
12
14
  end
13
15
 
14
- context "output does not have color enabled" do
15
- before do
16
- RSpec.configuration.stub(:color_enabled?) { false }
16
+ shared_examples "autotest failed_results_re" do
17
+ it "matches a failure" do
18
+ output = run_example { fail }
19
+ output.should match(Autotest::Rspec2.new.failed_results_re)
20
+ output.should include(__FILE__.sub(File.expand_path('.'),'.'))
17
21
  end
18
22
 
19
- it "matches a failure" do
20
- re = Autotest::Rspec2.new.failed_results_re
21
- example_output.should =~ re
22
- example_output.should include(__FILE__.sub(File.expand_path('.'),'.'))
23
+ it "does not match when there are no failures" do
24
+ output = run_example { } # pass
25
+ output.should_not match(Autotest::Rspec2.new.failed_results_re)
26
+ output.should_not include(__FILE__.sub(File.expand_path('.'),'.'))
23
27
  end
24
28
  end
25
29
 
26
- context "output has color enabled" do
30
+ context "with color enabled" do
27
31
  before do
28
- RSpec.configuration.stub(:color_enabled?) { true }
32
+ RSpec.configuration.stub(:color_enabled? => true)
29
33
  end
30
34
 
31
- it "matches a failure" do
32
- re = Autotest::Rspec2.new.failed_results_re
33
- example_output.should =~ re
34
- example_output.should include(__FILE__.sub(File.expand_path('.'),'.'))
35
+ include_examples "autotest failed_results_re"
36
+ end
37
+
38
+ context "with color disabled " do
39
+ before do
40
+ RSpec.configuration.stub(:color_enabled? => false)
35
41
  end
42
+
43
+ include_examples "autotest failed_results_re"
36
44
  end
37
45
  end
@@ -86,14 +86,14 @@ describe Autotest::Rspec2 do
86
86
  let(:spec_file) { "spec/autotest/some_spec.rb" }
87
87
 
88
88
  it "returns no failures if no failures were given in the output" do
89
- rspec_autotest.consolidate_failures([[]]).should == {}
89
+ rspec_autotest.consolidate_failures([[]]).should eq({})
90
90
  end
91
91
 
92
92
  it "returns a hash with the spec filename => spec name for each failure or error" do
93
93
  failures = [ [ "false should be false", spec_file ] ]
94
- rspec_autotest.consolidate_failures(failures).should == {
94
+ rspec_autotest.consolidate_failures(failures).should eq({
95
95
  spec_file => ["false should be false"]
96
- }
96
+ })
97
97
  end
98
98
 
99
99
  context "when subject file appears before the spec file in the backtrace" do
@@ -11,12 +11,6 @@ module RSpec::Core
11
11
  let(:out) { StringIO.new }
12
12
  let(:err) { StringIO.new }
13
13
 
14
- def config_options(argv=[])
15
- options = RSpec::Core::ConfigurationOptions.new(argv)
16
- options.parse_options
17
- options
18
- end
19
-
20
14
  def command_line(args)
21
15
  RSpec::Core::CommandLine.new(config_options(args))
22
16
  end
@@ -156,6 +150,7 @@ module RSpec::Core
156
150
 
157
151
  before do
158
152
  config.stub(:run_hook)
153
+ config.stub(:files_to_run) { [] }
159
154
  end
160
155
 
161
156
  it "doesn't override output_stream" do