rspec_stubout 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NTEwYjc3YjZkZWUxOWFhMWVmODcyMWRmNWIwNTAzMTUyNTg3NDAwZA==
4
+ NmU2M2ZmZWExN2RhMGZlYzZjYjk2ODM3NmJhYzdhNWI4Mzc2YWRkNg==
5
5
  data.tar.gz: !binary |-
6
- OTM5M2ZkYzRjNTEzYjVkOWEzOWNkMDI5ZGNmNmI0MDBhNTAxNTYyMg==
6
+ NDFhN2U2YzFkMDNhNmE2ODgxNjk5OGI1NWNhMWRhMDViZmJlOWZkMg==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- NWFiMzI3MDlkMmU1NmI3OTE2NTA4N2E4NWQ3ODBhMzg3Nzc0ZTI4MTJjM2Vi
10
- NWI4NTU1ZjBkZGMxODhjZGI1YmE1MWQyZDQ2YWNjNWUzNWU2MmIyMDYzMjUx
11
- YWY0NGRjZWRjMDc3N2U4YTFjYjRhNjFjMTJhMGRlMjAwMWY3OWI=
9
+ NmIwZjAyOGFiOTE4NTcxOWMxNGZjMjE5YTM5MjIyOWVkMWIzY2YxM2IzYjNi
10
+ OTA1MTJmNzljOTk5MTM5MDk1MzUzODBjMTVmZDk3ZDdhNDU2ZGViOTQ4OGNj
11
+ OWFmYmMxY2I3MGEwYzBhMmIyZGQwOGZmNzFjZTY5N2ZhN2ZiOTU=
12
12
  data.tar.gz: !binary |-
13
- NzhjMTc5MGRiNzdiYzgxMmQ0ODZjNGVmZWNhOGExYTc5YzY3N2RmZmFiYjZi
14
- ZTdiZTcxNGE3NjE0YTUwMTM4MGUwNTQwYTczN2E0NmZjN2VlMjE0MWJjOTBl
15
- OTA4MDA0OWUwNzVhMDhlY2RjNmE1YmE4NDM5ZTEwY2U2NzExNGM=
13
+ YjI5MzZhNGMzMmE4ZjBmNDg0MzMxZTU1MmVhNjA5NjUxNjUzMjFkMTU2NDA5
14
+ MzAwODIxMTAwMzdiNDZkNTk5NDY4M2M4MTc5Yjg2NThjNDEwNzY5ODZhODFj
15
+ MTdmOTExNzRlYzNmOTBkZTNkOGViZWMzNWJhMjcyODY1ZjVmOGI=
@@ -8,18 +8,19 @@ module RspecStubout
8
8
  rspec_config.before(:each) do
9
9
  unless example.metadata[:allow_stubout]
10
10
  begin
11
- described_class.stub(:stub) do
12
- raise "#{described_class} is the object under test and should not be stubbed"
13
- end
14
-
15
- subject.stub(:stub) do
16
- raise "#{subject} is the object under test and should not be stubbed"
17
- end
11
+ RspecStubout.prevent_stub_on(described_class)
12
+ RspecStubout.prevent_stub_on(subject)
18
13
  rescue => e
19
- warn "rspec stubout setup failed, possibly setup in another before(:each) has not run yet: #{e.inspect}"
14
+ warn "rspec stubout setup failed, possibly setup in another before(:each) has not run yet: #{e.backtrace[0]}, #{e.inspect}"
20
15
  end
21
16
  end
22
17
  end
23
18
  end
24
19
 
20
+ def prevent_stub_on(o)
21
+ unless o.nil?
22
+ o.stub(:stub) { raise "#{o} is the object under test and should not be stubbed" }
23
+ end
24
+ end
25
+
25
26
  end
@@ -1,5 +1,5 @@
1
1
  # encoding: UTF-8
2
2
 
3
3
  module RspecStubout
4
- VERSION = '0.0.2'
4
+ VERSION = '0.0.3'
5
5
  end
@@ -1,3 +1,5 @@
1
+ # encoding: UTF-8
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  class C
@@ -37,7 +37,7 @@ describe RspecStubout do
37
37
  expect {
38
38
  object.stub(method1: 'foo')
39
39
  }.to raise_error(
40
- "subject is the object under test and should not be stubbed")
40
+ 'subject is the object under test and should not be stubbed')
41
41
  end
42
42
 
43
43
  end
@@ -50,7 +50,7 @@ describe RspecStubout do
50
50
  expect {
51
51
  object.stub(method1: 'foo')
52
52
  }.to raise_error(
53
- "subject is the object under test and should not be stubbed")
53
+ 'subject is the object under test and should not be stubbed')
54
54
  end
55
55
 
56
56
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec_stubout
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthew M. Boedicker
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-08-01 00:00:00.000000000 Z
11
+ date: 2013-08-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec