Fix the IE version number extractor to work without space between MSIE and the version number, close #5858

This commit is contained in:
Flaburgan 2015-04-22 17:41:43 +02:00 committed by flaburgan
parent 0bad6dba88
commit 2b2c39eef3
2 changed files with 13 additions and 5 deletions

View file

@ -65,7 +65,7 @@ module Rack
end
def ie_version(ua_string)
ua_string.match(/MSIE (\S+)/)[1].to_f
ua_string.match(/MSIE ?(\S+)/)[1].to_f
end
end
end

View file

@ -18,7 +18,7 @@ describe Rack::ChromeFrame do
context "non-IE browser" do
let(:ua_string) { "another browser chromeframe" }
it "shouldn't complain about the browser" do
it "shouldn't complain about the browser and shouldn't have chrome frame" do
expect(subject.body).not_to match(/chrome=1/)
expect(subject.body).not_to match(/Diaspora doesn't support your version of Internet Explorer/)
end
@ -27,7 +27,7 @@ describe Rack::ChromeFrame do
context "IE8 without chromeframe" do
let(:ua_string) { "MSIE 8" }
it "shouldn't complain about the browser" do
it "shouldn't complain about the browser and shouldn't have chrome frame" do
expect(subject.body).not_to match(/chrome=1/)
expect(subject.body).not_to match(/Diaspora doesn't support your version of Internet Explorer/)
end
@ -36,7 +36,7 @@ describe Rack::ChromeFrame do
context "IE7 without chromeframe" do
let(:ua_string) { "MSIE 7" }
it "shouldn't complain about the browser" do
it "should complain about the browser" do
expect(subject.body).not_to match(/chrome=1/)
expect(subject.body).to match(/Diaspora doesn't support your version of Internet Explorer/)
end
@ -46,10 +46,18 @@ describe Rack::ChromeFrame do
context "any IE with chromeframe" do
let(:ua_string) { "MSIE number chromeframe" }
it "shouldn't complain about the browser" do
it "shouldn't complain about the browser and should have chrome frame" do
expect(subject.body).to match(/chrome=1/)
expect(subject.body).not_to match(/Diaspora doesn't support your version of Internet Explorer/)
end
specify {expect(@response.headers["Content-Length"]).to eq(@response.body.length.to_s)}
end
context "Specific case with no space after MSIE" do
let(:ua_string) { "Mozilla/4.0 (compatible; MSIE8.0; Windows NT 6.0) .NET CLR 2.0.50727" }
it "shouldn't complain about the browser" do
expect(subject.body).not_to match(/Diaspora doesn't support your version of Internet Explorer/)
end
end
end