diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index 61b6d6161..af2d720fc 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -6,7 +6,6 @@ %html{:lang => I18n.locale.to_s, :dir => (rtl?) ? 'rtl' : 'ltr'} %head %meta{:charset => 'utf-8'} - %meta{'http-equiv' => 'X-UA-Compatible', :content => 'IE=edge,chrome=1'} %meta{"http-equiv"=>"Content-Type", :content=>"text/html; charset=utf-8"} %meta{:name => "description", :content => "Diaspora*"} diff --git a/app/views/layouts/blank.haml b/app/views/layouts/blank.haml index b9e7d816d..0ed9927ab 100644 --- a/app/views/layouts/blank.haml +++ b/app/views/layouts/blank.haml @@ -6,7 +6,6 @@ %html{:lang => I18n.locale.to_s, :dir => (rtl?) ? 'rtl' : 'ltr'} %head %meta{:charset => 'utf-8'} - %meta{'http-equiv' => 'X-UA-Compatible', :content => 'IE=edge,chrome=1'} %meta{"http-equiv"=>"Content-Type", :content=>"text/html; charset=utf-8"} = csrf_meta_tag diff --git a/app/views/layouts/post.haml b/app/views/layouts/post.haml index f0ef05e04..4d10bb287 100644 --- a/app/views/layouts/post.haml +++ b/app/views/layouts/post.haml @@ -6,7 +6,6 @@ %html{:lang => I18n.locale.to_s, :dir => (rtl?) ? 'rtl' : 'ltr'} %head %meta{:charset => 'utf-8'} - %meta{'http-equiv' => 'X-UA-Compatible', :content => 'IE=edge,chrome=1'} %meta{"http-equiv"=>"Content-Type", :content=>"text/html; charset=utf-8"} %meta{:name => "description", :content => "Diaspora*"} diff --git a/lib/rack/chrome_frame.rb b/lib/rack/chrome_frame.rb index 81f438d6d..de7234dd1 100644 --- a/lib/rack/chrome_frame.rb +++ b/lib/rack/chrome_frame.rb @@ -29,7 +29,7 @@ module Rack
- + HTML diff --git a/spec/helper_methods.rb b/spec/helper_methods.rb index 471526452..494f15407 100644 --- a/spec/helper_methods.rb +++ b/spec/helper_methods.rb @@ -72,4 +72,11 @@ module HelperMethods Conversation.create!(create_hash) end + + def get_response_for_user_agent(app, userAgent) + env = Rack::MockRequest.env_for('/', "HTTP_USER_AGENT" => userAgent) + status, headers, body = app.call(env) + body.close if body.respond_to?(:close) # avoids deadlock after 3 tests + ActionDispatch::TestResponse.new(status, headers, body) + end end diff --git a/spec/lib/rack/chrome_frame_spec.rb b/spec/lib/rack/chrome_frame_spec.rb new file mode 100644 index 000000000..12643a95c --- /dev/null +++ b/spec/lib/rack/chrome_frame_spec.rb @@ -0,0 +1,47 @@ +# Copyright (c) 2010-2011, Diaspora Inc. This file is +# licensed under the Affero General Public License version 3 or later. See +# the COPYRIGHT file. +require 'spec_helper' + +describe Rack::ChromeFrame do + + before :all do + @app = Rack::Builder.parse_file(Rails.root.join('config.ru').to_s).first + end + + before :each do + @response = get_response_for_user_agent(@app, ua_string); + end + + subject { @response } + + context "non-IE browser" do + let(:ua_string) { "another browser chromeframe" } + + its(:body) { should_not =~ /chrome=1/ } + its(:body) { should_not =~ /Diaspora doesn't support your version of Internet Explorer/ } + end + + context "IE8 without chromeframe" do + let(:ua_string) { "MSIE 8" } + + its(:body) { should_not =~ /chrome=1/ } + its(:body) { should_not =~ /Diaspora doesn't support your version of Internet Explorer/ } + end + + context "IE7 without chromeframe" do + let(:ua_string) { "MSIE 7" } + + its(:body) { should_not =~ /chrome=1/ } + its(:body) { should =~ /Diaspora doesn't support your version of Internet Explorer/ } + specify {@response.headers["Content-Length"].should == @response.body.length.to_s} + end + + context "any IE with chromeframe" do + let(:ua_string) { "MSIE number chromeframe" } + + its(:body) { should =~ /chrome=1/ } + its(:body) { should_not =~ /Diaspora doesn't support your version of Internet Explorer/ } + specify {@response.headers["Content-Length"].should == @response.body.length.to_s} + end +end