utf8_enforcer_workaround 1.0.1 → 1.1.0
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.
- data/Appraisals +6 -1
- data/README.md +7 -2
- data/features/compliant_browser.feature +1 -0
- data/features/step_definitions/rails_steps.rb +1 -10
- data/features/step_definitions/utf8_enforcer_workaround_steps.rb +6 -2
- data/features/support/env.rb +15 -0
- data/features/support/rails.rb +16 -4
- data/gemfiles/{Rails32.gemfile → rails3.2.gemfile} +0 -0
- data/gemfiles/rails4.0.gemfile +8 -0
- data/lib/utf8_enforcer_workaround/version.rb +1 -1
- data/utf8_enforcer_workaround.gemspec +1 -0
- metadata +23 -8
- data/features/support/user_agent.rb +0 -14
data/Appraisals
CHANGED
data/README.md
CHANGED
@@ -8,7 +8,12 @@ browsers.
|
|
8
8
|
Requirements
|
9
9
|
------------
|
10
10
|
|
11
|
-
`utf8_enforcer_workaround` depends on Rails
|
11
|
+
`utf8_enforcer_workaround` depends on Rails and `browser`
|
12
|
+
|
13
|
+
### Supported Rails versions
|
14
|
+
|
15
|
+
* Rails 3.x
|
16
|
+
* Rails 4.x
|
12
17
|
|
13
18
|
Installation
|
14
19
|
------------
|
@@ -53,6 +58,6 @@ Contributing
|
|
53
58
|
Copyright
|
54
59
|
---------
|
55
60
|
|
56
|
-
Copyright (c)
|
61
|
+
Copyright (c) 2013 Jarl Friis. See LICENSE.txt for
|
57
62
|
further details.
|
58
63
|
|
@@ -1,16 +1,8 @@
|
|
1
1
|
Given /^I generate a new rails application$/ do
|
2
2
|
steps %{
|
3
|
-
When I run `bundle exec #{new_application_command}
|
3
|
+
When I run `bundle exec #{new_application_command(APP_NAME)} `
|
4
4
|
And I cd to "#{APP_NAME}"
|
5
5
|
And I turn off class caching
|
6
|
-
And I write to "Gemfile" with:
|
7
|
-
"""
|
8
|
-
source "http://rubygems.org"
|
9
|
-
gem "rails", "#{framework_version}"
|
10
|
-
gem "sqlite3"
|
11
|
-
gem "capybara"
|
12
|
-
gem "gherkin"
|
13
|
-
"""
|
14
6
|
And I configure the application to use "utf8_enforcer_workaround" from this project
|
15
7
|
And I reset Bundler environment variable
|
16
8
|
And I successfully run `bundle install --local`
|
@@ -147,7 +139,6 @@ end
|
|
147
139
|
|
148
140
|
When /^I configure the application to use "([^\"]+)" from this project$/ do |name|
|
149
141
|
append_to_gemfile "gem '#{name}', :path => '#{PROJECT_ROOT}'"
|
150
|
-
steps %{And I run `bundle install --local`}
|
151
142
|
end
|
152
143
|
|
153
144
|
When /^I configure the application to use "([^\"]+)"$/ do |gem_name|
|
@@ -10,6 +10,10 @@ Then /there is (a|no) utf8 input tag/ do |exists|
|
|
10
10
|
end
|
11
11
|
end
|
12
12
|
|
13
|
-
|
14
|
-
|
13
|
+
Given /I use Internet Explorer/ do
|
14
|
+
Capybara.current_driver = :rack_test_non_compliant
|
15
|
+
end
|
16
|
+
|
17
|
+
Given /I use a compliant browser/ do
|
18
|
+
Capybara.current_driver = :rack_test_non_compliant
|
15
19
|
end
|
data/features/support/env.rb
CHANGED
@@ -18,3 +18,18 @@ end
|
|
18
18
|
#require 'utf8_enforcer_workaround'
|
19
19
|
|
20
20
|
#require 'rspec/expectations'
|
21
|
+
Capybara.register_driver(:rack_test_compliant) do |app|
|
22
|
+
agent_string = 'Firefox'
|
23
|
+
Capybara::RackTest::Driver.new(app, headers: {
|
24
|
+
'User-Agent' => agent_string, ##Rails 3.x
|
25
|
+
'HTTP_USER_AGENT' => agent_string ##Rails 4.x
|
26
|
+
})
|
27
|
+
end
|
28
|
+
|
29
|
+
Capybara.register_driver(:rack_test_non_compliant) do |app|
|
30
|
+
agent_string = 'Mozilla/5.0 (compatible; MSIE 6.0; Windows NT 5.1)'
|
31
|
+
Capybara::RackTest::Driver.new(app, headers: {
|
32
|
+
'User-Agent' => agent_string, ##Rails 3.x
|
33
|
+
'HTTP_USER_AGENT' => agent_string ##Rails 4.x
|
34
|
+
})
|
35
|
+
end
|
data/features/support/rails.rb
CHANGED
@@ -31,16 +31,28 @@ module RailsCommandHelpers
|
|
31
31
|
@framework_version ||= `rails -v`[/^Rails (.+)$/, 1]
|
32
32
|
end
|
33
33
|
|
34
|
-
def new_application_command
|
35
|
-
framework_version
|
34
|
+
def new_application_command(name)
|
35
|
+
case framework_version
|
36
|
+
when /^2/ then "rails #{name}"
|
37
|
+
when /^3/ then "rails new #{name}"
|
38
|
+
when /^4/ then "rails new #{name} --skip-sprockets --skip-javascript"
|
39
|
+
end
|
36
40
|
end
|
37
41
|
|
38
42
|
def generator_command
|
39
|
-
framework_version
|
43
|
+
case framework_version
|
44
|
+
when /^2/ then "script/generate"
|
45
|
+
when /^3/ then "script/rails generate"
|
46
|
+
when /^4/ then "rails generate"
|
47
|
+
end
|
40
48
|
end
|
41
49
|
|
42
50
|
def runner_command
|
43
|
-
framework_version
|
51
|
+
case framework_version
|
52
|
+
when /^2/ then "script/runner"
|
53
|
+
when /^3/ then "script/rails runner"
|
54
|
+
when /^4/ then "rails runner"
|
55
|
+
end
|
44
56
|
end
|
45
57
|
end
|
46
58
|
|
File without changes
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: utf8_enforcer_workaround
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-08-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -155,6 +155,22 @@ dependencies:
|
|
155
155
|
- - ! '>='
|
156
156
|
- !ruby/object:Gem::Version
|
157
157
|
version: '0'
|
158
|
+
- !ruby/object:Gem::Dependency
|
159
|
+
name: launchy
|
160
|
+
requirement: !ruby/object:Gem::Requirement
|
161
|
+
none: false
|
162
|
+
requirements:
|
163
|
+
- - ! '>='
|
164
|
+
- !ruby/object:Gem::Version
|
165
|
+
version: '0'
|
166
|
+
type: :development
|
167
|
+
prerelease: false
|
168
|
+
version_requirements: !ruby/object:Gem::Requirement
|
169
|
+
none: false
|
170
|
+
requirements:
|
171
|
+
- - ! '>='
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: '0'
|
158
174
|
description: Make utf8_enforcer to be applied only for non-standards-complying browsers.
|
159
175
|
email:
|
160
176
|
- jarl@softace.dk
|
@@ -177,8 +193,8 @@ files:
|
|
177
193
|
- features/support/paths.rb
|
178
194
|
- features/support/rails.rb
|
179
195
|
- features/support/selectors.rb
|
180
|
-
-
|
181
|
-
- gemfiles/
|
196
|
+
- gemfiles/rails3.2.gemfile
|
197
|
+
- gemfiles/rails4.0.gemfile
|
182
198
|
- lib/utf8_enforcer_workaround.rb
|
183
199
|
- lib/utf8_enforcer_workaround/action_controller/base.rb
|
184
200
|
- lib/utf8_enforcer_workaround/action_view/helpers/form_tag_helper.rb
|
@@ -198,7 +214,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
198
214
|
version: '0'
|
199
215
|
segments:
|
200
216
|
- 0
|
201
|
-
hash:
|
217
|
+
hash: 1309340087898795168
|
202
218
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
203
219
|
none: false
|
204
220
|
requirements:
|
@@ -207,10 +223,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
207
223
|
version: '0'
|
208
224
|
segments:
|
209
225
|
- 0
|
210
|
-
hash:
|
226
|
+
hash: 1309340087898795168
|
211
227
|
requirements: []
|
212
228
|
rubyforge_project: utf8_enforcer_workaround
|
213
|
-
rubygems_version: 1.8.
|
229
|
+
rubygems_version: 1.8.23
|
214
230
|
signing_key:
|
215
231
|
specification_version: 3
|
216
232
|
summary: Make utf8_enforcer to be applied only for non-standards-complying browsers.
|
@@ -224,4 +240,3 @@ test_files:
|
|
224
240
|
- features/support/paths.rb
|
225
241
|
- features/support/rails.rb
|
226
242
|
- features/support/selectors.rb
|
227
|
-
- features/support/user_agent.rb
|
@@ -1,14 +0,0 @@
|
|
1
|
-
# https://gist.github.com/358664 (by aslakhellesoy)
|
2
|
-
module RackHeaderHack
|
3
|
-
def set_headers(headers)
|
4
|
-
driver = page.driver.browser
|
5
|
-
def driver.env
|
6
|
-
@env.merge(super)
|
7
|
-
end
|
8
|
-
def driver.env=(env)
|
9
|
-
@env = env
|
10
|
-
end
|
11
|
-
driver.env = headers
|
12
|
-
end
|
13
|
-
end
|
14
|
-
World(RackHeaderHack)
|