Skip to content

Commit

Permalink
Retrieved request via controller when checking unsupported browsers
Browse files Browse the repository at this point in the history
  • Loading branch information
prasadsurase committed Oct 18, 2016
1 parent f892683 commit 1317b7c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/active_admin/views/pages/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def build_page
end

def build_unsupported_browser
if active_admin_namespace.unsupported_browser_matcher =~ request.user_agent
if active_admin_namespace.unsupported_browser_matcher =~ controller.request.user_agent
insert_tag view_factory.unsupported_browser
end
end
Expand Down
4 changes: 2 additions & 2 deletions spec/unit/views/components/unsupported_browser_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def build_panel
context "when the reqex match" do
it "should build the unsupported browser panel" do
expect(base).to receive(:active_admin_namespace).and_return(namespace)
expect(base).to receive_message_chain(:request, :user_agent).and_return("Mozilla/5.0 (compatible; MSIE 7.0; Windows NT 6.2; Trident/6.0)")
expect(base).to receive_message_chain(:controller, :request, :user_agent).and_return("Mozilla/5.0 (compatible; MSIE 7.0; Windows NT 6.2; Trident/6.0)")
expect(base).to receive(:view_factory).and_return(view_factory)
expect(base).to receive(:insert_tag).with(component)
base.send(:build_unsupported_browser)
Expand All @@ -32,7 +32,7 @@ def build_panel
context "when the regex not match" do
it "should not build the unsupported browser panel" do
expect(base).to receive(:active_admin_namespace).and_return(namespace)
expect(base).to receive_message_chain(:request, :user_agent).and_return("Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; Trident/6.0)")
expect(base).to receive_message_chain(:controller, :request, :user_agent).and_return("Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; Trident/6.0)")
expect(base).to receive(:insert_tag).never
base.send(:build_unsupported_browser)
end
Expand Down

0 comments on commit 1317b7c

Please sign in to comment.