Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Correctly pass/fail pending block with message expectations

- Closes #257
  • Loading branch information...
commit 644e372968cd2f6aa641eb3584e87fb091a4e3c9 1 parent 851d199
@dchelimsky dchelimsky authored
View
94 features/mock_framework_integration/use_flexmock.feature
@@ -1,28 +1,96 @@
Feature: mock with flexmock
- As an RSpec user who likes to mock
- I want to be able to use flexmock
+ Configure RSpec to use flexmock as shown in the scenarios below.
- Scenario: Mock with flexmock
- Given a file named "flexmock_example_spec.rb" with:
+ Scenario: passing message expectation
+ Given a file named "example_spec.rb" with:
"""
RSpec.configure do |config|
config.mock_framework = :flexmock
end
- describe "plugging in flexmock" do
- it "allows flexmock to be used" do
- target = Object.new
- flexmock(target).should_receive(:foo).once
- target.foo
+ describe "mocking with RSpec" do
+ it "passes when it should" do
+ receiver = flexmock('receiver')
+ receiver.should_receive(:message).once
+ receiver.message
end
+ end
+ """
+ When I run `rspec example_spec.rb`
+ Then the examples should all pass
+
+ Scenario: failing message expecation
+ Given a file named "example_spec.rb" with:
+ """
+ RSpec.configure do |config|
+ config.mock_framework = :flexmock
+ end
+
+ describe "mocking with RSpec" do
+ it "fails when it should" do
+ receiver = flexmock('receiver')
+ receiver.should_receive(:message).once
+ end
+ end
+ """
+ When I run `rspec example_spec.rb`
+ Then the output should contain "1 example, 1 failure"
+
+ Scenario: failing message expectation in pending block (remains pending)
+ Given a file named "example_spec.rb" with:
+ """
+ RSpec.configure do |config|
+ config.mock_framework = :flexmock
+ end
+
+ describe "failed message expectation in a pending block" do
+ it "is listed as pending" do
+ pending do
+ receiver = flexmock('receiver')
+ receiver.should_receive(:message).once
+ end
+ end
+ end
+ """
+ When I run `rspec example_spec.rb`
+ Then the output should contain "1 example, 0 failures, 1 pending"
+ And the exit status should be 0
+
+ Scenario: passing message expectation in pending block (fails)
+ Given a file named "example_spec.rb" with:
+ """
+ RSpec.configure do |config|
+ config.mock_framework = :flexmock
+ end
- describe "RSpec.configuration.mock_framework.framework_name" do
- it "returns :flexmock" do
- RSpec.configuration.mock_framework.framework_name.should eq(:flexmock)
+ describe "passing message expectation in a pending block" do
+ it "fails with FIXED" do
+ pending do
+ receiver = flexmock('receiver')
+ receiver.should_receive(:message).once
+ receiver.message
end
end
end
"""
- When I run `rspec ./flexmock_example_spec.rb`
+ When I run `rspec example_spec.rb`
+ Then the output should contain "FIXED"
+ Then the output should contain "1 example, 1 failure"
+ And the exit status should be 1
+
+ Scenario: accessing RSpec.configuration.mock_framework.framework_name
+ Given a file named "example_spec.rb" with:
+ """
+ RSpec.configure do |config|
+ config.mock_framework = :flexmock
+ end
+
+ describe "RSpec.configuration.mock_framework.framework_name" do
+ it "returns :flexmock" do
+ RSpec.configuration.mock_framework.framework_name.should eq(:flexmock)
+ end
+ end
+ """
+ When I run `rspec example_spec.rb`
Then the examples should all pass
View
95 features/mock_framework_integration/use_mocha.feature
@@ -1,28 +1,97 @@
Feature: mock with mocha
- As an RSpec user who likes to mock
- I want to be able to use mocha
+ Configure RSpec to use mocha as shown in the scenarios below.
- Scenario: Mock with mocha
- Given a file named "mocha_example_spec.rb" with:
+ Scenario: passing message expectation
+ Given a file named "example_spec.rb" with:
"""
RSpec.configure do |config|
config.mock_framework = :mocha
end
- describe "plugging in mocha" do
- it "allows mocha to be used" do
- target = Object.new
- target.expects(:foo).once
- target.foo
+ describe "mocking with RSpec" do
+ it "passes when it should" do
+ receiver = mock('receiver')
+ receiver.expects(:message).once
+ receiver.message
end
+ end
+ """
+ When I run `rspec example_spec.rb`
+ Then the examples should all pass
+
+ Scenario: failing message expecation
+ Given a file named "example_spec.rb" with:
+ """
+ RSpec.configure do |config|
+ config.mock_framework = :mocha
+ end
- describe "RSpec.configuration.mock_framework.framework_name" do
- it "returns :mocha" do
- RSpec.configuration.mock_framework.framework_name.should eq(:mocha)
+ describe "mocking with RSpec" do
+ it "fails when it should" do
+ receiver = mock('receiver')
+ receiver.expects(:message).once
+ end
+ end
+ """
+ When I run `rspec example_spec.rb`
+ Then the output should contain "1 example, 1 failure"
+
+ Scenario: failing message expectation in pending block (remains pending)
+ Given a file named "example_spec.rb" with:
+ """
+ RSpec.configure do |config|
+ config.mock_framework = :mocha
+ end
+
+ describe "failed message expectation in a pending block" do
+ it "is listed as pending" do
+ pending do
+ receiver = mock('receiver')
+ receiver.expects(:message).once
end
end
end
"""
- When I run `rspec ./mocha_example_spec.rb`
+ When I run `rspec example_spec.rb`
+ Then the output should contain "1 example, 0 failures, 1 pending"
+ And the exit status should be 0
+
+ Scenario: passing message expectation in pending block (fails)
+ Given a file named "example_spec.rb" with:
+ """
+ RSpec.configure do |config|
+ config.mock_framework = :mocha
+ end
+
+ describe "passing message expectation in a pending block" do
+ it "fails with FIXED" do
+ pending do
+ receiver = mock('receiver')
+ receiver.expects(:message).once
+ receiver.message
+ end
+ end
+ end
+ """
+ When I run `rspec example_spec.rb`
+ Then the output should contain "FIXED"
+ Then the output should contain "1 example, 1 failure"
+ And the exit status should be 1
+
+ Scenario: accessing RSpec.configuration.mock_framework.framework_name
+ Given a file named "example_spec.rb" with:
+ """
+ RSpec.configure do |config|
+ config.mock_framework = :mocha
+ end
+
+ describe "RSpec.configuration.mock_framework.framework_name" do
+ it "returns :mocha" do
+ RSpec.configuration.mock_framework.framework_name.should eq(:mocha)
+ end
+ end
+ """
+ When I run `rspec example_spec.rb`
Then the examples should all pass
+
View
97 features/mock_framework_integration/use_rr.feature
@@ -1,29 +1,98 @@
-@no-jruby
Feature: mock with rr
- As an RSpec user who likes to mock
- I want to be able to use rr
+ Configure RSpec to use rr as shown in the scenarios below.
- Scenario: Mock with rr
- Given a file named "rr_example_spec.rb" with:
+ Scenario: passing message expectation
+ Given a file named "example_spec.rb" with:
"""
RSpec.configure do |config|
config.mock_framework = :rr
end
- describe "plugging in rr" do
- it "allows rr to be used" do
- target = Object.new
- mock(target).foo
- target.foo
+ describe "mocking with RSpec" do
+ it "passes when it should" do
+ receiver = Object.new
+ mock(receiver).message
+ receiver.message
end
+ end
+ """
+ When I run `rspec example_spec.rb`
+ Then the examples should all pass
+
+ Scenario: failing message expecation
+ Given a file named "example_spec.rb" with:
+ """
+ RSpec.configure do |config|
+ config.mock_framework = :rr
+ end
+
+ describe "mocking with RSpec" do
+ it "fails when it should" do
+ receiver = Object.new
+ mock(receiver).message
+ end
+ end
+ """
+ When I run `rspec example_spec.rb`
+ Then the output should contain "1 example, 1 failure"
+
+ Scenario: failing message expectation in pending block (remains pending)
+ Given a file named "example_spec.rb" with:
+ """
+ RSpec.configure do |config|
+ config.mock_framework = :rr
+ end
+
+ describe "failed message expectation in a pending block" do
+ it "is listed as pending" do
+ pending do
+ receiver = Object.new
+ mock(receiver).message
+ end
+ end
+ end
+ """
+ When I run `rspec example_spec.rb`
+ Then the output should contain "1 example, 0 failures, 1 pending"
+ And the exit status should be 0
+
+ Scenario: passing message expectation in pending block (fails)
+ Given a file named "example_spec.rb" with:
+ """
+ RSpec.configure do |config|
+ config.mock_framework = :rr
+ end
- describe "RSpec.configuration.mock_framework.framework_name" do
- it "returns :rr" do
- RSpec.configuration.mock_framework.framework_name.should eq(:rr)
+ describe "passing message expectation in a pending block" do
+ it "fails with FIXED" do
+ pending do
+ receiver = Object.new
+ mock(receiver).message
+ receiver.message
end
end
end
"""
- When I run `rspec rr_example_spec.rb`
+ When I run `rspec example_spec.rb`
+ Then the output should contain "FIXED"
+ Then the output should contain "1 example, 1 failure"
+ And the exit status should be 1
+
+ Scenario: accessing RSpec.configuration.mock_framework.framework_name
+ Given a file named "example_spec.rb" with:
+ """
+ RSpec.configure do |config|
+ config.mock_framework = :rr
+ end
+
+ describe "RSpec.configuration.mock_framework.framework_name" do
+ it "returns :rr" do
+ RSpec.configuration.mock_framework.framework_name.should eq(:rr)
+ end
+ end
+ """
+ When I run `rspec example_spec.rb`
Then the examples should all pass
+
+
View
95 features/mock_framework_integration/use_rspec.feature
@@ -1,28 +1,97 @@
Feature: mock with rspec
- As an RSpec user who likes to mock
- I want to be able to use rspec
+ RSpec uses its own mocking framework by default, or you can configure it
+ explicitly.
- Scenario: Mock with rspec
- Given a file named "rspec_example_spec.rb" with:
+ Scenario: passing message expectation
+ Given a file named "example_spec.rb" with:
"""
RSpec.configure do |config|
config.mock_framework = :rspec
end
- describe "plugging in rspec" do
- it "allows rspec to be used" do
- target = mock('target')
- target.should_receive(:foo)
- target.foo
+ describe "mocking with RSpec" do
+ it "passes when it should" do
+ receiver = double('receiver')
+ receiver.should_receive(:message)
+ receiver.message
end
+ end
+ """
+ When I run `rspec example_spec.rb`
+ Then the examples should all pass
+
+ Scenario: failing message expecation
+ Given a file named "example_spec.rb" with:
+ """
+ RSpec.configure do |config|
+ config.mock_framework = :rspec
+ end
+
+ describe "mocking with RSpec" do
+ it "fails when it should" do
+ receiver = double('receiver')
+ receiver.should_receive(:message)
+ end
+ end
+ """
+ When I run `rspec example_spec.rb`
+ Then the output should contain "1 example, 1 failure"
+
+ Scenario: failing message expectation in pending block (remains pending)
+ Given a file named "example_spec.rb" with:
+ """
+ RSpec.configure do |config|
+ config.mock_framework = :rspec
+ end
+
+ describe "failed message expectation in a pending block" do
+ it "is listed as pending" do
+ pending do
+ receiver = double('receiver')
+ receiver.should_receive(:message)
+ end
+ end
+ end
+ """
+ When I run `rspec example_spec.rb`
+ Then the output should contain "1 example, 0 failures, 1 pending"
+ And the exit status should be 0
+
+ Scenario: passing message expectation in pending block (fails)
+ Given a file named "example_spec.rb" with:
+ """
+ RSpec.configure do |config|
+ config.mock_framework = :rspec
+ end
- describe "RSpec.configuration.mock_framework.framework_name" do
- it "returns :rspec" do
- RSpec.configuration.mock_framework.framework_name.should eq(:rspec)
+ describe "passing message expectation in a pending block" do
+ it "fails with FIXED" do
+ pending do
+ receiver = double('receiver')
+ receiver.should_receive(:message)
+ receiver.message
end
end
end
"""
- When I run `rspec ./rspec_example_spec.rb`
+ When I run `rspec example_spec.rb`
+ Then the output should contain "FIXED"
+ Then the output should contain "1 example, 1 failure"
+ And the exit status should be 1
+
+ Scenario: accessing RSpec.configuration.mock_framework.framework_name
+ Given a file named "example_spec.rb" with:
+ """
+ RSpec.configure do |config|
+ config.mock_framework = :rspec
+ end
+
+ describe "RSpec.configuration.mock_framework.framework_name" do
+ it "returns :rspec" do
+ RSpec.configuration.mock_framework.framework_name.should eq(:rspec)
+ end
+ end
+ """
+ When I run `rspec example_spec.rb`
Then the examples should all pass
View
7 lib/rspec/core/pending.rb
@@ -19,9 +19,14 @@ def pending(*args)
example.metadata[:execution_result][:pending_message] = message
if block_given?
begin
- result = yield
+ result = begin
+ yield
+ example.example_group_instance.instance_eval { verify_mocks_for_rspec }
+ end
example.metadata[:pending] = false
rescue Exception
+ ensure
+ teardown_mocks_for_rspec
end
raise RSpec::Core::PendingExampleFixedError.new if result
end
View
10 spec/rspec/core/formatters/html_formatted-1.8.6.html
@@ -319,11 +319,11 @@
./spec/rspec/core/formatters/html_formatter_spec.rb:46
./spec/rspec/core/formatters/html_formatter_spec.rb:45:in `chdir'
./spec/rspec/core/formatters/html_formatter_spec.rb:45</pre></div>
- <pre class="ruby"><code><span class="linenum">24</span> <span class="keyword">rescue</span> <span class="constant">Exception</span>
-<span class="linenum">25</span> <span class="keyword">end</span>
-<span class="offending"><span class="linenum">26</span> <span class="keyword">raise</span> <span class="constant">RSpec</span><span class="punct">::</span><span class="constant">Core</span><span class="punct">::</span><span class="constant">PendingExampleFixedError</span><span class="punct">.</span><span class="ident">new</span> <span class="keyword">if</span> <span class="ident">result</span></span>
-<span class="linenum">27</span> <span class="keyword">end</span>
-<span class="linenum">28</span> <span class="keyword">raise</span> <span class="constant">PendingDeclaredInExample</span><span class="punct">.</span><span class="ident">new</span><span class="punct">(</span><span class="ident">message</span><span class="punct">)</span></code></pre>
+ <pre class="ruby"><code><span class="linenum">29</span> <span class="ident">teardown_mocks_for_rspec</span>
+<span class="linenum">30</span> <span class="keyword">end</span>
+<span class="offending"><span class="linenum">31</span> <span class="keyword">raise</span> <span class="constant">RSpec</span><span class="punct">::</span><span class="constant">Core</span><span class="punct">::</span><span class="constant">PendingExampleFixedError</span><span class="punct">.</span><span class="ident">new</span> <span class="keyword">if</span> <span class="ident">result</span></span>
+<span class="linenum">32</span> <span class="keyword">end</span>
+<span class="linenum">33</span> <span class="keyword">raise</span> <span class="constant">PendingDeclaredInExample</span><span class="punct">.</span><span class="ident">new</span><span class="punct">(</span><span class="ident">message</span><span class="punct">)</span></code></pre>
</div>
</dd>
</dl>
View
10 spec/rspec/core/formatters/html_formatted-1.8.7.html
@@ -319,11 +319,11 @@
./spec/rspec/core/formatters/html_formatter_spec.rb:46
./spec/rspec/core/formatters/html_formatter_spec.rb:45:in `chdir'
./spec/rspec/core/formatters/html_formatter_spec.rb:45</pre></div>
- <pre class="ruby"><code><span class="linenum">24</span> <span class="keyword">rescue</span> <span class="constant">Exception</span>
-<span class="linenum">25</span> <span class="keyword">end</span>
-<span class="offending"><span class="linenum">26</span> <span class="keyword">raise</span> <span class="constant">RSpec</span><span class="punct">::</span><span class="constant">Core</span><span class="punct">::</span><span class="constant">PendingExampleFixedError</span><span class="punct">.</span><span class="ident">new</span> <span class="keyword">if</span> <span class="ident">result</span></span>
-<span class="linenum">27</span> <span class="keyword">end</span>
-<span class="linenum">28</span> <span class="keyword">raise</span> <span class="constant">PendingDeclaredInExample</span><span class="punct">.</span><span class="ident">new</span><span class="punct">(</span><span class="ident">message</span><span class="punct">)</span></code></pre>
+ <pre class="ruby"><code><span class="linenum">29</span> <span class="ident">teardown_mocks_for_rspec</span>
+<span class="linenum">30</span> <span class="keyword">end</span>
+<span class="offending"><span class="linenum">31</span> <span class="keyword">raise</span> <span class="constant">RSpec</span><span class="punct">::</span><span class="constant">Core</span><span class="punct">::</span><span class="constant">PendingExampleFixedError</span><span class="punct">.</span><span class="ident">new</span> <span class="keyword">if</span> <span class="ident">result</span></span>
+<span class="linenum">32</span> <span class="keyword">end</span>
+<span class="linenum">33</span> <span class="keyword">raise</span> <span class="constant">PendingDeclaredInExample</span><span class="punct">.</span><span class="ident">new</span><span class="punct">(</span><span class="ident">message</span><span class="punct">)</span></code></pre>
</div>
</dd>
</dl>
View
10 spec/rspec/core/formatters/html_formatted-1.9.1.html
@@ -319,11 +319,11 @@
./spec/rspec/core/formatters/html_formatter_spec.rb:46:in `block (4 levels) in <module:Formatters>'
./spec/rspec/core/formatters/html_formatter_spec.rb:45:in `chdir'
./spec/rspec/core/formatters/html_formatter_spec.rb:45:in `block (3 levels) in <module:Formatters>'</pre></div>
- <pre class="ruby"><code><span class="linenum">24</span> <span class="keyword">rescue</span> <span class="constant">Exception</span>
-<span class="linenum">25</span> <span class="keyword">end</span>
-<span class="offending"><span class="linenum">26</span> <span class="keyword">raise</span> <span class="constant">RSpec</span><span class="punct">::</span><span class="constant">Core</span><span class="punct">::</span><span class="constant">PendingExampleFixedError</span><span class="punct">.</span><span class="ident">new</span> <span class="keyword">if</span> <span class="ident">result</span></span>
-<span class="linenum">27</span> <span class="keyword">end</span>
-<span class="linenum">28</span> <span class="keyword">raise</span> <span class="constant">PendingDeclaredInExample</span><span class="punct">.</span><span class="ident">new</span><span class="punct">(</span><span class="ident">message</span><span class="punct">)</span></code></pre>
+ <pre class="ruby"><code><span class="linenum">29</span> <span class="ident">teardown_mocks_for_rspec</span>
+<span class="linenum">30</span> <span class="keyword">end</span>
+<span class="offending"><span class="linenum">31</span> <span class="keyword">raise</span> <span class="constant">RSpec</span><span class="punct">::</span><span class="constant">Core</span><span class="punct">::</span><span class="constant">PendingExampleFixedError</span><span class="punct">.</span><span class="ident">new</span> <span class="keyword">if</span> <span class="ident">result</span></span>
+<span class="linenum">32</span> <span class="keyword">end</span>
+<span class="linenum">33</span> <span class="keyword">raise</span> <span class="constant">PendingDeclaredInExample</span><span class="punct">.</span><span class="ident">new</span><span class="punct">(</span><span class="ident">message</span><span class="punct">)</span></code></pre>
</div>
</dd>
</dl>
View
10 spec/rspec/core/formatters/html_formatted-1.9.2.html
@@ -319,11 +319,11 @@
./spec/rspec/core/formatters/html_formatter_spec.rb:46:in `block (4 levels) in <module:Formatters>'
./spec/rspec/core/formatters/html_formatter_spec.rb:45:in `chdir'
./spec/rspec/core/formatters/html_formatter_spec.rb:45:in `block (3 levels) in <module:Formatters>'</pre></div>
- <pre class="ruby"><code><span class="linenum">24</span> <span class="keyword">rescue</span> <span class="constant">Exception</span>
-<span class="linenum">25</span> <span class="keyword">end</span>
-<span class="offending"><span class="linenum">26</span> <span class="keyword">raise</span> <span class="constant">RSpec</span><span class="punct">::</span><span class="constant">Core</span><span class="punct">::</span><span class="constant">PendingExampleFixedError</span><span class="punct">.</span><span class="ident">new</span> <span class="keyword">if</span> <span class="ident">result</span></span>
-<span class="linenum">27</span> <span class="keyword">end</span>
-<span class="linenum">28</span> <span class="keyword">raise</span> <span class="constant">PendingDeclaredInExample</span><span class="punct">.</span><span class="ident">new</span><span class="punct">(</span><span class="ident">message</span><span class="punct">)</span></code></pre>
+ <pre class="ruby"><code><span class="linenum">29</span> <span class="ident">teardown_mocks_for_rspec</span>
+<span class="linenum">30</span> <span class="keyword">end</span>
+<span class="offending"><span class="linenum">31</span> <span class="keyword">raise</span> <span class="constant">RSpec</span><span class="punct">::</span><span class="constant">Core</span><span class="punct">::</span><span class="constant">PendingExampleFixedError</span><span class="punct">.</span><span class="ident">new</span> <span class="keyword">if</span> <span class="ident">result</span></span>
+<span class="linenum">32</span> <span class="keyword">end</span>
+<span class="linenum">33</span> <span class="keyword">raise</span> <span class="constant">PendingDeclaredInExample</span><span class="punct">.</span><span class="ident">new</span><span class="punct">(</span><span class="ident">message</span><span class="punct">)</span></code></pre>
</div>
</dd>
</dl>
View
10 spec/rspec/core/formatters/text_mate_formatted-1.8.6.html
@@ -319,11 +319,11 @@
<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=47">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:47</a>
<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=46">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:46</a> :in `chdir'
<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=46">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:46</a> </pre></div>
- <pre class="ruby"><code><span class="linenum">24</span> <span class="keyword">rescue</span> <span class="constant">Exception</span>
-<span class="linenum">25</span> <span class="keyword">end</span>
-<span class="offending"><span class="linenum">26</span> <span class="keyword">raise</span> <span class="constant">RSpec</span><span class="punct">::</span><span class="constant">Core</span><span class="punct">::</span><span class="constant">PendingExampleFixedError</span><span class="punct">.</span><span class="ident">new</span> <span class="keyword">if</span> <span class="ident">result</span></span>
-<span class="linenum">27</span> <span class="keyword">end</span>
-<span class="linenum">28</span> <span class="keyword">raise</span> <span class="constant">PendingDeclaredInExample</span><span class="punct">.</span><span class="ident">new</span><span class="punct">(</span><span class="ident">message</span><span class="punct">)</span></code></pre>
+ <pre class="ruby"><code><span class="linenum">29</span> <span class="ident">teardown_mocks_for_rspec</span>
+<span class="linenum">30</span> <span class="keyword">end</span>
+<span class="offending"><span class="linenum">31</span> <span class="keyword">raise</span> <span class="constant">RSpec</span><span class="punct">::</span><span class="constant">Core</span><span class="punct">::</span><span class="constant">PendingExampleFixedError</span><span class="punct">.</span><span class="ident">new</span> <span class="keyword">if</span> <span class="ident">result</span></span>
+<span class="linenum">32</span> <span class="keyword">end</span>
+<span class="linenum">33</span> <span class="keyword">raise</span> <span class="constant">PendingDeclaredInExample</span><span class="punct">.</span><span class="ident">new</span><span class="punct">(</span><span class="ident">message</span><span class="punct">)</span></code></pre>
</div>
</dd>
</dl>
View
10 spec/rspec/core/formatters/text_mate_formatted-1.8.7.html
@@ -319,11 +319,11 @@
<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=47">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:47</a>
<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=46">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:46</a> :in `chdir'
<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=46">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:46</a> </pre></div>
- <pre class="ruby"><code><span class="linenum">24</span> <span class="keyword">rescue</span> <span class="constant">Exception</span>
-<span class="linenum">25</span> <span class="keyword">end</span>
-<span class="offending"><span class="linenum">26</span> <span class="keyword">raise</span> <span class="constant">RSpec</span><span class="punct">::</span><span class="constant">Core</span><span class="punct">::</span><span class="constant">PendingExampleFixedError</span><span class="punct">.</span><span class="ident">new</span> <span class="keyword">if</span> <span class="ident">result</span></span>
-<span class="linenum">27</span> <span class="keyword">end</span>
-<span class="linenum">28</span> <span class="keyword">raise</span> <span class="constant">PendingDeclaredInExample</span><span class="punct">.</span><span class="ident">new</span><span class="punct">(</span><span class="ident">message</span><span class="punct">)</span></code></pre>
+ <pre class="ruby"><code><span class="linenum">29</span> <span class="ident">teardown_mocks_for_rspec</span>
+<span class="linenum">30</span> <span class="keyword">end</span>
+<span class="offending"><span class="linenum">31</span> <span class="keyword">raise</span> <span class="constant">RSpec</span><span class="punct">::</span><span class="constant">Core</span><span class="punct">::</span><span class="constant">PendingExampleFixedError</span><span class="punct">.</span><span class="ident">new</span> <span class="keyword">if</span> <span class="ident">result</span></span>
+<span class="linenum">32</span> <span class="keyword">end</span>
+<span class="linenum">33</span> <span class="keyword">raise</span> <span class="constant">PendingDeclaredInExample</span><span class="punct">.</span><span class="ident">new</span><span class="punct">(</span><span class="ident">message</span><span class="punct">)</span></code></pre>
</div>
</dd>
</dl>
View
52 spec/rspec/core/formatters/text_mate_formatted-1.9.1.html
@@ -312,18 +312,18 @@
<span class="failed_spec_name">fails</span>
<div class="failure" id="failure_1">
<div class="message"><pre>RSpec::Core::PendingExampleFixedError</pre></div>
- <div class="backtrace"><pre><a href="txmt://open?url=file:///Users/myron/code/rspec-dev/repos/rspec-core/spec/rspec/core/resources/formatter_specs.rb&line=18">./spec/rspec/core/resources/formatter_specs.rb:18</a> :in `block (3 levels) in <top (required)>'
-<a href="txmt://open?url=file:///Users/myron/code/rspec-dev/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=24">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:24</a> :in `block (2 levels) in <module:Formatters>'
-<a href="txmt://open?url=file:///Users/myron/code/rspec-dev/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=47">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:47</a> :in `block (5 levels) in <module:Formatters>'
-<a href="txmt://open?url=file:///Users/myron/code/rspec-dev/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=47">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:47</a> :in `open'
-<a href="txmt://open?url=file:///Users/myron/code/rspec-dev/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=47">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:47</a> :in `block (4 levels) in <module:Formatters>'
-<a href="txmt://open?url=file:///Users/myron/code/rspec-dev/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=46">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:46</a> :in `chdir'
-<a href="txmt://open?url=file:///Users/myron/code/rspec-dev/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=46">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:46</a> :in `block (3 levels) in <module:Formatters>'</pre></div>
- <pre class="ruby"><code><span class="linenum">24</span> <span class="keyword">rescue</span> <span class="constant">Exception</span>
-<span class="linenum">25</span> <span class="keyword">end</span>
-<span class="offending"><span class="linenum">26</span> <span class="keyword">raise</span> <span class="constant">RSpec</span><span class="punct">::</span><span class="constant">Core</span><span class="punct">::</span><span class="constant">PendingExampleFixedError</span><span class="punct">.</span><span class="ident">new</span> <span class="keyword">if</span> <span class="ident">result</span></span>
-<span class="linenum">27</span> <span class="keyword">end</span>
-<span class="linenum">28</span> <span class="keyword">raise</span> <span class="constant">PendingDeclaredInExample</span><span class="punct">.</span><span class="ident">new</span><span class="punct">(</span><span class="ident">message</span><span class="punct">)</span></code></pre>
+ <div class="backtrace"><pre><a href="txmt://open?url=file:///Users/david/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/resources/formatter_specs.rb&line=18">./spec/rspec/core/resources/formatter_specs.rb:18</a> :in `block (3 levels) in <top (required)>'
+<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=24">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:24</a> :in `block (2 levels) in <module:Formatters>'
+<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=47">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:47</a> :in `block (5 levels) in <module:Formatters>'
+<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=47">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:47</a> :in `open'
+<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=47">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:47</a> :in `block (4 levels) in <module:Formatters>'
+<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=46">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:46</a> :in `chdir'
+<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=46">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:46</a> :in `block (3 levels) in <module:Formatters>'</pre></div>
+ <pre class="ruby"><code><span class="linenum">29</span> <span class="ident">teardown_mocks_for_rspec</span>
+<span class="linenum">30</span> <span class="keyword">end</span>
+<span class="offending"><span class="linenum">31</span> <span class="keyword">raise</span> <span class="constant">RSpec</span><span class="punct">::</span><span class="constant">Core</span><span class="punct">::</span><span class="constant">PendingExampleFixedError</span><span class="punct">.</span><span class="ident">new</span> <span class="keyword">if</span> <span class="ident">result</span></span>
+<span class="linenum">32</span> <span class="keyword">end</span>
+<span class="linenum">33</span> <span class="keyword">raise</span> <span class="constant">PendingDeclaredInExample</span><span class="punct">.</span><span class="ident">new</span><span class="punct">(</span><span class="ident">message</span><span class="punct">)</span></code></pre>
</div>
</dd>
</dl>
@@ -350,13 +350,13 @@
(compared using ==)
</pre></div>
- <div class="backtrace"><pre><a href="txmt://open?url=file:///Users/myron/code/rspec-dev/repos/rspec-core/spec/rspec/core/resources/formatter_specs.rb&line=33">./spec/rspec/core/resources/formatter_specs.rb:33</a> :in `block (2 levels) in <top (required)>'
-<a href="txmt://open?url=file:///Users/myron/code/rspec-dev/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=24">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:24</a> :in `block (2 levels) in <module:Formatters>'
-<a href="txmt://open?url=file:///Users/myron/code/rspec-dev/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=47">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:47</a> :in `block (5 levels) in <module:Formatters>'
-<a href="txmt://open?url=file:///Users/myron/code/rspec-dev/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=47">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:47</a> :in `open'
-<a href="txmt://open?url=file:///Users/myron/code/rspec-dev/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=47">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:47</a> :in `block (4 levels) in <module:Formatters>'
-<a href="txmt://open?url=file:///Users/myron/code/rspec-dev/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=46">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:46</a> :in `chdir'
-<a href="txmt://open?url=file:///Users/myron/code/rspec-dev/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=46">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:46</a> :in `block (3 levels) in <module:Formatters>'</pre></div>
+ <div class="backtrace"><pre><a href="txmt://open?url=file:///Users/david/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/resources/formatter_specs.rb&line=33">./spec/rspec/core/resources/formatter_specs.rb:33</a> :in `block (2 levels) in <top (required)>'
+<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=24">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:24</a> :in `block (2 levels) in <module:Formatters>'
+<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=47">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:47</a> :in `block (5 levels) in <module:Formatters>'
+<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=47">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:47</a> :in `open'
+<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=47">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:47</a> :in `block (4 levels) in <module:Formatters>'
+<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=46">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:46</a> :in `chdir'
+<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=46">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:46</a> :in `block (3 levels) in <module:Formatters>'</pre></div>
<pre class="ruby"><code><span class="linenum">27</span> <span class="keyword">end</span>
<span class="linenum">28</span>
<span class="offending"><span class="linenum">29</span> <span class="keyword">raise</span><span class="punct">(</span><span class="constant">RSpec</span><span class="punct">::</span><span class="constant">Expectations</span><span class="punct">::</span><span class="constant">ExpectationNotMetError</span><span class="punct">.</span><span class="ident">new</span><span class="punct">(</span><span class="ident">message</span><span class="punct">))</span></span>
@@ -376,13 +376,13 @@
<div class="failure" id="failure_3">
<div class="message"><pre>foo</pre></div>
<div class="backtrace"><pre>(erb):1:in `<main>'
-<a href="txmt://open?url=file:///Users/myron/code/rspec-dev/repos/rspec-core/spec/rspec/core/resources/formatter_specs.rb&line=41">./spec/rspec/core/resources/formatter_specs.rb:41</a> :in `block (2 levels) in <top (required)>'
-<a href="txmt://open?url=file:///Users/myron/code/rspec-dev/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=24">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:24</a> :in `block (2 levels) in <module:Formatters>'
-<a href="txmt://open?url=file:///Users/myron/code/rspec-dev/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=47">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:47</a> :in `block (5 levels) in <module:Formatters>'
-<a href="txmt://open?url=file:///Users/myron/code/rspec-dev/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=47">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:47</a> :in `open'
-<a href="txmt://open?url=file:///Users/myron/code/rspec-dev/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=47">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:47</a> :in `block (4 levels) in <module:Formatters>'
-<a href="txmt://open?url=file:///Users/myron/code/rspec-dev/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=46">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:46</a> :in `chdir'
-<a href="txmt://open?url=file:///Users/myron/code/rspec-dev/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=46">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:46</a> :in `block (3 levels) in <module:Formatters>'</pre></div>
+<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/resources/formatter_specs.rb&line=41">./spec/rspec/core/resources/formatter_specs.rb:41</a> :in `block (2 levels) in <top (required)>'
+<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=24">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:24</a> :in `block (2 levels) in <module:Formatters>'
+<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=47">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:47</a> :in `block (5 levels) in <module:Formatters>'
+<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=47">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:47</a> :in `open'
+<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=47">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:47</a> :in `block (4 levels) in <module:Formatters>'
+<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=46">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:46</a> :in `chdir'
+<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=46">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:46</a> :in `block (3 levels) in <module:Formatters>'</pre></div>
<pre class="ruby"><code><span class="linenum">-1</span><span class="comment"># Couldn't get snippet for (erb)</span></code></pre>
</div>
</dd>
View
10 spec/rspec/core/formatters/text_mate_formatted-1.9.2.html
@@ -319,11 +319,11 @@
<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=47">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:47</a> :in `block (4 levels) in <module:Formatters>'
<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=46">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:46</a> :in `chdir'
<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=46">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:46</a> :in `block (3 levels) in <module:Formatters>'</pre></div>
- <pre class="ruby"><code><span class="linenum">24</span> <span class="keyword">rescue</span> <span class="constant">Exception</span>
-<span class="linenum">25</span> <span class="keyword">end</span>
-<span class="offending"><span class="linenum">26</span> <span class="keyword">raise</span> <span class="constant">RSpec</span><span class="punct">::</span><span class="constant">Core</span><span class="punct">::</span><span class="constant">PendingExampleFixedError</span><span class="punct">.</span><span class="ident">new</span> <span class="keyword">if</span> <span class="ident">result</span></span>
-<span class="linenum">27</span> <span class="keyword">end</span>
-<span class="linenum">28</span> <span class="keyword">raise</span> <span class="constant">PendingDeclaredInExample</span><span class="punct">.</span><span class="ident">new</span><span class="punct">(</span><span class="ident">message</span><span class="punct">)</span></code></pre>
+ <pre class="ruby"><code><span class="linenum">29</span> <span class="ident">teardown_mocks_for_rspec</span>
+<span class="linenum">30</span> <span class="keyword">end</span>
+<span class="offending"><span class="linenum">31</span> <span class="keyword">raise</span> <span class="constant">RSpec</span><span class="punct">::</span><span class="constant">Core</span><span class="punct">::</span><span class="constant">PendingExampleFixedError</span><span class="punct">.</span><span class="ident">new</span> <span class="keyword">if</span> <span class="ident">result</span></span>
+<span class="linenum">32</span> <span class="keyword">end</span>
+<span class="linenum">33</span> <span class="keyword">raise</span> <span class="constant">PendingDeclaredInExample</span><span class="punct">.</span><span class="ident">new</span><span class="punct">(</span><span class="ident">message</span><span class="punct">)</span></code></pre>
</div>
</dd>
</dl>
View
14 spec/rspec/core/pending_example_spec.rb
@@ -72,10 +72,10 @@
end
context "with a block" do
- def run_example(*pending_args)
+ def run_example(*pending_args, &block)
group = RSpec::Core::ExampleGroup.describe('group') do
it "does something" do
- pending(*pending_args) { yield }
+ pending(*pending_args) { block.call if block }
end
end
example = group.examples.first
@@ -133,6 +133,16 @@ def run_example(*pending_args)
end
end
+ context "that fails due to a failed message expectation" do
+ def run_example(*pending_args)
+ super(*pending_args) { "foo".should_receive(:bar) }
+ end
+
+ it "passes" do
+ run_example("just because").should be_pending
+ end
+ end
+
context "that passes" do
def run_example(*pending_args)
super(*pending_args) { 3.should == 3 }
Please sign in to comment.
Something went wrong with that request. Please try again.