attributor 3.0.1 → 4.0.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: bff0810c57451a4f93b1f23d7bbdc947757ee3ab
4
- data.tar.gz: 4017dd9949a54d8d6e14aa5c11aff80aac0f0358
3
+ metadata.gz: 64d1a212c179718aacc7837f4484062a4987e4d3
4
+ data.tar.gz: 5d2f971e22f191497e2f29bb95e8f84e73a8a52f
5
5
  SHA512:
6
- metadata.gz: a8f0a4e9ac2a34d486c5ccd83da33cc8ba073e91ae82c747d01de08652e3b4f7705fc5efad274edafa2f55599b3b7f479a63552ae596854d4e8ba295513dd596
7
- data.tar.gz: 2eb0699f1d50de06159e9cd65a8e824804c1be0175384f597cf31c18dc7b438beca565fbe33d2b80a23ffff655d2fb7255d3d5ff28d2d415db12ee5a64fe5cc0
6
+ metadata.gz: f33c468a57b20fd6e91bf58747513b19856d9c62b2c61ddf96e718a91bb0cfa9e3fa1f85c62442e5735df3280707d3adc70bf1b11c4f9c90b7ff5511668affe3
7
+ data.tar.gz: 14084572c335799325e89195620520176ff57360bf1732a3eee9c86a00fce331a842ca8790a2aaa2743eccd49cc012a84bc7d5aec5f525659a108885ef54543e
data/CHANGELOG.md CHANGED
@@ -3,6 +3,13 @@
3
3
  ## next
4
4
 
5
5
 
6
+ ## 4.0.0 next
7
+
8
+ * Changed the expectation of the value for an `:example` option of an attribute:
9
+ * Before, passing an array of values would indicate that those were a few possible examples for it.
10
+ * Now, any value (except the already existing special regexp or a proc) for an example will need to be of a native type (or coercible to it). This means that an attribute of type `Collection` can take an array example (and be taken as the whole thing)
11
+ * If anybody wants to provide multiple examples for an attribute they can write a proc, and make it return the different ones.
12
+
6
13
  ## 3.0.1
7
14
 
8
15
  * Fixed bug with example Hashes where `[]` with a key not in the hash would throw a `NoMethodError`.
@@ -136,9 +136,6 @@ module Attributor
136
136
  generated = case val
137
137
  when ::Regexp
138
138
  val.gen
139
- when ::Array
140
- # TODO: handle arrays of non native types, i.e. arrays of regexps.... ?
141
- val.pick
142
139
  when ::Proc
143
140
  if val.arity == 2
144
141
  val.call(parent, context)
@@ -1,3 +1,3 @@
1
1
  module Attributor
2
- VERSION = "3.0.1"
2
+ VERSION = "4.0.0"
3
3
  end
@@ -316,14 +316,10 @@ describe Attributor::Attribute do
316
316
 
317
317
  end
318
318
 
319
- context 'with an array' do
319
+ context 'with an Collection (of Strings)' do
320
+ let(:type) { Attributor::Collection.of(String) }
320
321
  let(:example) { ["one"] }
321
- let(:generated_example) { "one" }
322
- it 'picks a random value' do
323
- example.should_receive(:pick).and_call_original
324
- example.should include example_result
325
- end
326
-
322
+ it { should == example }
327
323
  end
328
324
 
329
325
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: attributor
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.1
4
+ version: 4.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josep M. Blanquer
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-07-01 00:00:00.000000000 Z
12
+ date: 2015-07-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: hashie