rspecproxies 0.0.2 → 0.1.0

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: 653a8207a9d33581245cf8d80ad0da672a1c7b1b
4
- data.tar.gz: 34c8feeb474c18603ce170ac64f1474a7783f8f7
3
+ metadata.gz: 4b3a0b1c4a48a2cea5b58e1c967c5a15d23f68c2
4
+ data.tar.gz: eca395f2f3c1aa00361a83b117b77f010770a236
5
5
  SHA512:
6
- metadata.gz: afcc35da544a16f6361efae3853b9f5f13930b41112ebf3938824bf3bda64fe28f1be1e9d2bcdd9e3b95a36d6b081f1e6674d67a85460d231f682d8233aa4b88
7
- data.tar.gz: f412b271caa87b567f928ebd725947f47829b597848d2301b299c7bb4975f40925aa2980fa95a221b7dabb50197d2b0381fc30263b415c511b5b6d4528b9a743
6
+ metadata.gz: 0237c662bc25f4ccd32906389a8e7a55ebf133a8985d1f431496a134780ad6c4f2d36ccc08a64e658f8f593b6f4cba161774dcfffe6e179ec7c8cb37d8b7271e
7
+ data.tar.gz: ebd24e274002755e08bb7f0d2a1979d5c31652d5b4effa4df151585000d9258deff6fe32cddaff94e2e82763878fb3e3f769e4de248ecabff17f5ad1701faf3e
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -3,4 +3,6 @@ rvm:
3
3
  - 2.1.1
4
4
  - 2.0.0
5
5
  script: bundle exec rake
6
-
6
+ addons:
7
+ code_climate:
8
+ repo_token: 5277591d84f5c6cc34ed2c38e410185c2ba6018d1de1461de19c13ab3dfd2cfa
data/README.md CHANGED
@@ -1,3 +1,5 @@
1
+ [![Build Status](https://travis-ci.org/philou/rspecproxies.svg?branch=master)](https://travis-ci.org/philou/rspecproxies) [![Test Coverage](https://codeclimate.com/github/philou/rspecproxies/badges/coverage.svg)](https://codeclimate.com/github/philou/rspecproxies) [![Code Climate](https://codeclimate.com/github/philou/rspecproxies/badges/gpa.svg)](https://codeclimate.com/github/philou/rspecproxies)
2
+
1
3
  # RSpecProxies
2
4
 
3
5
  Special RSpec extensions to simplify mocking by providing proxies.
@@ -35,7 +37,7 @@ it 'caches users' do
35
37
  controller.login('joe', 'secret')
36
38
  controller.login('joe', 'secret')
37
39
 
38
- expect(users).to have_exactly(2).items
40
+ expect(users).to have_exactly(1).items
39
41
  end
40
42
  ```
41
43
 
@@ -47,7 +49,7 @@ it 'loads the actual user' do
47
49
 
48
50
  controller.login('joe', 'secret')
49
51
 
50
- expect(response).to redirect_to(@user.homepage)
52
+ expect(response).to include(@user.login_count)
51
53
  end
52
54
  ```
53
55
 
@@ -63,7 +65,7 @@ it 'retries on error' do
63
65
 
64
66
  resources = Resource.get_at_least(10)
65
67
 
66
- expect(resources).to have_exactly(9).items
68
+ expect(resources).to have_exactly(10).items
67
69
  end
68
70
  ```
69
71
 
@@ -2,12 +2,14 @@
2
2
 
3
3
  class Object
4
4
 
5
+ include RSpec::Mocks::ExampleMethods
6
+
5
7
  # Will call the given block with it's result every time the method
6
8
  # returns
7
9
  def on_result_from(method_name)
8
10
  stock_response = self.original_response(method_name)
9
11
 
10
- self.stub(method_name) do |*args, &block|
12
+ allow(self).to receive(method_name) do |*args, &block|
11
13
  result = stock_response.call(*args, &block)
12
14
  yield result
13
15
  result
@@ -34,7 +36,7 @@ class Object
34
36
  def on_call_to(method_name)
35
37
  stock_response = self.original_response(method_name)
36
38
 
37
- self.stub(method_name) do |*args, &block|
39
+ allow(self).to receive(method_name) do |*args, &block|
38
40
  yield *args
39
41
  stock_response.call(*args, &block)
40
42
  end
@@ -46,7 +48,7 @@ class Object
46
48
  # Allows to set up stub chains quickly and safely.
47
49
  def proxy_chain(*selectors, &block)
48
50
  if selectors.count == 1
49
- final_stub = self.stub(selectors.first)
51
+ final_stub = allow(self).to receive(selectors.first)
50
52
  block.call(final_stub) unless block.nil?
51
53
  else
52
54
  self.on_result_from(selectors.first) do |result|
@@ -1,5 +1,5 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
 
3
3
  module RSpecProxies
4
- VERSION = "0.0.2"
4
+ VERSION = "0.1.0"
5
5
  end
@@ -18,10 +18,11 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
20
20
 
21
- spec.add_dependency "rspec"
21
+ spec.add_dependency "rspec", "~> 3.0"
22
22
 
23
23
  spec.add_development_dependency "bundler"
24
24
  spec.add_development_dependency "rake"
25
25
  spec.add_development_dependency "rake"
26
26
  spec.add_development_dependency "guard-rspec"
27
+ spec.add_development_dependency "codeclimate-test-reporter"
27
28
  end
@@ -52,6 +52,7 @@ module RSpecProxies
52
52
 
53
53
  it 'hooks on return from a method' do
54
54
  user = nil
55
+
55
56
  User.on_result_from(:load) {|u| user = u}
56
57
 
57
58
  @controller.render('Joe')
@@ -1,3 +1,6 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
 
3
+ require "codeclimate-test-reporter"
4
+ CodeClimate::TestReporter.start
5
+
3
6
  require 'rspecproxies'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspecproxies
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Philou
@@ -31,22 +31,22 @@ cert_chain:
31
31
  yLcl1cmm5ALtJ/+Bkkmp0i4amXeTDMvq9r8PBsVsQwxYOYJBP+Umxz3PX6HjFHrQ
32
32
  XdkXx3oZ
33
33
  -----END CERTIFICATE-----
34
- date: 2014-05-21 00:00:00.000000000 Z
34
+ date: 2014-08-24 00:00:00.000000000 Z
35
35
  dependencies:
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rspec
38
38
  requirement: !ruby/object:Gem::Requirement
39
39
  requirements:
40
- - - '>='
40
+ - - ~>
41
41
  - !ruby/object:Gem::Version
42
- version: '0'
42
+ version: '3.0'
43
43
  type: :runtime
44
44
  prerelease: false
45
45
  version_requirements: !ruby/object:Gem::Requirement
46
46
  requirements:
47
- - - '>='
47
+ - - ~>
48
48
  - !ruby/object:Gem::Version
49
- version: '0'
49
+ version: '3.0'
50
50
  - !ruby/object:Gem::Dependency
51
51
  name: bundler
52
52
  requirement: !ruby/object:Gem::Requirement
@@ -103,6 +103,20 @@ dependencies:
103
103
  - - '>='
104
104
  - !ruby/object:Gem::Version
105
105
  version: '0'
106
+ - !ruby/object:Gem::Dependency
107
+ name: codeclimate-test-reporter
108
+ requirement: !ruby/object:Gem::Requirement
109
+ requirements:
110
+ - - '>='
111
+ - !ruby/object:Gem::Version
112
+ version: '0'
113
+ type: :development
114
+ prerelease: false
115
+ version_requirements: !ruby/object:Gem::Requirement
116
+ requirements:
117
+ - - '>='
118
+ - !ruby/object:Gem::Version
119
+ version: '0'
106
120
  description: Proxy doubles for RSpec
107
121
  email:
108
122
  - philippe.bourgau@gmail.com
metadata.gz.sig CHANGED
Binary file