Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Adding some documentation to controller tests...

  • Loading branch information...
commit 76725797559ad5e81587d4c8f31a96ac1357054f 1 parent 4a3d28a
@tscolari tscolari authored
View
4 spec/controllers/default_fallback_controller_spec.rb
@@ -1,6 +1,10 @@
require 'spec_helper'
describe DefaultFallbackController do
+ # This controller calls respond_to_mobile_requests with no params
+ # Index action has views for html, js and mobile
+ # Test action has only html and js
+
render_views
it "should find the correct view when it exists" do
View
3  spec/controllers/desktop_only_controller_spec.rb
@@ -1,13 +1,14 @@
require 'spec_helper'
describe DesktopOnlyController do
+ # this controller has no actions
+ # and do not call respond_to_mobile_requests
it "should not have the :handle_mobile method" do
@controller.private_methods.include?(:handle_mobile).should_not be_true
end
it "should have the :is_mobile_request? method" do
-
# Works on ruby 1.9.2 but not on 1.8.7:
#@controller.private_methods.include?(:is_mobile_request?).should be_true
View
5 spec/controllers/force_fallback_controller_spec.rb
@@ -1,6 +1,11 @@
require 'spec_helper'
describe ForceFallbackController do
+ # this controller calls respond_to_mobile_requests :fall_back => :js
+ # forcing fallback to be javascript
+ # index action has html, js and mobile views
+ # test action has html and js only
+
render_views
it "should find the correct view (mobile) when it exists" do
View
6 spec/controllers/home_controller_spec.rb
@@ -1,10 +1,14 @@
require 'spec_helper'
describe HomeController do
+ # This controller calls respond_to_mobile_requests with no params
+ # no_mobile_view action has only html
+ # mobile action has only mobile
+ # index action has html, js and mobile
+ # desktop action has only html
render_views
it "should have the :handle_mobile method" do
- #
# Works on ruby 1.9.2 but not on 1.8.7
# @controller.private_methods.include?(:handle_mobile).should be_true
# this is a hack, not perfect, but if it didnt have the method it would
View
2  spec/controllers/no_fallback_controller_spec.rb
@@ -1,6 +1,8 @@
require 'spec_helper'
describe NoFallbackController do
+ # This controller has fallbacks disabled by: respond_to_mobile_requests :fall_back => false
+
render_views
it "should find the correct view when it exists" do
View
2  spec/controllers/skip_xhr_request_controller_spec.rb
@@ -1,6 +1,8 @@
require 'spec_helper'
describe SkipXhrRequestController do
+ # This controller calls: respond_to_mobile_requests :skip_xhr_requests => false
+
render_views
#######################################################

0 comments on commit 7672579

Please sign in to comment.
Something went wrong with that request. Please try again.