ramen-rails 0.5.1 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +3 -0
- data/lib/ramen-rails/ramen_after_filter.rb +9 -1
- data/lib/ramen-rails/version.rb +1 -1
- data/spec/lib/ramen_after_filter_spec.rb +30 -4
- 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: 739a8cfacae68879c56af820125300e74c57b518
|
4
|
+
data.tar.gz: 76475fc30d26b8dcd1470fbc54f1d37b1a1505b4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 96fbb2673a786c57e93bdcb03f9e027b3c39dcd858a7e70dbe1bf5c9befd23bd488bed345bb024d223acc6adb4e5e07bafc8152a21f1aaf3fa41dc765d7c111d
|
7
|
+
data.tar.gz: 17533a7f642eb7e3b8a39666035a250b0c16de1e35bd7070c4f680a884fdbe075ac0acbbbdaa76ff749e4c0afefb8b13c7e577d0968f76d553c0325bcea00acc
|
data/CHANGELOG
CHANGED
@@ -200,6 +200,10 @@ module RamenRails
|
|
200
200
|
if user.respond_to?(:created_at) && user.send(:created_at).present?
|
201
201
|
obj[:user][:created_at] = user.send(:created_at).to_i
|
202
202
|
end
|
203
|
+
|
204
|
+
if user.respond_to?(:traits) && user.send(:traits).present?
|
205
|
+
obj[:user][:traits] = user.send(:traits)
|
206
|
+
end
|
203
207
|
|
204
208
|
obj[:user][:value] = ramen_user_value if ramen_user_value.present?
|
205
209
|
obj[:user][:labels] = ramen_user_labels unless ramen_user_labels.nil?
|
@@ -212,7 +216,11 @@ module RamenRails
|
|
212
216
|
[:url, :name, :id].each do |attr|
|
213
217
|
obj[:company][attr] = company.send(attr)
|
214
218
|
end
|
215
|
-
|
219
|
+
|
220
|
+
if company.respond_to?(:traits) && company.send(:traits).present?
|
221
|
+
obj[:company][:traits] = company.send(:traits)
|
222
|
+
end
|
223
|
+
|
216
224
|
obj[:company][:labels] = ramen_company_labels unless ramen_company_labels.nil?
|
217
225
|
end
|
218
226
|
|
data/lib/ramen-rails/version.rb
CHANGED
@@ -99,6 +99,18 @@ describe 'After filter' do
|
|
99
99
|
|
100
100
|
end
|
101
101
|
|
102
|
+
context "that responds to traits" do
|
103
|
+
before :each do
|
104
|
+
@dummy.current_user.traits = {bucket: 6, is_friend: true, original_name: "Netflix"}
|
105
|
+
end
|
106
|
+
|
107
|
+
it "should attach traits to company" do
|
108
|
+
filter = RamenRails::RamenAfterFilter.filter(@dummy)
|
109
|
+
expect(@dummy.response.body).to include('"is_friend":true')
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
|
102
114
|
context "that responds to created_at" do
|
103
115
|
before :each do
|
104
116
|
@time = Time.new(2014, 11, 10)
|
@@ -170,8 +182,7 @@ describe 'After filter' do
|
|
170
182
|
end
|
171
183
|
end
|
172
184
|
|
173
|
-
context "and a company" do
|
174
|
-
|
185
|
+
context "and a company" do
|
175
186
|
context "that has no id" do
|
176
187
|
before :each do
|
177
188
|
RamenRails.config do |c|
|
@@ -194,7 +205,22 @@ describe 'After filter' do
|
|
194
205
|
before :each do
|
195
206
|
RamenRails.config do |c|
|
196
207
|
c.current_company = Proc.new { Hashie::Mash.new(id: "1245", name: 'Scrubber', url: 'https://scrubber.social') }
|
197
|
-
c.current_company_labels = Proc.new { ["ryan", "
|
208
|
+
c.current_company_labels = Proc.new { ["ryan", "goldzz"] }
|
209
|
+
end
|
210
|
+
end
|
211
|
+
|
212
|
+
context "and traits" do
|
213
|
+
before :each do
|
214
|
+
RamenRails.config do |c|
|
215
|
+
c.current_company = Proc.new {
|
216
|
+
Hashie::Mash.new(id: "1245", name: 'Scrubber', url: 'https://scrubber.social', traits: {plan: 'startup'})
|
217
|
+
}
|
218
|
+
end
|
219
|
+
end
|
220
|
+
|
221
|
+
it "should attach traits to company" do
|
222
|
+
filter = RamenRails::RamenAfterFilter.filter(@dummy)
|
223
|
+
expect(@dummy.response.body).to include('"plan":"startup"')
|
198
224
|
end
|
199
225
|
end
|
200
226
|
|
@@ -205,7 +231,7 @@ describe 'After filter' do
|
|
205
231
|
expect(@dummy.response.body).to include("company")
|
206
232
|
expect(@dummy.response.body).to include("Scrubber")
|
207
233
|
expect(@dummy.response.body).to include("1245")
|
208
|
-
expect(@dummy.response.body).to include("
|
234
|
+
expect(@dummy.response.body).to include("goldzz")
|
209
235
|
end
|
210
236
|
end
|
211
237
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ramen-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Angilly
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-07-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionpack
|