rspec-spy 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +4 -0
- data/README.md +6 -2
- data/lib/rspec-spy.rb +0 -6
- data/lib/rspec/spy.rb +4 -0
- data/lib/rspec/spy/mock_methods.rb +2 -2
- data/lib/rspec/spy/version.rb +1 -1
- data/spec/spec_helper.rb +4 -0
- metadata +3 -3
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -37,10 +37,14 @@ Or install it yourself as:
|
|
37
37
|
|
38
38
|
$ gem install rspec-spy
|
39
39
|
|
40
|
-
Add to your spec_helper.rb
|
40
|
+
Add to your spec_helper.rb in `RSpec.configure` **AFTER any other global before hooks, especially DatabaseCleaner**:
|
41
41
|
|
42
42
|
``` ruby
|
43
|
-
|
43
|
+
# any config.before hooks should go above
|
44
|
+
|
45
|
+
config.before(:each, :spy => true) do |example|
|
46
|
+
RSpec::Spy(example)
|
47
|
+
end
|
44
48
|
```
|
45
49
|
|
46
50
|
## Usage
|
data/lib/rspec-spy.rb
CHANGED
data/lib/rspec/spy.rb
CHANGED
@@ -20,13 +20,13 @@ RSpec::Mocks::Methods.class_eval do
|
|
20
20
|
|
21
21
|
def spy_check(method)
|
22
22
|
return if RSpec::Spy.ok_to_spy?
|
23
|
-
raise "#{method}
|
23
|
+
raise "#{method} was called before RSpec::Spy(example). Make sure that your example is properly tagged (generally with :spy => true) and you have a before hook in your RSpec.configure that calls RSpec::Spy(example)."
|
24
24
|
end
|
25
25
|
|
26
26
|
def nil_check(method)
|
27
27
|
return if RSpec::Mocks::Proxy.allow_message_expectations_on_nil?
|
28
28
|
return unless nil?
|
29
|
-
raise "You set an expectation on nil, maybe you're using an @instance_var? If you want to do this, use allow_message_expectations_on_nil."
|
29
|
+
raise "You set an expectation on nil, maybe you're using an @instance_var before it is set? If you want to do this, use allow_message_expectations_on_nil."
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
data/lib/rspec/spy/version.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec-spy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-05-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
@@ -104,7 +104,7 @@ rubyforge_project:
|
|
104
104
|
rubygems_version: 1.8.21
|
105
105
|
signing_key:
|
106
106
|
specification_version: 3
|
107
|
-
summary: rspec-spy-1.
|
107
|
+
summary: rspec-spy-1.1.0
|
108
108
|
test_files:
|
109
109
|
- spec/rspec-spy_spec.rb
|
110
110
|
- spec/spec_helper.rb
|