moses-rspec-spies 3.0.0rc → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +22 -0
- data/VERSION +1 -1
- data/moses-rspec-spies.gemspec +2 -2
- data/spec/rspec-spies_spec.rb +7 -0
- metadata +4 -4
data/README.rdoc
CHANGED
@@ -1,5 +1,27 @@
|
|
1
1
|
= rspec-spies
|
2
2
|
|
3
|
+
== How this differs from technicalpickles/rspec-spies
|
4
|
+
|
5
|
+
Instead of having to specify the arguments of your expected call directly, as in
|
6
|
+
|
7
|
+
it "should find post by id" do
|
8
|
+
Post.should have_received(:find).with(@post.id)
|
9
|
+
end
|
10
|
+
|
11
|
+
you can now just leave off the arguments if you don't need to specify them:
|
12
|
+
|
13
|
+
it "should find post by id" do
|
14
|
+
Post.should have_received(:find)
|
15
|
+
end
|
16
|
+
|
17
|
+
You can also use RSpec argument matchers:
|
18
|
+
|
19
|
+
it "should find post by id" do
|
20
|
+
Post.should have_received(:validate).with(any_instance(Validator))
|
21
|
+
end
|
22
|
+
|
23
|
+
== Intro
|
24
|
+
|
3
25
|
Behold, the Test Spies pattern! http://xunitpatterns.com/Test%20Spy.html
|
4
26
|
|
5
27
|
Some other mocking frameworks support this. In particular, rr, notamock, and jferris's fork of mocha. It'd be great to see support for it in rspec's mocking library as well.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.0.
|
1
|
+
3.0.0
|
data/moses-rspec-spies.gemspec
CHANGED
@@ -5,9 +5,9 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "moses-rspec-spies"
|
8
|
-
s.version = "3.0.
|
8
|
+
s.version = "3.0.0"
|
9
9
|
|
10
|
-
s.required_rubygems_version = Gem::Requirement.new("
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Joshua Nichols", "Moses Hohman"]
|
12
12
|
s.date = "2012-04-08"
|
13
13
|
s.description = "test spies, for rspec (forked from technicalpickles/rspec-spies)"
|
data/spec/rspec-spies_spec.rb
CHANGED
@@ -21,6 +21,13 @@ module Spec
|
|
21
21
|
have_received(:slice).matches?(@object).should be_true
|
22
22
|
end
|
23
23
|
|
24
|
+
it "matches using argument matchers" do
|
25
|
+
@object.stub!(:slice)
|
26
|
+
@object.slice(5)
|
27
|
+
|
28
|
+
have_received(:slice).with(an_instance_of(Fixnum)).matches?(@object).should be_true
|
29
|
+
end
|
30
|
+
|
24
31
|
it "matches if specifies nil arg, if method is called with a nil arg" do
|
25
32
|
@object.stub!(:slice)
|
26
33
|
@object.slice(nil)
|
metadata
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: moses-rspec-spies
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
prerelease:
|
5
|
-
version: 3.0.
|
4
|
+
prerelease:
|
5
|
+
version: 3.0.0
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Joshua Nichols
|
@@ -96,9 +96,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
96
96
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
97
97
|
none: false
|
98
98
|
requirements:
|
99
|
-
- - "
|
99
|
+
- - ">="
|
100
100
|
- !ruby/object:Gem::Version
|
101
|
-
version:
|
101
|
+
version: "0"
|
102
102
|
requirements: []
|
103
103
|
|
104
104
|
rubyforge_project:
|