mobylette 1.6.0 → 2.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/README.rdoc +35 -22
- data/Rakefile +0 -19
- data/lib/mobylette.rb +1 -4
- data/lib/mobylette/helmet.rb +0 -2
- data/lib/mobylette/railtie.rb +0 -6
- data/lib/mobylette/respond_to_mobile_requests.rb +135 -0
- data/lib/mobylette/version.rb +1 -1
- data/spec/controllers/application_controller_spec.rb +37 -0
- data/spec/dummy/app/controllers/application_controller.rb +0 -1
- data/spec/dummy/log/development.log +116 -0
- data/spec/dummy/log/test.log +21 -585
- data/spec/dummy/tmp/cache/assets/C82/3E0/sprockets%2F48eb4ac616538f8f36870451073315da +14 -0
- data/spec/dummy/tmp/cache/assets/CE4/1C0/sprockets%2F18d93e1533d585b2f64ec90b33176ac9 +0 -0
- data/spec/dummy/tmp/cache/assets/CED/A70/sprockets%2F621683d8791730a9cc7ce45e17a7e46d +0 -0
- data/spec/dummy/tmp/cache/assets/CFC/200/sprockets%2F716f89d85d4855706b8a9abec1969c62 +16 -0
- data/spec/dummy/tmp/cache/assets/D32/A10/sprockets%2F13fe41fee1fe35b49d145bcc06610705 +0 -0
- data/spec/dummy/tmp/cache/assets/D54/ED0/sprockets%2F71c9fa01091d432b131da3bb73faf3d4 +16 -0
- data/spec/dummy/tmp/cache/assets/D84/210/sprockets%2Fabd0103ccec2b428ac62c94e4c40b384 +14 -0
- data/spec/dummy/tmp/cache/assets/E04/890/sprockets%2F2f5173deea6c795b8fdde723bb4b63af +0 -0
- data/spec/lib/respond_to_mobile_requests_spec.rb +253 -0
- data/spec/spec_helper.rb +3 -0
- metadata +45 -107
- data/lib/mobylette/controllers/helpers.rb +0 -53
- data/lib/mobylette/controllers/respond_to_mobile_requests.rb +0 -125
- data/lib/mobylette/helmet/faker.rb +0 -19
- data/lib/mobylette/helmet/helpers.rb +0 -36
- data/spec/controllers/actioncontroller_base_spec.rb +0 -24
- data/spec/controllers/default_fallback_controller_spec.rb +0 -37
- data/spec/controllers/desktop_only_controller_spec.rb +0 -18
- data/spec/controllers/force_fallback_controller_spec.rb +0 -46
- data/spec/controllers/home_controller_spec.rb +0 -145
- data/spec/controllers/no_fallback_controller_spec.rb +0 -58
- data/spec/controllers/skip_xhr_request_controller_spec.rb +0 -19
- data/spec/dummy/app/controllers/default_fallback_controller.rb +0 -13
- data/spec/dummy/app/controllers/desktop_only_controller.rb +0 -2
- data/spec/dummy/app/controllers/fallbacks_controller.rb +0 -7
- data/spec/dummy/app/controllers/force_fallback_controller.rb +0 -13
- data/spec/dummy/app/controllers/home_controller.rb +0 -20
- data/spec/dummy/app/controllers/no_fallback_controller.rb +0 -13
- data/spec/dummy/app/controllers/skip_xhr_request_controller.rb +0 -7
- data/spec/dummy/app/controllers/testing_controller.rb +0 -9
- data/spec/dummy/app/views/default_fallback/index.html.erb +0 -1
- data/spec/dummy/app/views/default_fallback/index.js.erb +0 -1
- data/spec/dummy/app/views/default_fallback/index.mobile.erb +0 -1
- data/spec/dummy/app/views/default_fallback/test.html.erb +0 -1
- data/spec/dummy/app/views/default_fallback/test.js.erb +0 -1
- data/spec/dummy/app/views/fallbacks/index.html.erb +0 -2
- data/spec/dummy/app/views/fallbacks/index.js.erb +0 -1
- data/spec/dummy/app/views/fallbacks/index.mobile.erb +0 -0
- data/spec/dummy/app/views/fallbacks/index.xml.erb +0 -0
- data/spec/dummy/app/views/fallbacks/no_mobile.html.erb +0 -0
- data/spec/dummy/app/views/force_fallback/index.html.erb +0 -1
- data/spec/dummy/app/views/force_fallback/index.js.erb +0 -1
- data/spec/dummy/app/views/force_fallback/index.mobile.erb +0 -1
- data/spec/dummy/app/views/force_fallback/test.html.erb +0 -1
- data/spec/dummy/app/views/force_fallback/test.js.erb +0 -1
- data/spec/dummy/app/views/home/desktop.html.erb +0 -3
- data/spec/dummy/app/views/home/index.html.erb +0 -9
- data/spec/dummy/app/views/home/index.js.erb +0 -1
- data/spec/dummy/app/views/home/index.mobile.erb +0 -9
- data/spec/dummy/app/views/home/mobile.mobile.erb +0 -3
- data/spec/dummy/app/views/home/no_mobile_view.html.erb +0 -3
- data/spec/dummy/app/views/ignore_mobile_path/index.mobile.erb +0 -1
- data/spec/dummy/app/views/no_fallback/index.html.erb +0 -1
- data/spec/dummy/app/views/no_fallback/index.js.erb +0 -1
- data/spec/dummy/app/views/no_fallback/index.mobile.erb +0 -1
- data/spec/dummy/app/views/no_fallback/test.html.erb +0 -1
- data/spec/dummy/app/views/no_fallback/test.js.erb +0 -1
- data/spec/dummy/app/views/skip_xhr_request/index.html.erb +0 -9
- data/spec/dummy/app/views/skip_xhr_request/index.js.erb +0 -1
- data/spec/dummy/app/views/skip_xhr_request/index.mobile.erb +0 -9
- data/spec/dummy/app/views/view_path/index.mobile.erb +0 -1
- data/spec/helpers/mobylette_helpers_spec.rb +0 -59
@@ -1,58 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe NoFallbackController do
|
4
|
-
# This controller has fallbacks disabled by: respond_to_mobile_requests :fall_back => false
|
5
|
-
|
6
|
-
render_views
|
7
|
-
|
8
|
-
it "should find the correct view when it exists" do
|
9
|
-
force_mobile_request_agent
|
10
|
-
get :index
|
11
|
-
response.should render_template(:index)
|
12
|
-
response.body.should contain("MOBILE VIEW")
|
13
|
-
end
|
14
|
-
|
15
|
-
it "should find the correct view when it exists" do
|
16
|
-
reset_test_request_agent
|
17
|
-
get :index
|
18
|
-
response.should render_template(:index)
|
19
|
-
response.body.should contain("HTML VIEW")
|
20
|
-
end
|
21
|
-
|
22
|
-
it "should give an error when there is no mobile view (original format -> html)" do
|
23
|
-
force_mobile_request_agent
|
24
|
-
was_error = false
|
25
|
-
begin
|
26
|
-
get(:test)
|
27
|
-
rescue ActionView::MissingTemplate => e
|
28
|
-
was_error = true
|
29
|
-
ensure
|
30
|
-
was_error.should be_true
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
it "should give an error when there is no mobile view (original format -> html - param)" do
|
35
|
-
force_mobile_request_agent
|
36
|
-
was_error = false
|
37
|
-
begin
|
38
|
-
get(:test, :format => :html)
|
39
|
-
rescue ActionView::MissingTemplate => e
|
40
|
-
was_error = true
|
41
|
-
ensure
|
42
|
-
was_error.should be_true
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
it "should give an error when there is no mobile view (original format -> js)" do
|
47
|
-
force_mobile_request_agent
|
48
|
-
was_error = false
|
49
|
-
begin
|
50
|
-
get(:test)
|
51
|
-
rescue ActionView::MissingTemplate => e
|
52
|
-
was_error = true
|
53
|
-
ensure
|
54
|
-
was_error.should be_true
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
end
|
@@ -1,19 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe SkipXhrRequestController do
|
4
|
-
# This controller calls: respond_to_mobile_requests :skip_xhr_requests => false
|
5
|
-
|
6
|
-
render_views
|
7
|
-
|
8
|
-
#######################################################
|
9
|
-
# Testing XHR requests
|
10
|
-
describe "XHR Requests" do
|
11
|
-
it "should not use mobile format for xhr requests" do
|
12
|
-
force_mobile_request_agent("Android")
|
13
|
-
xhr :get, :index
|
14
|
-
response.should render_template(:index)
|
15
|
-
response.body.should contain("this is the mobile view")
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
end
|
@@ -1,20 +0,0 @@
|
|
1
|
-
class HomeController < ApplicationController
|
2
|
-
|
3
|
-
respond_to_mobile_requests
|
4
|
-
|
5
|
-
def index
|
6
|
-
end
|
7
|
-
|
8
|
-
def respond_to_test
|
9
|
-
|
10
|
-
respond_to do |format|
|
11
|
-
format.html {render :action => "desktop"}
|
12
|
-
format.mobile {render :action => "mobile"}
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
def no_mobile_view
|
17
|
-
|
18
|
-
end
|
19
|
-
|
20
|
-
end
|
@@ -1 +0,0 @@
|
|
1
|
-
HTML VIEW
|
@@ -1 +0,0 @@
|
|
1
|
-
JS VIEW
|
@@ -1 +0,0 @@
|
|
1
|
-
MOBILE VIEW
|
@@ -1 +0,0 @@
|
|
1
|
-
HTML VIEW
|
@@ -1 +0,0 @@
|
|
1
|
-
JS VIEW
|
@@ -1 +0,0 @@
|
|
1
|
-
alert(js view);
|
File without changes
|
File without changes
|
File without changes
|
@@ -1 +0,0 @@
|
|
1
|
-
HTML VIEW
|
@@ -1 +0,0 @@
|
|
1
|
-
JS VIEW
|
@@ -1 +0,0 @@
|
|
1
|
-
MOBILE VIEW
|
@@ -1 +0,0 @@
|
|
1
|
-
HTML VIEW
|
@@ -1 +0,0 @@
|
|
1
|
-
JS VIEW
|
@@ -1 +0,0 @@
|
|
1
|
-
AJAX VIEW
|
@@ -1 +0,0 @@
|
|
1
|
-
THIS IS THE MOBILE VIEW BUT OUTSIDE THE MOBILE PATH
|
@@ -1 +0,0 @@
|
|
1
|
-
HTML VIEW
|
@@ -1 +0,0 @@
|
|
1
|
-
JS VIEW
|
@@ -1 +0,0 @@
|
|
1
|
-
MOBILE VIEW
|
@@ -1 +0,0 @@
|
|
1
|
-
HTML VIEW
|
@@ -1 +0,0 @@
|
|
1
|
-
JS VIEW
|
@@ -1 +0,0 @@
|
|
1
|
-
AJAX VIEW
|
@@ -1 +0,0 @@
|
|
1
|
-
THIS IS THE MOBILE VIEW BUT OUTSIDE THE MOBILE PATH
|
@@ -1,59 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Mobylette::Controllers::Helpers do
|
4
|
-
include Sprockets::Helpers::RailsHelper
|
5
|
-
include Mobylette::Helmet::Helpers
|
6
|
-
|
7
|
-
describe "mobylette_stylesheet_link_tag" do
|
8
|
-
it "should not change the files names when the request is not mobile" do
|
9
|
-
reset_test_request_agent
|
10
|
-
helper.mobylette_stylesheet_link_tag("application").should == stylesheet_link_tag("application")
|
11
|
-
helper.mobylette_stylesheet_link_tag("application.css").should == stylesheet_link_tag("application.css")
|
12
|
-
helper.mobylette_stylesheet_link_tag("application", "home").should == stylesheet_link_tag("application", "home")
|
13
|
-
helper.mobylette_stylesheet_link_tag("application.css", "home").should == stylesheet_link_tag("application.css", "home")
|
14
|
-
end
|
15
|
-
|
16
|
-
it "should add the '_mobile' sulfix to the files names when the request is mobile" do
|
17
|
-
force_mobile_request_agent
|
18
|
-
helper.mobylette_stylesheet_link_tag("application").should == stylesheet_link_tag("application_mobile")
|
19
|
-
helper.mobylette_stylesheet_link_tag("application.css").should == stylesheet_link_tag("application_mobile.css")
|
20
|
-
helper.mobylette_stylesheet_link_tag("application", "home").should == stylesheet_link_tag("application_mobile", "home_mobile")
|
21
|
-
helper.mobylette_stylesheet_link_tag("application.css", "home").should == stylesheet_link_tag("application_mobile.css", "home_mobile")
|
22
|
-
end
|
23
|
-
|
24
|
-
it "should add the '_mobile' sulfix to the files names when the request is mobile" do
|
25
|
-
force_mobile_request_agent
|
26
|
-
helper.mobylette_stylesheet_link_tag("application", :id => "myid").should == stylesheet_link_tag("application_mobile", :id => "myid")
|
27
|
-
helper.mobylette_stylesheet_link_tag("application.css", :id => "myid").should == stylesheet_link_tag("application_mobile.css", :id => "myid")
|
28
|
-
helper.mobylette_stylesheet_link_tag("application", "home", :id => "myid").should == stylesheet_link_tag("application_mobile", "home_mobile", :id => "myid")
|
29
|
-
helper.mobylette_stylesheet_link_tag("application.css", "home", :id => "myid").should == stylesheet_link_tag("application_mobile.css", "home_mobile", :id => "myid")
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
describe "mobylette_javascript_include_tag" do
|
34
|
-
it "should not change the files names when the request is not mobile" do
|
35
|
-
reset_test_request_agent
|
36
|
-
helper.mobylette_javascript_include_tag("application").should == javascript_include_tag("application")
|
37
|
-
helper.mobylette_javascript_include_tag("application.js").should == javascript_include_tag("application.js")
|
38
|
-
helper.mobylette_javascript_include_tag("application", "home").should == javascript_include_tag("application", "home")
|
39
|
-
helper.mobylette_javascript_include_tag("application.js", "home").should == javascript_include_tag("application.js", "home")
|
40
|
-
end
|
41
|
-
|
42
|
-
it "should add the '_mobile' sulfix to the files names when the request is mobile" do
|
43
|
-
force_mobile_request_agent
|
44
|
-
helper.mobylette_javascript_include_tag("application").should == javascript_include_tag("application_mobile")
|
45
|
-
helper.mobylette_javascript_include_tag("application.js").should == javascript_include_tag("application_mobile.js")
|
46
|
-
helper.mobylette_javascript_include_tag("application", "home").should == javascript_include_tag("application_mobile", "home_mobile")
|
47
|
-
helper.mobylette_javascript_include_tag("application.js", "home").should == javascript_include_tag("application_mobile.js", "home_mobile")
|
48
|
-
end
|
49
|
-
|
50
|
-
it "should add the '_mobile' sulfix to the files names when the request is mobile with options" do
|
51
|
-
force_mobile_request_agent
|
52
|
-
helper.mobylette_javascript_include_tag("application", :id => "myid").should == javascript_include_tag("application_mobile", :id => "myid")
|
53
|
-
helper.mobylette_javascript_include_tag("application.js", :id => "myid").should == javascript_include_tag("application_mobile.js", :id => "myid")
|
54
|
-
helper.mobylette_javascript_include_tag("application", "home", :id => "myid").should == javascript_include_tag("application_mobile", "home_mobile", :id => "myid")
|
55
|
-
helper.mobylette_javascript_include_tag("application.js", "home", :id => "myid").should == javascript_include_tag("application_mobile.js", "home_mobile", :id => "myid")
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
end
|