delegate_matcher 0.0.1 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0ec0997475eaaee1d410562d34021316d878821a
4
- data.tar.gz: ec92634564aabfac3448516ba0cdfd16051df08b
3
+ metadata.gz: a2fc3381de7601d9699de188f3f24cfa11066f60
4
+ data.tar.gz: 8fd2cd2811125dd7f82966141071776b64b155c9
5
5
  SHA512:
6
- metadata.gz: 51ffc33cf2e980067e1647af487efc778ba776e5224e651d02a4d46edb6abdb7b071da44465847e8222eff8f77dd1aea1428837cd324c8c30e40821cc6cb2856
7
- data.tar.gz: a5e1996cf241039408c03f2e3ffd69e132aeb563ecc9e684b5df2d889d30c586d4814be6f0a69711fc1bca6b736a8683d390d3611a100437c3217d45c2dc6f44
6
+ metadata.gz: 67f45287b58103aae009169440ef82e9fe3c7e042997072080b3ff27424aefbfb3644461fb9a4b7497af2d57abb9a7d1ca7d7b1c33c4a7d750a8e52961f6c9b5
7
+ data.tar.gz: 8b32722dc5dd7698333045fe7ebc26331dad2f5f2491c48c3626faa6540195f0f00d8fc467a245245a555d55ab857ef0c774730b2a71e9fe846da7b55871cf7d
data/.travis.yml ADDED
@@ -0,0 +1,7 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.9.3
4
+ - 2.0.0
5
+ - 2.1
6
+ - 2.2
7
+ - ruby-head
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- delegate_matcher (0.0.1)
4
+ delegate_matcher (0.0.3)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -32,6 +32,7 @@ GEM
32
32
  ast (>= 1.1, < 3.0)
33
33
  powerpack (0.1.1)
34
34
  rainbow (2.0.0)
35
+ rake (10.4.2)
35
36
  rest-client (1.6.7)
36
37
  mime-types (>= 1.16)
37
38
  rspec (3.3.0)
@@ -78,6 +79,7 @@ DEPENDENCIES
78
79
  bundler (~> 1.7)
79
80
  coveralls (~> 0.7)
80
81
  delegate_matcher!
82
+ rake (~> 10.0)
81
83
  rspec (~> 3.0)
82
84
  rspec-its (~> 1.1)
83
85
  rubocop (~> 0.30)
data/README.md CHANGED
@@ -1,3 +1,5 @@
1
+ [![Build Status](https://travis-ci.org/dwhelan/delegate_matcher.png?branch=master)](https://travis-ci.org/dwhelan/delegate_matcher)
2
+
1
3
  # Delegate Matcher
2
4
 
3
5
  An RSpec matcher for validating delegation. This matcher works with delegation based on the [Forwardable](http://ruby-doc.org/stdlib-2.0.0/libdoc/forwardable/rdoc/Forwardable.html) module,
@@ -26,7 +28,6 @@ $ gem install delegate_matcher
26
28
 
27
29
  Then add the following to your ```spec_helper.rb``` file:
28
30
 
29
-
30
31
  ```ruby
31
32
  require 'delegate_matcher'
32
33
  ```
@@ -86,8 +87,8 @@ object since the matcher cannot validate ```nil``` handling in these cases.
86
87
 
87
88
  ### Arguments
88
89
 
89
- If the method being delegated takes arguments then you can supply them with the ```with``` method. The matcher
90
- will ensure that the provided arguments are in turn passed to the delegate.
90
+ If the method being delegated takes arguments you can supply them with the ```with``` method. The matcher
91
+ will check that the provided arguments are in turn passed to the delegate.
91
92
 
92
93
  ```ruby
93
94
  describe Post do
@@ -112,14 +113,14 @@ You can check that a block passed is in turn passed to the delegate via the ```w
112
113
  ```ruby
113
114
  describe Post do
114
115
  it { should delegate(:name).to(author).with_a_block } # name(&block) => author.name(&block)
115
- it { should delegate(:name).to(author).with_block } # name(&block) => author.name(&block) alias for with_a_block
116
+ it { should delegate(:name).to(author).with_block } # name(&block) => author.name(&block) # alias for with_a_block
116
117
 
117
118
  it { should delegate(:name).to(author).without_a_block } # name(&block) => author.name
118
- it { should delegate(:name).to(author).without_block } # name(&block) => author.name alias for without_a_block
119
+ it { should delegate(:name).to(author).without_block } # name(&block) => author.name # alias for without_a_block
119
120
  end
120
121
  ```
121
122
 
122
- By default, block delegated is only check if ```with_a_block``` or ```without_a_block``` is specified.
123
+ By default, block delegation is only checked if ```with_a_block``` or ```without_a_block``` is specified.
123
124
 
124
125
  ### Active Support
125
126
 
@@ -19,11 +19,12 @@ Gem::Specification.new do |gem|
19
19
  gem.test_files = gem.files.grep(%r{^spec/})
20
20
  gem.require_paths = ['lib']
21
21
 
22
- gem.add_development_dependency 'activesupport', '~> 4.2'
23
- gem.add_development_dependency 'bundler', '~> 1.7'
24
- gem.add_development_dependency 'coveralls', '~> 0.7'
25
- gem.add_development_dependency 'rspec', '~> 3.0'
26
- gem.add_development_dependency 'rspec-its', '~> 1.1'
27
- gem.add_development_dependency 'rubocop', '~> 0.30'
28
- gem.add_development_dependency 'simplecov', '~> 0.9'
22
+ gem.add_development_dependency 'activesupport', '~> 4.2'
23
+ gem.add_development_dependency 'bundler', '~> 1.7'
24
+ gem.add_development_dependency 'coveralls', '~> 0.7'
25
+ gem.add_development_dependency 'rake', '~> 10.0'
26
+ gem.add_development_dependency 'rspec', '~> 3.0'
27
+ gem.add_development_dependency 'rspec-its', '~> 1.1'
28
+ gem.add_development_dependency 'rubocop', '~> 0.30'
29
+ gem.add_development_dependency 'simplecov', '~> 0.9'
29
30
  end
@@ -1,3 +1,5 @@
1
+ require 'rspec/matchers'
2
+
1
3
  RSpec::Matchers.define(:delegate) do |method|
2
4
  match do |delegator|
3
5
  fail 'need to provide a "to"' unless delegate
@@ -13,13 +15,11 @@ RSpec::Matchers.define(:delegate) do |method|
13
15
  end
14
16
 
15
17
  def failure_message
16
- message = failure_message_details(false)
17
- message.empty? ? super : message
18
+ failure_message_details(false) || super
18
19
  end
19
20
 
20
21
  def failure_message_when_negated
21
- message = failure_message_details(true)
22
- message.empty? ? super : message
22
+ failure_message_details(true) || super
23
23
  end
24
24
 
25
25
  chain(:to) { |delegate| @delegate = delegate }
@@ -227,12 +227,13 @@ RSpec::Matchers.define(:delegate) do |method|
227
227
  end
228
228
 
229
229
  def failure_message_details(negated)
230
- [
230
+ message = [
231
231
  argument_failure_message(negated),
232
232
  block_failure_message(negated),
233
233
  return_value_failure_message(negated),
234
234
  allow_nil_failure_message(negated)
235
235
  ].reject(&:empty?).join(' and ')
236
+ message.empty? ? nil : message
236
237
  end
237
238
 
238
239
  def argument_failure_message(negated)
@@ -1,3 +1,3 @@
1
1
  module DelegateMatcher
2
- VERSION ||= '0.0.1'.freeze
2
+ VERSION ||= '0.0.3'.freeze
3
3
  end
@@ -183,11 +183,6 @@ describe 'Delegate matcher' do
183
183
  end
184
184
  end
185
185
 
186
- it 'should have a VERSION' do
187
- load './lib/delegate_matcher/version.rb'
188
- expect(DelegateMatcher::VERSION).to_not be_empty
189
- end
190
-
191
186
  describe 'delegation to instance method' do
192
187
  it { should delegate(:name).to(:author) }
193
188
  it { should delegate(:writer).to(:author).as(:name) }
@@ -0,0 +1,7 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'Version' do
4
+ before { load './lib/delegate_matcher/version.rb' }
5
+
6
+ it('should be present') { expect(DelegateMatcher::VERSION).to_not be_empty }
7
+ end
data/spec/spec_helper.rb CHANGED
@@ -1,7 +1,6 @@
1
1
  require 'rspec'
2
2
  require 'rspec/its'
3
3
  require 'coveralls'
4
-
5
4
  require 'simplecov'
6
5
 
7
6
  SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
@@ -10,10 +9,6 @@ SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
10
9
  ]
11
10
  SimpleCov.start
12
11
 
13
- # require 'pry'
14
- # require 'awesome_print'
15
-
16
- # I18n.enforce_available_locales = true
17
12
  Coveralls.wear!
18
13
 
19
14
  require 'delegate_matcher'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: delegate_matcher
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Declan Whelan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-28 00:00:00.000000000 Z
11
+ date: 2015-09-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -52,6 +52,20 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0.7'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '10.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '10.0'
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: rspec
57
71
  requirement: !ruby/object:Gem::Requirement
@@ -117,6 +131,7 @@ extra_rdoc_files: []
117
131
  files:
118
132
  - ".gitignore"
119
133
  - ".rubocop.yml"
134
+ - ".travis.yml"
120
135
  - Gemfile
121
136
  - Gemfile.lock
122
137
  - LICENSE.txt
@@ -129,6 +144,7 @@ files:
129
144
  - spec/lib/active_support_delegation_spec.rb
130
145
  - spec/lib/delegate_matcher_spec.rb
131
146
  - spec/lib/forwardable_delegation_spec.rb
147
+ - spec/lib/version_spec.rb
132
148
  - spec/spec_helper.rb
133
149
  homepage: https://github.com/dwhelan/delegate_matcher
134
150
  licenses:
@@ -158,4 +174,5 @@ test_files:
158
174
  - spec/lib/active_support_delegation_spec.rb
159
175
  - spec/lib/delegate_matcher_spec.rb
160
176
  - spec/lib/forwardable_delegation_spec.rb
177
+ - spec/lib/version_spec.rb
161
178
  - spec/spec_helper.rb