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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 292dedebe37ea6d43abc9f6da0c8391936fd35bc
4
- data.tar.gz: da2d1273bf8b03e205b8b790b3c932fa7fbb7fd5
3
+ metadata.gz: 5aeab72bc4510be9f7e4e02b533cfcfa5b0791d8
4
+ data.tar.gz: 866c15e4ae0c66ac0a052b92aaf5c0f8e15f02da
5
5
  SHA512:
6
- metadata.gz: 17854a7e4ae7c4136dcc1651143fa832f615b082a4bb75e9e9e6408aa8b481352cc11a6eec68a6047983decf408a8bd888de9c269e23faa12c6b8272ae6c0da2
7
- data.tar.gz: 3b338a49b73ca2a7f6879262ab4d0d37cef2228fca5cb428f7bf86a153787126b5b79e95fec9d82e8ffcf6e21d6fbb12ee136a6b018b5c96b9ed0d9800d89522
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.disabled_environment?
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 include_javascript?
59
- !ramen_script_tag_called_manually? &&
58
+ def include_disabled_comment?
59
+ disabled_environment? &&
60
60
  html_content_type? &&
61
- response_has_closing_body_tag? &&
62
- enabled_environment? &&
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
- ramen_user_object.present?
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
@@ -1,3 +1,3 @@
1
1
  module RamenRails
2
- VERSION = "0.7.1"
2
+ VERSION = "0.7.2"
3
3
  end
@@ -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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ramen-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.1
4
+ version: 0.7.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Angilly