rails_amp 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +13 -0
- data/README.md +1 -1
- data/gemfiles/Gemfile-rails.4.1.x +1 -1
- data/gemfiles/Gemfile-rails.4.2.x +1 -1
- data/lib/rails_amp/config.rb +2 -0
- data/lib/rails_amp/version.rb +1 -1
- data/spec/controllers/application_controller_spec.rb +7 -26
- data/spec/dummy/app/assets/javascripts/cable.js +0 -1
- data/spec/dummy/app/controllers/users_controller.rb +0 -2
- data/spec/dummy/app/views/users/index.html.erb +0 -6
- data/spec/dummy/app/views/users/show.html.erb +0 -3
- data/spec/dummy/config/application.rb +2 -2
- data/spec/dummy/config/environments/test.rb +5 -5
- data/spec/dummy/config/initializers/new_framework_defaults.rb +6 -6
- data/spec/dummy/config/initializers/wrap_parameters.rb +1 -1
- data/spec/dummy/db/migrate/20170130074559_create_users.rb +1 -1
- data/spec/dummy/db/schema.rb +2 -2
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0ad444c3a645c549cba96965c0ab6c46c93e80a4
|
4
|
+
data.tar.gz: 87e3891260c56b7034b8918815ec99e792a53efe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 36f2877b2a096be0eb2a5cc83f7eaf1c77e90c8efa6a711f516df2f0a578f9e84bbe1bcffaa53e835e0ab9762749a1eaf715280a2396261bb7b4354f4c52a59e
|
7
|
+
data.tar.gz: 28f6848404a59db9e7f6fcdc8798bdcb7652b935b7430798a52743bf2531352a53aa01bf44a158e320aeabb813010d632b8985f0e9f39f2d8b8af25e5b11e8aa
|
data/.travis.yml
ADDED
data/README.md
CHANGED
data/lib/rails_amp/config.rb
CHANGED
data/lib/rails_amp/version.rb
CHANGED
@@ -62,14 +62,14 @@ describe UsersController do
|
|
62
62
|
it 'has normal image tag' do
|
63
63
|
get 'index'
|
64
64
|
expect(image_tag('rails.png', {size: '30x20', border: '0'})).to match(
|
65
|
-
%r(<img border="0" src="/(images|assets)/rails-?\w*?.
|
65
|
+
%r{(<img border="0" src="/(images|assets)/rails-?\w*?.png" alt="Rails" width="30" height="20" />)|(<img alt="Rails" border="0" height="20" src="/(images|assets)/rails-?\w*?.png" width="30" />)}
|
66
66
|
)
|
67
67
|
expect(image_tag('rails.png')).to match(
|
68
|
-
%r(<img src="/(images|assets)/rails-?\w*?.
|
68
|
+
%r{(<img src="/(images|assets)/rails-?\w*?.png" alt="Rails" />)|(<img alt="Rails" src="/(images|assets)/rails-?\w*?.png" />)}
|
69
69
|
)
|
70
70
|
# According to dummy app default view `home/_amp_info`
|
71
71
|
expect(response.body).to match(
|
72
|
-
%r(<img border="0" src="/(images|assets)/rails-?\w*?.
|
72
|
+
%r{(<img border="0" src="/(images|assets)/rails-?\w*?.png" alt="Rails" width="30" height="20" />)|(<img alt="Rails" border="0" height="20" src="/(images|assets)/rails-?\w*?.png" width="30" />)}
|
73
73
|
)
|
74
74
|
end
|
75
75
|
end
|
@@ -83,37 +83,18 @@ describe UsersController do
|
|
83
83
|
it 'has amp-img tag' do
|
84
84
|
get 'index', format: RailsAmp.default_format.to_s
|
85
85
|
expect(image_tag('rails.png', {size: '30x20', border: '0'})).to match(
|
86
|
-
%r(<amp-img src="/(images|assets)/rails-?\w*?.
|
86
|
+
%r{(<amp-img src="/(images|assets)/rails-?\w*?.png" alt="Rails" width="30" height="20" layout="fixed" /></amp-img>)|(<amp-img alt="Rails" height="20" layout="fixed" src="/(images|assets)/rails-?\w*?.png" width="30" /></amp-img>)}
|
87
87
|
)
|
88
|
-
# `width="400" height="400"` is removed because request.base_url returns dummy url for test.
|
89
88
|
expect(image_tag('rails.png')).to match(
|
90
|
-
%r(<amp-img src="/(images|assets)/rails-?\w*?.
|
89
|
+
%r{(<amp-img src="/(images|assets)/rails-?\w*?.png" alt="Rails" width="50" height="64" layout="fixed" /></amp-img>)|(<amp-img alt="Rails" height="64" layout="fixed" src="/(images|assets)/rails-?\w*?.png" width="50" /></amp-img>)}
|
91
90
|
)
|
92
91
|
# According to dummy app default view `home/_amp_info`
|
93
92
|
expect(response.body).to match(
|
94
|
-
%r(<amp-img src="/(images|assets)/rails-?\w*?.
|
93
|
+
%r{(<amp-img src="/(images|assets)/rails-?\w*?.png" alt="Rails" width="30" height="20" layout="fixed" /></amp-img>)|(<amp-img alt="Rails" height="20" layout="fixed" src="/(images|assets)/rails-?\w*?.png" width="30" /></amp-img>)}
|
95
94
|
)
|
96
95
|
end
|
97
96
|
end
|
98
97
|
end
|
99
|
-
|
100
|
-
context '#show GET' do
|
101
|
-
let(:user) { User.create(name: 'Taro', email: 'taro@example.com') }
|
102
|
-
|
103
|
-
context 'with html format' do
|
104
|
-
it 'is not renderable by amp' do
|
105
|
-
get 'show', params: {id: user.id}
|
106
|
-
expect(amp_renderable?).to eq false
|
107
|
-
end
|
108
|
-
end
|
109
|
-
|
110
|
-
context 'with amp format' do
|
111
|
-
it 'is renderable by amp' do
|
112
|
-
get 'show', format: RailsAmp.default_format.to_s, params: {id: user.id}
|
113
|
-
expect(amp_renderable?).to eq true
|
114
|
-
end
|
115
|
-
end
|
116
|
-
end
|
117
98
|
end
|
118
99
|
|
119
100
|
describe HomeController do
|
@@ -135,7 +116,7 @@ describe HomeController do
|
|
135
116
|
it 'is not renderable by amp' do
|
136
117
|
expect do
|
137
118
|
get 'help', format: RailsAmp.default_format.to_s
|
138
|
-
end.to raise_error(ActionController::UnknownFormat
|
119
|
+
end.to raise_error(StandardError) # ActionView::MissingTemplate or ActionController::UnknownFormat
|
139
120
|
end
|
140
121
|
end
|
141
122
|
end
|
@@ -5,8 +5,8 @@ require "active_record/railtie"
|
|
5
5
|
require "action_controller/railtie"
|
6
6
|
require "action_view/railtie"
|
7
7
|
require "action_mailer/railtie"
|
8
|
-
require "active_job/railtie"
|
9
|
-
require "action_cable/engine"
|
8
|
+
# require "active_job/railtie"
|
9
|
+
# require "action_cable/engine"
|
10
10
|
# require "rails/test_unit/railtie"
|
11
11
|
require "sprockets/railtie"
|
12
12
|
|
@@ -13,10 +13,10 @@ Rails.application.configure do
|
|
13
13
|
config.eager_load = false
|
14
14
|
|
15
15
|
# Configure public file server for tests with Cache-Control for performance.
|
16
|
-
config.public_file_server.enabled = true
|
17
|
-
config.public_file_server.headers = {
|
18
|
-
|
19
|
-
}
|
16
|
+
# config.public_file_server.enabled = true
|
17
|
+
# config.public_file_server.headers = {
|
18
|
+
# 'Cache-Control' => 'public, max-age=3600'
|
19
|
+
# }
|
20
20
|
|
21
21
|
# Show full error reports and disable caching.
|
22
22
|
config.consider_all_requests_local = true
|
@@ -27,7 +27,7 @@ Rails.application.configure do
|
|
27
27
|
|
28
28
|
# Disable request forgery protection in test environment.
|
29
29
|
config.action_controller.allow_forgery_protection = false
|
30
|
-
config.action_mailer.perform_caching = false
|
30
|
+
# config.action_mailer.perform_caching = false
|
31
31
|
|
32
32
|
# Tell Action Mailer not to deliver emails to the real world.
|
33
33
|
# The :test delivery method accumulates sent emails in the
|
@@ -5,20 +5,20 @@
|
|
5
5
|
# Read the Guide for Upgrading Ruby on Rails for more info on each option.
|
6
6
|
|
7
7
|
# Enable per-form CSRF tokens. Previous versions had false.
|
8
|
-
Rails.application.config.action_controller.per_form_csrf_tokens = true
|
8
|
+
# Rails.application.config.action_controller.per_form_csrf_tokens = true
|
9
9
|
|
10
10
|
# Enable origin-checking CSRF mitigation. Previous versions had false.
|
11
|
-
Rails.application.config.action_controller.forgery_protection_origin_check = true
|
11
|
+
# Rails.application.config.action_controller.forgery_protection_origin_check = true
|
12
12
|
|
13
13
|
# Make Ruby 2.4 preserve the timezone of the receiver when calling `to_time`.
|
14
14
|
# Previous versions had false.
|
15
|
-
ActiveSupport.to_time_preserves_timezone = true
|
15
|
+
# ActiveSupport.to_time_preserves_timezone = true
|
16
16
|
|
17
17
|
# Require `belongs_to` associations by default. Previous versions had false.
|
18
|
-
Rails.application.config.active_record.belongs_to_required_by_default = true
|
18
|
+
# Rails.application.config.active_record.belongs_to_required_by_default = true
|
19
19
|
|
20
20
|
# Do not halt callback chains when a callback returns false. Previous versions had true.
|
21
|
-
ActiveSupport.halt_callback_chains_on_return_false = false
|
21
|
+
# ActiveSupport.halt_callback_chains_on_return_false = false
|
22
22
|
|
23
23
|
# Configure SSL options to enable HSTS with subdomains. Previous versions had false.
|
24
|
-
Rails.application.config.ssl_options = { hsts: { subdomains: true } }
|
24
|
+
# Rails.application.config.ssl_options = { hsts: { subdomains: true } }
|
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
|
7
7
|
ActiveSupport.on_load(:action_controller) do
|
8
|
-
wrap_parameters format: [:json]
|
8
|
+
wrap_parameters format: [:json] if respond_to?(:wrap_parameters)
|
9
9
|
end
|
10
10
|
|
11
11
|
# To enable root element in JSON for ActiveRecord objects.
|
data/spec/dummy/db/schema.rb
CHANGED
@@ -15,8 +15,8 @@ ActiveRecord::Schema.define(version: 20170130074559) do
|
|
15
15
|
create_table "users", force: :cascade do |t|
|
16
16
|
t.string "name"
|
17
17
|
t.string "email"
|
18
|
-
t.datetime "created_at"
|
19
|
-
t.datetime "updated_at"
|
18
|
+
t.datetime "created_at"
|
19
|
+
t.datetime "updated_at"
|
20
20
|
end
|
21
21
|
|
22
22
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_amp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Takafumi Yamano
|
@@ -75,6 +75,7 @@ extensions: []
|
|
75
75
|
extra_rdoc_files: []
|
76
76
|
files:
|
77
77
|
- ".gitignore"
|
78
|
+
- ".travis.yml"
|
78
79
|
- Gemfile
|
79
80
|
- MIT-LICENSE
|
80
81
|
- README.md
|