rspec-core 2.0.0.beta.7 → 2.0.0.beta.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -7,25 +7,25 @@ module Rspec::Core
7
7
  describe "implicit subject" do
8
8
  describe "with a class" do
9
9
  it "returns an instance of the class" do
10
- ExampleGroup.create(Array).subject.call.should == []
10
+ ExampleGroup.describe(Array).subject.call.should == []
11
11
  end
12
12
  end
13
13
 
14
14
  describe "with a Module" do
15
15
  it "returns the Module" do
16
- ExampleGroup.create(Enumerable).subject.call.should == Enumerable
16
+ ExampleGroup.describe(Enumerable).subject.call.should == Enumerable
17
17
  end
18
18
  end
19
19
 
20
20
  describe "with a string" do
21
21
  it "return the string" do
22
- ExampleGroup.create("Foo").subject.call.should == 'Foo'
22
+ ExampleGroup.describe("Foo").subject.call.should == 'Foo'
23
23
  end
24
24
  end
25
25
 
26
26
  describe "with a number" do
27
27
  it "returns the number" do
28
- ExampleGroup.create(15).subject.call.should == 15
28
+ ExampleGroup.describe(15).subject.call.should == 15
29
29
  end
30
30
  end
31
31
 
@@ -34,7 +34,7 @@ module Rspec::Core
34
34
  describe "explicit subject" do
35
35
  describe "defined in a top level group" do
36
36
  it "replaces the implicit subject in that group" do
37
- group = ExampleGroup.create(Array)
37
+ group = ExampleGroup.describe(Array)
38
38
  group.subject { [1,2,3] }
39
39
  group.subject.call.should == [1,2,3]
40
40
  end
@@ -42,7 +42,7 @@ module Rspec::Core
42
42
 
43
43
  describe "defined in a top level group" do
44
44
  let(:group) do
45
- ExampleGroup.create do
45
+ ExampleGroup.describe do
46
46
  subject{ [4,5,6] }
47
47
  end
48
48
  end
@@ -87,14 +87,14 @@ module Rspec::Core
87
87
  it "should find nothing if all describes match the exclusion filter" do
88
88
  options = { :network_access => true }
89
89
 
90
- group1 = ExampleGroup.create(Bar, "find group-1", options) do
90
+ group1 = ExampleGroup.describe(Bar, "find group-1", options) do
91
91
  it("foo") {}
92
92
  it("bar") {}
93
93
  end
94
94
 
95
95
  @world.apply_exclusion_filters(group1.examples, :network_access => true).should == []
96
96
 
97
- group2 = ExampleGroup.create(Bar, "find group-1") do
97
+ group2 = ExampleGroup.describe(Bar, "find group-1") do
98
98
  it("foo", :network_access => true) {}
99
99
  it("bar") {}
100
100
  end
@@ -104,7 +104,7 @@ module Rspec::Core
104
104
  end
105
105
 
106
106
  it "should find nothing if a regexp matches the exclusion filter" do
107
- group = ExampleGroup.create(Bar, "find group-1", :name => "exclude me with a regex", :another => "foo") do
107
+ group = ExampleGroup.describe(Bar, "find group-1", :name => "exclude me with a regex", :another => "foo") do
108
108
  it("foo") {}
109
109
  it("bar") {}
110
110
  end
@@ -123,7 +123,7 @@ module Rspec::Core
123
123
  describe "filtering example groups" do
124
124
 
125
125
  it "should run matches" do
126
- @group1 = ExampleGroup.create(Bar, "find these examples") do
126
+ @group1 = ExampleGroup.describe(Bar, "find these examples") do
127
127
  it('I have no options', :color => :red, :awesome => true) {}
128
128
  it("I also have no options", :color => :red, :awesome => true) {}
129
129
  it("not so awesome", :color => :red, :awesome => false) {}
@@ -9,7 +9,7 @@ require 'rspec/mocks'
9
9
  begin
10
10
  require 'autotest'
11
11
  rescue LoadError
12
- raise "You must install autotest to use it"
12
+ raise "Could not load autotest."
13
13
  end
14
14
 
15
15
  require 'autotest/rspec2'
@@ -30,12 +30,12 @@ module Rspec
30
30
  end
31
31
  end
32
32
 
33
- def use_formatter(new_formatter)
34
- original_formatter = Rspec.configuration.formatter
35
- Rspec.configuration.instance_variable_set(:@formatter, new_formatter)
36
- yield
37
- ensure
38
- Rspec.configuration.instance_variable_set(:@formatter, original_formatter)
33
+ class Rspec::Core::ExampleGroup
34
+ def self.run_all(reporter=nil)
35
+ reporter ||= Rspec::Mocks::Mock.new('reporter').as_null_object
36
+ examples_to_run.replace(examples)
37
+ run(reporter)
38
+ end
39
39
  end
40
40
 
41
41
  def in_editor?
@@ -47,4 +47,11 @@ Rspec.configure do |c|
47
47
  c.exclusion_filter = { :ruby => lambda {|version|
48
48
  !(RUBY_VERSION.to_s =~ /^#{version.to_s}/)
49
49
  }}
50
+ c.before do
51
+ @real_world = Rspec::Core.world
52
+ Rspec::Core.instance_variable_set(:@world, Rspec::Core::World.new)
53
+ end
54
+ c.after do
55
+ Rspec::Core.instance_variable_set(:@world, @real_world)
56
+ end
50
57
  end
metadata CHANGED
@@ -7,8 +7,8 @@ version: !ruby/object:Gem::Version
7
7
  - 0
8
8
  - 0
9
9
  - beta
10
- - 7
11
- version: 2.0.0.beta.7
10
+ - 8
11
+ version: 2.0.0.beta.8
12
12
  platform: ruby
13
13
  authors:
14
14
  - Chad Humphries
@@ -17,7 +17,7 @@ autorequire:
17
17
  bindir: bin
18
18
  cert_chain: []
19
19
 
20
- date: 2010-04-17 00:00:00 -05:00
20
+ date: 2010-04-27 00:00:00 -05:00
21
21
  default_executable:
22
22
  dependencies:
23
23
  - !ruby/object:Gem::Dependency
@@ -32,8 +32,8 @@ dependencies:
32
32
  - 0
33
33
  - 0
34
34
  - beta
35
- - 7
36
- version: 2.0.0.beta.7
35
+ - 8
36
+ version: 2.0.0.beta.8
37
37
  type: :development
38
38
  version_requirements: *id001
39
39
  - !ruby/object:Gem::Dependency
@@ -48,8 +48,8 @@ dependencies:
48
48
  - 0
49
49
  - 0
50
50
  - beta
51
- - 7
52
- version: 2.0.0.beta.7
51
+ - 8
52
+ version: 2.0.0.beta.8
53
53
  type: :development
54
54
  version_requirements: *id002
55
55
  - !ruby/object:Gem::Dependency
@@ -178,6 +178,7 @@ files:
178
178
  - lib/rspec/core/configuration.rb
179
179
  - lib/rspec/core/configuration_options.rb
180
180
  - lib/rspec/core/deprecation.rb
181
+ - lib/rspec/core/errors.rb
181
182
  - lib/rspec/core/example.rb
182
183
  - lib/rspec/core/example_group.rb
183
184
  - lib/rspec/core/formatters.rb
@@ -196,6 +197,7 @@ files:
196
197
  - lib/rspec/core/mocking/with_mocha.rb
197
198
  - lib/rspec/core/mocking/with_rr.rb
198
199
  - lib/rspec/core/mocking/with_rspec.rb
200
+ - lib/rspec/core/pending.rb
199
201
  - lib/rspec/core/rake_task.rb
200
202
  - lib/rspec/core/ruby_project.rb
201
203
  - lib/rspec/core/runner.rb
@@ -217,8 +219,8 @@ files:
217
219
  - spec/rspec/core/formatters/helpers_spec.rb
218
220
  - spec/rspec/core/formatters/progress_formatter_spec.rb
219
221
  - spec/rspec/core/kernel_extensions_spec.rb
222
+ - spec/rspec/core/let_spec.rb
220
223
  - spec/rspec/core/metadata_spec.rb
221
- - spec/rspec/core/mocha_spec.rb
222
224
  - spec/rspec/core/pending_example_spec.rb
223
225
  - spec/rspec/core/resources/a_bar.rb
224
226
  - spec/rspec/core/resources/a_foo.rb
@@ -242,7 +244,7 @@ licenses: []
242
244
  post_install_message: |
243
245
  **************************************************
244
246
 
245
- Thank you for installing rspec-core-2.0.0.beta.7
247
+ Thank you for installing rspec-core-2.0.0.beta.8
246
248
 
247
249
  This is beta software. If you are looking
248
250
  for a supported production release, please
@@ -276,7 +278,7 @@ rubyforge_project: rspec
276
278
  rubygems_version: 1.3.6
277
279
  signing_key:
278
280
  specification_version: 3
279
- summary: rspec-core-2.0.0.beta.7
281
+ summary: rspec-core-2.0.0.beta.8
280
282
  test_files:
281
283
  - spec/autotest/failed_results_re_spec.rb
282
284
  - spec/autotest/rspec_spec.rb
@@ -290,8 +292,8 @@ test_files:
290
292
  - spec/rspec/core/formatters/helpers_spec.rb
291
293
  - spec/rspec/core/formatters/progress_formatter_spec.rb
292
294
  - spec/rspec/core/kernel_extensions_spec.rb
295
+ - spec/rspec/core/let_spec.rb
293
296
  - spec/rspec/core/metadata_spec.rb
294
- - spec/rspec/core/mocha_spec.rb
295
297
  - spec/rspec/core/pending_example_spec.rb
296
298
  - spec/rspec/core/resources/a_bar.rb
297
299
  - spec/rspec/core/resources/a_foo.rb
@@ -1,27 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe "Mocha Regression involving double reporting of errors" do
4
-
5
- it "should not double report mocha errors" do
6
- # The below example should have one error, not two
7
- # I'm also not sure how to test this regression without having the failure counting by
8
- # the running Rspec::Core instance
9
- formatter = Rspec::Core::Formatters::BaseFormatter.new
10
-
11
- use_formatter(formatter) do
12
-
13
- group = Rspec::Core::ExampleGroup.create("my favorite pony") do
14
- example("showing a double fail") do
15
- foo = "string"
16
- foo.expects(:something)
17
- end
18
- end
19
- group.examples_to_run.replace(group.examples)
20
- group.run(formatter)
21
-
22
- end
23
-
24
- formatter.examples.size.should == 1
25
- end
26
-
27
- end