add specs for chromeframe
fix typo in ChromeFrame itself remove unneccessary chromeframe meta tags from layouts
This commit is contained in:
parent
dc62587021
commit
586e23727c
6 changed files with 55 additions and 4 deletions
|
|
@ -6,7 +6,6 @@
|
||||||
%html{:lang => I18n.locale.to_s, :dir => (rtl?) ? 'rtl' : 'ltr'}
|
%html{:lang => I18n.locale.to_s, :dir => (rtl?) ? 'rtl' : 'ltr'}
|
||||||
%head
|
%head
|
||||||
%meta{:charset => 'utf-8'}
|
%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{"http-equiv"=>"Content-Type", :content=>"text/html; charset=utf-8"}
|
||||||
|
|
||||||
%meta{:name => "description", :content => "Diaspora*"}
|
%meta{:name => "description", :content => "Diaspora*"}
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,6 @@
|
||||||
%html{:lang => I18n.locale.to_s, :dir => (rtl?) ? 'rtl' : 'ltr'}
|
%html{:lang => I18n.locale.to_s, :dir => (rtl?) ? 'rtl' : 'ltr'}
|
||||||
%head
|
%head
|
||||||
%meta{:charset => 'utf-8'}
|
%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{"http-equiv"=>"Content-Type", :content=>"text/html; charset=utf-8"}
|
||||||
|
|
||||||
= csrf_meta_tag
|
= csrf_meta_tag
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,6 @@
|
||||||
%html{:lang => I18n.locale.to_s, :dir => (rtl?) ? 'rtl' : 'ltr'}
|
%html{:lang => I18n.locale.to_s, :dir => (rtl?) ? 'rtl' : 'ltr'}
|
||||||
%head
|
%head
|
||||||
%meta{:charset => 'utf-8'}
|
%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{"http-equiv"=>"Content-Type", :content=>"text/html; charset=utf-8"}
|
||||||
|
|
||||||
%meta{:name => "description", :content => "Diaspora*"}
|
%meta{:name => "description", :content => "Diaspora*"}
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ module Rack
|
||||||
<body>
|
<body>
|
||||||
<div id="cf-placeholder"></div>
|
<div id="cf-placeholder"></div>
|
||||||
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/chrome-frame/1/CFInstall.min.js"></script>
|
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/chrome-frame/1/CFInstall.min.js"></script>
|
||||||
<script>CFInstall.check({ node: "cf-placx eholder" #{', destination: "' + @options[:destination] + '" ' if @options[:destination]}});</script>
|
<script>CFInstall.check({ node: "cf-placeholder" #{', destination: "' + @options[:destination] + '" ' if @options[:destination]}});</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
HTML
|
HTML
|
||||||
|
|
|
||||||
|
|
@ -72,4 +72,11 @@ module HelperMethods
|
||||||
|
|
||||||
Conversation.create!(create_hash)
|
Conversation.create!(create_hash)
|
||||||
end
|
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
|
end
|
||||||
|
|
|
||||||
47
spec/lib/rack/chrome_frame_spec.rb
Normal file
47
spec/lib/rack/chrome_frame_spec.rb
Normal file
|
|
@ -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
|
||||||
Loading…
Reference in a new issue