smart_rspec 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: 3f93d0876da7f46893ef2d4c9ab277d4e3914999
4
- data.tar.gz: 5299cc3f8aa245f8091121b6927b20289372e90f
3
+ metadata.gz: 3fec0b70b27981a4ce14973f586f9cb9c2e0aff7
4
+ data.tar.gz: bb9a3a17e6d89448f2b942dd2f7ef0dc1b691e1c
5
5
  SHA512:
6
- metadata.gz: d748af42e2e3a22be358857de32e4f55cabbef5a891e35de140aa0b5a19fd2da15a7f9a0fc706ad3f9ec8e35c89d53b69f261cdb0e0c0e29df906ea5b50fb8b3
7
- data.tar.gz: 46687f5c6aaf73b51190d23e3fed62f8a8b36b693a398c62c5d7d1099dca8be10db640fc81e472cc42815a58050bd3a920be9176a20b46e30b0b62f7e7637fde
6
+ metadata.gz: 1d662215e602579ace9430953960cea0d2466e7ef297bd8fc08014c0a448a87dfac14ec2b7183e1792ee579d861bb104053eb93c7b71b63aa3a20c222e492f8d
7
+ data.tar.gz: 9e0db889538961ebacd12c4e11af11ea763090a14f2372ed4be466f65f3f110238d586e1aae96d0368c380336e662ac13c3fcb6ccf3e6f2158681189c8d1ded9
data/README.md CHANGED
@@ -226,10 +226,28 @@ end
226
226
  #### Other matchers
227
227
 
228
228
  ##### include_items
229
+
230
+ Comparing to array:
231
+
229
232
  ``` ruby
230
233
  it { expect(%w(foo bar foobar)).to include_items(%w(foo bar foobar)) }
231
234
  ```
232
235
 
236
+ Comparing to multiple arguments:
237
+
238
+ ``` ruby
239
+ it 'includes all items' do
240
+ item1, item2 = 'foo', 'bar'
241
+ expect(%w(foo bar)).to include_items(item1, item2))
242
+ end
243
+ ```
244
+
245
+ # Credits
246
+
247
+ 1. Some of the "have" matchers (precisely `have`, `have_at_least` and `have_at_most`) were taken from the `rspec-collection_matchers` gem.
248
+ 2. Some of the macros/matchers were inspired in RSpec helpers that I worked along with two friends ([Douglas André](https://github.com/douglasandre) and [Giovanni Bonetti](https://github.com/giovannibonetti)) at the
249
+ [Beauty Date](https://beautydate.com.br) project.
250
+
233
251
  # TODO
234
252
 
235
253
  - Create macros for model scopes;
@@ -7,8 +7,8 @@ module SmartRspec
7
7
  match { |actual| actual.errors.keys.include?(attr) }
8
8
  end
9
9
 
10
- matcher :include_items do |items|
11
- match { |actual| (items - actual).empty? }
10
+ matcher :include_items do |*items|
11
+ match { |actual| (items.flatten(1) - actual).empty? }
12
12
  end
13
13
  end
14
14
  end
@@ -1,3 +1,3 @@
1
1
  module SmartRspec
2
- VERSION = '0.1.1'
2
+ VERSION = '0.1.2'
3
3
  end
@@ -131,6 +131,7 @@ describe 'SmartRspec Matchers' do
131
131
  describe '#include_items' do
132
132
  context 'when valid' do
133
133
  it { expect(%w(foo bar foobar)).to include_items(%w(foo bar foobar)) }
134
+ it { expect(%w(lorem ipsum)).to include_items('lorem', 'ipsum') }
134
135
  it { expect([1, 'foo', ['bar']]).to include_items([1, 'foo', ['bar']]) }
135
136
  end
136
137
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smart_rspec
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
  - Tiago Guedes
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-02 00:00:00.000000000 Z
11
+ date: 2015-06-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport