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 +8 -8
- data/lib/rspec_stubout/prevent_stubout.rb +9 -8
- data/lib/rspec_stubout/version.rb +1 -1
- data/spec/implicit_subject_spec.rb +2 -0
- data/spec/rspec_stubout_spec.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NmU2M2ZmZWExN2RhMGZlYzZjYjk2ODM3NmJhYzdhNWI4Mzc2YWRkNg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NDFhN2U2YzFkMDNhNmE2ODgxNjk5OGI1NWNhMWRhMDViZmJlOWZkMg==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NmIwZjAyOGFiOTE4NTcxOWMxNGZjMjE5YTM5MjIyOWVkMWIzY2YxM2IzYjNi
|
10
|
+
OTA1MTJmNzljOTk5MTM5MDk1MzUzODBjMTVmZDk3ZDdhNDU2ZGViOTQ4OGNj
|
11
|
+
OWFmYmMxY2I3MGEwYzBhMmIyZGQwOGZmNzFjZTY5N2ZhN2ZiOTU=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
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
|
-
|
12
|
-
|
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
|
data/spec/rspec_stubout_spec.rb
CHANGED
@@ -37,7 +37,7 @@ describe RspecStubout do
|
|
37
37
|
expect {
|
38
38
|
object.stub(method1: 'foo')
|
39
39
|
}.to raise_error(
|
40
|
-
|
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
|
-
|
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.
|
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-
|
11
|
+
date: 2013-08-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|