mobile-enhancements 0.0.3 → 0.0.4
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/lib/mobile_enhancements/railtie.rb +2 -0
- data/lib/mobile_enhancements/version.rb +1 -1
- data/spec/controllers/test_controller_spec.rb +34 -8
- data/spec/internal/app/controllers/test_controller.rb +2 -0
- data/spec/internal/app/views/layouts/application.html.erb +1 -0
- data/spec/internal/app/views/layouts/application.mobile.erb +1 -0
- data/spec/internal/app/views/test/path_rendering.html.erb +1 -0
- data/spec/internal/app/views/test/path_rendering.mobile.erb +1 -0
- data/spec/internal/config/routes.rb +1 -0
- metadata +9 -1
@@ -12,6 +12,8 @@ module MobileEnhancements
|
|
12
12
|
ActionController::Base.send(:include, MobileEnhancements::HelperDelegation)
|
13
13
|
# setup the layout calculation
|
14
14
|
ActionController::Base.layout :determine_layout
|
15
|
+
# include the UrlHelper into action view
|
16
|
+
ActionView::Base.send(:include, UrlHelper)
|
15
17
|
# if we have a custom mobile format
|
16
18
|
if format = MobileEnhancements.configuration.mobile_format
|
17
19
|
# register it as an alias to the HTML mime-type
|
@@ -1,12 +1,26 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
3
|
describe TestController do
|
4
|
+
render_views
|
5
|
+
|
4
6
|
context "via the mobile UI" do
|
5
7
|
describe "GET /#{MobileEnhancements.configuration.mobile_path_prefix}/two" do
|
6
8
|
before { get :two, mobile: MobileEnhancements.configuration.mobile_path_prefix }
|
7
9
|
|
8
10
|
it "should render 'two, #{MobileEnhancements.configuration.mobile_format}'" do
|
9
|
-
expect(
|
11
|
+
expect(response.body).to eq "two, #{MobileEnhancements.configuration.mobile_format}"
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
describe "GET /#{MobileEnhancements.configuration.mobile_path_prefix}/path_rendering" do
|
16
|
+
before { get :path_rendering, mobile: MobileEnhancements.configuration.mobile_path_prefix }
|
17
|
+
|
18
|
+
it "should render a mobile path" do
|
19
|
+
expect(response.body).to eq "/#{MobileEnhancements.configuration.mobile_path_prefix}/two"
|
20
|
+
end
|
21
|
+
|
22
|
+
it "should render the path_rendering template" do
|
23
|
+
expect(response).to render_template "path_rendering"
|
10
24
|
end
|
11
25
|
end
|
12
26
|
|
@@ -14,7 +28,7 @@ describe TestController do
|
|
14
28
|
before { get :path_checking, mobile: MobileEnhancements.configuration.mobile_path_prefix }
|
15
29
|
|
16
30
|
it "should render a mobile URL" do
|
17
|
-
expect(
|
31
|
+
expect(response.body).to eq "http://test.host/#{MobileEnhancements.configuration.mobile_path_prefix}/two"
|
18
32
|
end
|
19
33
|
end
|
20
34
|
|
@@ -22,7 +36,7 @@ describe TestController do
|
|
22
36
|
before { get :redirect_checking, mobile: MobileEnhancements.configuration.mobile_path_prefix }
|
23
37
|
|
24
38
|
it "should redirect to a mobile URL" do
|
25
|
-
expect(
|
39
|
+
expect(response).to redirect_to "http://test.host/#{MobileEnhancements.configuration.mobile_path_prefix}/two"
|
26
40
|
end
|
27
41
|
end
|
28
42
|
|
@@ -30,7 +44,7 @@ describe TestController do
|
|
30
44
|
before { get :fixed_redirect_checking, mobile: MobileEnhancements.configuration.mobile_path_prefix }
|
31
45
|
|
32
46
|
it "should redirect to a mobile URL" do
|
33
|
-
expect(
|
47
|
+
expect(response).to redirect_to "http://test.host/#{MobileEnhancements.configuration.mobile_path_prefix}/two"
|
34
48
|
end
|
35
49
|
end
|
36
50
|
end
|
@@ -40,7 +54,19 @@ describe TestController do
|
|
40
54
|
before { get :two }
|
41
55
|
|
42
56
|
it "should render 'two, html'" do
|
43
|
-
expect(
|
57
|
+
expect(response.body).to eq "two, html"
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
describe "GET /path_rendering" do
|
62
|
+
before { get :path_rendering }
|
63
|
+
|
64
|
+
it "should render a desktop path" do
|
65
|
+
expect(response.body).to eq "/two"
|
66
|
+
end
|
67
|
+
|
68
|
+
it "should render the path_rendering template" do
|
69
|
+
expect(response).to render_template "path_rendering"
|
44
70
|
end
|
45
71
|
end
|
46
72
|
|
@@ -48,7 +74,7 @@ describe TestController do
|
|
48
74
|
before { get :path_checking }
|
49
75
|
|
50
76
|
it "should render a desktop URL" do
|
51
|
-
expect(
|
77
|
+
expect(response.body).to eq "http://test.host/two"
|
52
78
|
end
|
53
79
|
end
|
54
80
|
|
@@ -56,7 +82,7 @@ describe TestController do
|
|
56
82
|
before { get :redirect_checking }
|
57
83
|
|
58
84
|
it "should redirect to a desktop URL" do
|
59
|
-
expect(
|
85
|
+
expect(response).to redirect_to "http://test.host/two"
|
60
86
|
end
|
61
87
|
end
|
62
88
|
|
@@ -64,7 +90,7 @@ describe TestController do
|
|
64
90
|
before { get :fixed_redirect_checking }
|
65
91
|
|
66
92
|
it "should redirect to a mobile URL" do
|
67
|
-
expect(
|
93
|
+
expect(response).to redirect_to "http://test.host/#{MobileEnhancements.configuration.mobile_path_prefix}/two"
|
68
94
|
end
|
69
95
|
end
|
70
96
|
end
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= yield %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= yield %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= optional_mobile_path %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= optional_mobile_path %>
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mobile-enhancements
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -150,6 +150,10 @@ files:
|
|
150
150
|
- mobile-enhancements.gemspec
|
151
151
|
- spec/controllers/test_controller_spec.rb
|
152
152
|
- spec/internal/app/controllers/test_controller.rb
|
153
|
+
- spec/internal/app/views/layouts/application.html.erb
|
154
|
+
- spec/internal/app/views/layouts/application.mobile.erb
|
155
|
+
- spec/internal/app/views/test/path_rendering.html.erb
|
156
|
+
- spec/internal/app/views/test/path_rendering.mobile.erb
|
153
157
|
- spec/internal/config/initializers/mobile_enhancements.rb
|
154
158
|
- spec/internal/config/routes.rb
|
155
159
|
- spec/mobile_enhancements/configuration_spec.rb
|
@@ -186,6 +190,10 @@ summary: A few features to aid Rails apps with separate mobile-targeted UIs.
|
|
186
190
|
test_files:
|
187
191
|
- spec/controllers/test_controller_spec.rb
|
188
192
|
- spec/internal/app/controllers/test_controller.rb
|
193
|
+
- spec/internal/app/views/layouts/application.html.erb
|
194
|
+
- spec/internal/app/views/layouts/application.mobile.erb
|
195
|
+
- spec/internal/app/views/test/path_rendering.html.erb
|
196
|
+
- spec/internal/app/views/test/path_rendering.mobile.erb
|
189
197
|
- spec/internal/config/initializers/mobile_enhancements.rb
|
190
198
|
- spec/internal/config/routes.rb
|
191
199
|
- spec/mobile_enhancements/configuration_spec.rb
|