diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 8cfbc529143..d1a1f4cf6bc 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -119,6 +119,6 @@ module ApplicationHelper def mobile_device? # TODO: this is dumb. user agent matching is a doomed approach. a better solution is coming. - request.user_agent =~ /Mobile|webOS/ and !(request.user_agent =~ /iPad/) + request.user_agent =~ /Mobile|webOS|Nexus 7/ and !(request.user_agent =~ /iPad/) end end diff --git a/spec/helpers/application_helper_spec.rb b/spec/helpers/application_helper_spec.rb index feeb04b0ee3..697f8d009e9 100644 --- a/spec/helpers/application_helper_spec.rb +++ b/spec/helpers/application_helper_spec.rb @@ -34,10 +34,15 @@ describe ApplicationHelper do helper.mobile_view?.should be_false end - it "is false for Android tablet" do - controller.request.stubs(:user_agent).returns("Mozilla/5.0 (Linux; Android 4.1.2; Nexus 7 Build/JZ054K) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.166 Safari/535.19") + it "is false for Nexus 10 tablet" do + controller.request.stubs(:user_agent).returns("Mozilla/5.0 (Linux; Android 4.2.1; Nexus 10 Build/JOP40D) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.166 Safari/535.19") helper.mobile_view?.should be_false end + + it "is true for Nexus 7 tablet" do + controller.request.stubs(:user_agent).returns("Mozilla/5.0 (Linux; Android 4.1.2; Nexus 7 Build/JZ054K) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.166 Safari/535.19") + helper.mobile_view?.should be_true + end end end