ramen-rails 0.7.1 → 0.7.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +6 -0
- data/lib/ramen-rails/ramen_after_filter.rb +13 -7
- data/lib/ramen-rails/version.rb +1 -1
- data/spec/lib/ramen_after_filter_spec.rb +12 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5aeab72bc4510be9f7e4e02b533cfcfa5b0791d8
|
4
|
+
data.tar.gz: 866c15e4ae0c66ac0a052b92aaf5c0f8e15f02da
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5482f571796e3dd98590a3e0888ab2d176b27c384d1a369ecf14f1cf7d10490f2a4180c2a14eb2f9715f6c8b525ebbfc6a8b73337bf5c79d9ddfc7fb28607022
|
7
|
+
data.tar.gz: 885a775cbc1668c29cad7804761f9415ec3388a96acdcb2e351f05a699e73a3bb1ddbc0a6b3e00493e86c00409e05bff8b574a8cf11a72f13dd8881f4744ed7b
|
data/CHANGELOG
CHANGED
@@ -45,3 +45,9 @@ on selected environments.
|
|
45
45
|
|
46
46
|
Version 0.7.1
|
47
47
|
Because we yanked 0.7.0 to update this Changelog :)
|
48
|
+
|
49
|
+
Version 0.7.2
|
50
|
+
When an environment is disabled, we render a comment into the HTML saying "Ramen disabled
|
51
|
+
in this environment". This bug fix makes that only happenf for `text/html` content types.
|
52
|
+
|
53
|
+
We also made some performance improvements.
|
@@ -22,7 +22,7 @@ module RamenRails
|
|
22
22
|
|
23
23
|
if auto_include_filter.include_javascript?
|
24
24
|
auto_include_filter.include_javascript!
|
25
|
-
elsif auto_include_filter.
|
25
|
+
elsif auto_include_filter.include_disabled_comment?
|
26
26
|
auto_include_filter.include_disabled_comment!
|
27
27
|
end
|
28
28
|
end
|
@@ -55,13 +55,19 @@ module RamenRails
|
|
55
55
|
!enabled_environment?
|
56
56
|
end
|
57
57
|
|
58
|
-
def
|
59
|
-
|
58
|
+
def include_disabled_comment?
|
59
|
+
disabled_environment? &&
|
60
60
|
html_content_type? &&
|
61
|
-
response_has_closing_body_tag?
|
62
|
-
|
61
|
+
response_has_closing_body_tag?
|
62
|
+
end
|
63
|
+
|
64
|
+
def include_javascript?
|
65
|
+
enabled_environment? &&
|
66
|
+
ramen_user_object.present? &&
|
63
67
|
ramen_org_id.present? &&
|
64
|
-
|
68
|
+
html_content_type? &&
|
69
|
+
!ramen_script_tag_called_manually? &&
|
70
|
+
response_has_closing_body_tag?
|
65
71
|
end
|
66
72
|
|
67
73
|
private
|
@@ -74,7 +80,7 @@ module RamenRails
|
|
74
80
|
end
|
75
81
|
|
76
82
|
def response_has_closing_body_tag?
|
77
|
-
!!(response.body[CLOSING_BODY_TAG])
|
83
|
+
@_rhcbt ||= !!(response.body[CLOSING_BODY_TAG])
|
78
84
|
end
|
79
85
|
|
80
86
|
def logged_in_url
|
data/lib/ramen-rails/version.rb
CHANGED
@@ -125,6 +125,18 @@ describe 'After filter' do
|
|
125
125
|
expect(@dummy.response.body).to_not include("ramenSettings")
|
126
126
|
expect(@dummy.response.body).to include("Ramen not enabled for environment")
|
127
127
|
end
|
128
|
+
|
129
|
+
context "with a non-HTML content type" do
|
130
|
+
before :each do
|
131
|
+
@dummy.response.content_type = "application/json"
|
132
|
+
end
|
133
|
+
|
134
|
+
it "not render script tag or comment" do
|
135
|
+
filter = RamenRails::RamenAfterFilter.filter(@dummy)
|
136
|
+
expect(@dummy.response.body).to_not include("ramenSettings")
|
137
|
+
expect(@dummy.response.body).to_not include("Ramen not enabled for environment")
|
138
|
+
end
|
139
|
+
end
|
128
140
|
end
|
129
141
|
|
130
142
|
context "with a value proc set" do
|