populate-me 0.5.0 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/example/config.ru +1 -0
- data/lib/populate_me/document_mixins/outcasting.rb +8 -0
- data/lib/populate_me/version.rb +1 -1
- data/test/test_document_outcasting.rb +20 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 92c2089ed9f39395bbb2082d2509b611dc3edf06
|
4
|
+
data.tar.gz: 4df7f1e80399815320841200ce6ed3a34d51f70f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f1ff869f7c0a4dc0f36d0c0ebdff12e670563ff60237fcd620ffff2fd3dcba551faf0f2cd1113cfd287160631f4d8475463cd5d0cd087a1cc5727de88d4821e7
|
7
|
+
data.tar.gz: 3bad55309476e3fcb50024dd602738d011e54a8514898f2b22f75004ce8e7807cd9326dc813ac41fc6fb510e9fea4549cb355661696c0a945354a006a3bea953
|
data/example/config.ru
CHANGED
@@ -61,6 +61,7 @@ class Article < PopulateMe::Document
|
|
61
61
|
field :content, type: :text
|
62
62
|
field :yes_or_no, type: :select, select_options: [:yes,:no]
|
63
63
|
field :tags, type: :select, multiple: true, select_options: ['art','sport','science']
|
64
|
+
field :price, type: :price
|
64
65
|
position_field
|
65
66
|
|
66
67
|
after :save do
|
data/lib/populate_me/version.rb
CHANGED
@@ -16,6 +16,7 @@ class Outcasted < PopulateMe::Document
|
|
16
16
|
field :pdf, type: :attachment
|
17
17
|
field :authors, type: :list
|
18
18
|
field :weirdo, type: :strange
|
19
|
+
field :price, type: :price
|
19
20
|
|
20
21
|
def get_size_options
|
21
22
|
[
|
@@ -192,6 +193,25 @@ describe PopulateMe::Document, 'Outcasting' do
|
|
192
193
|
|
193
194
|
end
|
194
195
|
|
196
|
+
describe '#outcast_price' do
|
197
|
+
|
198
|
+
it 'Displays the price in dollars/pounds' do
|
199
|
+
original = Outcasted.fields[:price]
|
200
|
+
outcasted = Outcasted.new price: 2999
|
201
|
+
output = outcasted.outcast(:price, original, {input_name_prefix: 'data'})
|
202
|
+
assert_equal '29.99', output[:input_value]
|
203
|
+
end
|
204
|
+
|
205
|
+
it 'Leaves the field alone when value not an integer' do
|
206
|
+
original = Outcasted.fields[:price]
|
207
|
+
outcasted = Outcasted.new
|
208
|
+
output = outcasted.outcast(:price, original, {input_name_prefix: 'data'})
|
209
|
+
assert_nil outcasted.price
|
210
|
+
assert_nil output[:input_value]
|
211
|
+
end
|
212
|
+
|
213
|
+
end
|
214
|
+
|
195
215
|
describe '#outcast_attachment' do
|
196
216
|
|
197
217
|
it 'Sets url' do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: populate-me
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mickael Riga
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-02-
|
11
|
+
date: 2018-02-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: web-utils
|