ramen-rails 0.1.3 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ramen-rails/ramen_after_filter.rb +11 -0
- data/lib/ramen-rails/version.rb +1 -1
- data/spec/lib/ramen_after_filter_spec.rb +14 -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: 938ed07e07491d1f7823571471a88e0a373dd34e
|
4
|
+
data.tar.gz: 6c8dd0a2b1f1af76ff0ea56650322cc3542d88b3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 637a2e1e2da0a1f5d6820b4d0c9743570ec950b7fabf55ad347eada81da5df24e89473622f6b8450c732a91c09579e177a8e1aa44809bf2a0104914ff2df9e23
|
7
|
+
data.tar.gz: 76591af04bd28c872dd6e18cddfde6e72a10debd9780cc5884e62d35d3484041d2b3069c17a4d71cd548457d62dfce4fb8b6b9ce7a6af03db3650e36be3f897f
|
@@ -4,6 +4,10 @@ module RamenRails
|
|
4
4
|
def add_ramen_script_tag
|
5
5
|
RamenAfterFilter.filter(self)
|
6
6
|
end
|
7
|
+
|
8
|
+
def ramen_script_tag_options
|
9
|
+
@ramen_script_tag_options || {}
|
10
|
+
end
|
7
11
|
end
|
8
12
|
|
9
13
|
class RamenAfterFilter
|
@@ -26,6 +30,10 @@ module RamenRails
|
|
26
30
|
@controller = kontroller
|
27
31
|
end
|
28
32
|
|
33
|
+
def ramen_script_tag_options
|
34
|
+
controller.ramen_script_tag_options
|
35
|
+
end
|
36
|
+
|
29
37
|
def include_javascript!
|
30
38
|
response.body = response.body.gsub(CLOSING_BODY_TAG, ramen_script_tag + '\\0')
|
31
39
|
end
|
@@ -165,6 +173,9 @@ module RamenRails
|
|
165
173
|
obj[:user][:labels] = ramen_user_labels unless ramen_user_labels.nil?
|
166
174
|
obj[:custom_links] = ramen_custom_links if ramen_custom_links.present?
|
167
175
|
|
176
|
+
|
177
|
+
obj = obj.deep_merge(ramen_script_tag_options) if ramen_script_tag_options.present?
|
178
|
+
|
168
179
|
super(obj, organization_secret: ramen_org_secret)
|
169
180
|
|
170
181
|
rescue InvalidUserObject => e
|
data/lib/ramen-rails/version.rb
CHANGED
@@ -77,6 +77,20 @@ describe 'After filter' do
|
|
77
77
|
end
|
78
78
|
end
|
79
79
|
|
80
|
+
context "and ramen_script_tag_options" do
|
81
|
+
before :each do |c|
|
82
|
+
@dummy.ramen_script_tag_options = {survey_id: 'survey_ryan'}
|
83
|
+
end
|
84
|
+
|
85
|
+
it "should include value in output" do
|
86
|
+
filter = RamenRails::RamenAfterFilter.filter(@dummy)
|
87
|
+
|
88
|
+
expect(@dummy.response.body).to include("survey_ryan")
|
89
|
+
expect(@dummy.response.body).to include("survey_id")
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
|
80
94
|
it "should include value in output" do
|
81
95
|
filter = RamenRails::RamenAfterFilter.filter(@dummy)
|
82
96
|
|
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.2.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-05-
|
11
|
+
date: 2015-05-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionpack
|