rspec-coldep 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +6 -1
- data/rspec-coldep.gemspec +2 -2
- data/spec/usage_spec.rb +9 -0
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4115f235630bab0b41e50d1f7e60e93adbf4240e
|
4
|
+
data.tar.gz: 898256b867d76220e9e8057c61de0162cb5904f3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9156fe3701948f80172fab475639f2ef083c256356c2ee31387b9430e5515ab055b52268115f57462663a927478469488af73b2374d1a08844e6b71c95338f28
|
7
|
+
data.tar.gz: 7620e61f81a64f5cc00639beb2cea3154e9363ce8b06fcd197d1ffdfbf34ce82232c3b8f1a4ffa43de1562838b033b9ad803094a71990ffca34a46096ed43d61
|
data/README.md
CHANGED
@@ -29,11 +29,16 @@ RSpec-ColDep syntax documents dependencies of the object under test and creates
|
|
29
29
|
User.all == 'a couple fake users'
|
30
30
|
end
|
31
31
|
|
32
|
-
is
|
32
|
+
is similar to this:
|
33
33
|
|
34
34
|
User.stub(:find).with('1234').and_return('a single fake user')
|
35
35
|
User.stub(:all).and_return('a couple fake users')
|
36
36
|
|
37
|
+
except the ColDep version encourages test isolation by:
|
38
|
+
|
39
|
+
* not requiring `User` to be previously defined.
|
40
|
+
* not allowing unstubbed methods to be called on the dependency.
|
41
|
+
|
37
42
|
## Documenting collaborators builds test doubles
|
38
43
|
|
39
44
|
RSpec-ColDep syntax documents a collaborator's interface with the object under test and builds a test double based on the example usage provided via block:
|
data/rspec-coldep.gemspec
CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = "rspec-coldep"
|
7
|
-
spec.version = "0.1.
|
7
|
+
spec.version = "0.1.2"
|
8
8
|
spec.authors = ["Matt Daubert"]
|
9
9
|
spec.email = ["mdaubert@gmail.com"]
|
10
10
|
spec.description = %q{RSpec mocking syntax using collaborators and dependencies}
|
@@ -17,7 +17,7 @@ Gem::Specification.new do |spec|
|
|
17
17
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
18
18
|
spec.require_paths = ["lib"]
|
19
19
|
|
20
|
-
spec.add_dependency "rspec", "~> 2.
|
20
|
+
spec.add_dependency "rspec", "~> 2.11"
|
21
21
|
|
22
22
|
spec.add_development_dependency "bundler", "~> 1.3"
|
23
23
|
spec.add_development_dependency "rake"
|
data/spec/usage_spec.rb
CHANGED
@@ -11,6 +11,15 @@ describe 'usage' do
|
|
11
11
|
expect(User.all).to eq('a couple fake users')
|
12
12
|
end
|
13
13
|
|
14
|
+
it 'does not allow unstubbed methods to be called' do
|
15
|
+
dependency 'User' do
|
16
|
+
User.find('1234') == 'a single fake user'
|
17
|
+
end
|
18
|
+
|
19
|
+
expect { User.find('4321') }.to raise_exception
|
20
|
+
expect { User.not_stubbed }.to raise_exception
|
21
|
+
end
|
22
|
+
|
14
23
|
it 'creates a test double' do
|
15
24
|
user = collaborator do |user|
|
16
25
|
user.first_name == 'Billy'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec-coldep
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Daubert
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-06-
|
11
|
+
date: 2013-06-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ~>
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '2.
|
19
|
+
version: '2.11'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ~>
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '2.
|
26
|
+
version: '2.11'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|