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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bcdb239b023e9b44530ffdfdc316cc2e8201375b
4
- data.tar.gz: 5c762b41a5dcc40a57ed934773fd90b4e8ba208d
3
+ metadata.gz: 4115f235630bab0b41e50d1f7e60e93adbf4240e
4
+ data.tar.gz: 898256b867d76220e9e8057c61de0162cb5904f3
5
5
  SHA512:
6
- metadata.gz: 8813e5b76aa540bc7588d4cdec19cf942bb5376bb41c4d50d5e15cb90dfc775003158818d19e331587f86d70d1068cf8a7ac587c1044750025c922dcfd443cdd
7
- data.tar.gz: ba0d60dcc7fb26d0ed0fada4bfff143e05abd492e5bfe96bb3d1497a8a587ec96a89a791643abe07994b8aa1fd61b7ce77ef55d4735ec271d2121dcab4ab2519
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 effectively the same as:
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:
@@ -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.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.0"
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"
@@ -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.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-25 00:00:00.000000000 Z
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.0'
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.0'
26
+ version: '2.11'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement