model_presenter 0.1.2 → 0.1.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 +4 -4
- data/.travis.yml +1 -0
- data/README.md +4 -0
- data/lib/model_presenter/version.rb +1 -1
- data/spec/support/macros/as_json.rb +3 -3
- data/spec/support/macros/forward_from_model.rb +3 -3
- data/spec/support/macros/it_moneyize.rb +2 -2
- metadata +2 -4
- data/.rvmrc.template +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8960243c323183854459572fb01f3ce2603ccb3c
|
4
|
+
data.tar.gz: 39db1860055cbb03b98bf9f4d25df328d19c4028
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1712e978c6de27ac0103298c6610acb2b2f7c2110b25d4d7cdcaf7898b394580078a3793d7e87538f93b4c66f3915606f9c1d63796b52ecc0d4d531711f2705d
|
7
|
+
data.tar.gz: 24f63f700a640f5ec417ea14f262c94b8bf1e3d7e88475ae6b79992b236f29ddff69140c1553910fd463df344afbd117d9d73f2a91283e7e72c8e259e6e2e886
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -174,3 +174,7 @@ User
|
|
174
174
|
3. Commit your changes (`git commit -am 'Added some feature'`)
|
175
175
|
4. Push to the branch (`git push origin my-new-feature`)
|
176
176
|
5. Create new Pull Request
|
177
|
+
|
178
|
+
|
179
|
+
[](https://bitdeli.com/free "Bitdeli Badge")
|
180
|
+
|
@@ -3,14 +3,14 @@ module ModelPresenter
|
|
3
3
|
module Macros
|
4
4
|
def as_json_attributes(*keys)
|
5
5
|
describe "#as_json" do
|
6
|
-
let(:result) {
|
6
|
+
let(:result) { presenter.as_json }
|
7
7
|
keys.each do |key|
|
8
8
|
context "having the key #{key}"
|
9
9
|
it "has the key #{key} with value set to presenter.#{key}" do
|
10
10
|
if result[key].respond_to?(:should)
|
11
|
-
result[key].
|
11
|
+
expect(result[key]).to eq(presenter.send(key))
|
12
12
|
else
|
13
|
-
expect(result[key]).to eq(
|
13
|
+
expect(result[key]).to eq(presenter.send(key))
|
14
14
|
end
|
15
15
|
end
|
16
16
|
end
|
@@ -5,10 +5,10 @@ module ModelPresenter
|
|
5
5
|
attributes.each do |attribute|
|
6
6
|
describe "##{attribute}" do
|
7
7
|
it "returns the model.#{attribute}" do
|
8
|
-
model.
|
9
|
-
result =
|
8
|
+
allow(model).to receive(attribute).and_return(attribute)
|
9
|
+
result = presenter.send(attribute)
|
10
10
|
if result.respond_to?(:should)
|
11
|
-
result.
|
11
|
+
expect(result).to eq(model.send(attribute))
|
12
12
|
else
|
13
13
|
expect(result).to eq(model.send(attribute))
|
14
14
|
end
|
@@ -3,8 +3,8 @@ module Macros
|
|
3
3
|
def it_moneyize(*fields)
|
4
4
|
fields.each do |field|
|
5
5
|
describe "#formatted_#{field}" do
|
6
|
-
let(:expected) {
|
7
|
-
let(:actual) { "$ #{
|
6
|
+
let(:expected) { presenter.send("formatted_#{field}") }
|
7
|
+
let(:actual) { "$ #{presenter.send(field).to_f/100}" }
|
8
8
|
it "returns the formatted money in dollar" do
|
9
9
|
expect(expected).to eq( actual )
|
10
10
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: model_presenter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yi Wen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-03-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
@@ -133,7 +133,6 @@ files:
|
|
133
133
|
- .gitignore
|
134
134
|
- .rbenv-version
|
135
135
|
- .ruby-version
|
136
|
-
- .rvmrc.template
|
137
136
|
- .travis.yml
|
138
137
|
- CHANGELOG.md
|
139
138
|
- Gemfile
|
@@ -202,4 +201,3 @@ test_files:
|
|
202
201
|
- test/support/mock_base_class.rb
|
203
202
|
- test/support/mock_model_object.rb
|
204
203
|
- test/test_helper.rb
|
205
|
-
has_rdoc:
|
data/.rvmrc.template
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
rvm 1.9.3@model_presenter
|