Skip to content
This repository
Browse code

clean up some specs

  • Loading branch information...
commit 589734377aea912598e39b88054503e922768d77 1 parent 1f28dcd
David Chelimsky authored January 30, 2012

Showing 1 changed file with 6 additions and 16 deletions. Show diff stats Hide diff stats

  1. 22  spec/rspec/mocks/mock_spec.rb
22  spec/rspec/mocks/mock_spec.rb
@@ -187,28 +187,18 @@ def @mock.method_with_default_argument(arg={}); end
187 187
 
188 188
       it "fails right away when method defined as never is received" do
189 189
         @mock.should_receive(:not_expected).never
190  
-        expect { @mock.not_expected }.to raise_error(
191  
-          RSpec::Mocks::MockExpectationError,
192  
-          %Q|(Double "test double").not_expected(no args)\n    expected: 0 times\n    received: 1 time|
193  
-        )
194  
-      end
195  
-
196  
-      it "eventually fails when method defined as never is received" do
197  
-        @mock.should_receive(:not_expected).never
198  
-        expect { @mock.not_expected }.to raise_error(
199  
-          RSpec::Mocks::MockExpectationError,
200  
-          %Q|(Double "test double").not_expected(no args)\n    expected: 0 times\n    received: 1 time|
  190
+        expect { @mock.not_expected }.
  191
+          to raise_error(RSpec::Mocks::MockExpectationError,
  192
+                         %Q|(Double "test double").not_expected(no args)\n    expected: 0 times\n    received: 1 time|
201 193
         )
202 194
       end
203 195
 
204 196
       it "raises when told to" do
205 197
         @mock.should_receive(:something).and_raise(RuntimeError)
206  
-        lambda do
207  
-          @mock.something
208  
-        end.should raise_error(RuntimeError)
  198
+        expect { @mock.something }.to raise_error(RuntimeError)
209 199
       end
210 200
 
211  
-      it "raises passed an Exception instance" do
  201
+      it "raises instance of submitted Exception" do
212 202
         error = RuntimeError.new("error message")
213 203
         @mock.should_receive(:something).and_raise(error)
214 204
         lambda {
@@ -228,7 +218,7 @@ def initialize(i_take_an_argument)
228 218
         }.should raise_error(ArgumentError, /^'and_raise' can only accept an Exception class if an instance/)
229 219
       end
230 220
 
231  
-      it "raises RuntimeError with passed message" do
  221
+      it "raises RuntimeError with submitted message" do
232 222
         @mock.should_receive(:something).and_raise("error message")
233 223
         lambda {
234 224
           @mock.something

0 notes on commit 5897343

Please sign in to comment.
Something went wrong with that request. Please try again.