Created
January 24, 2012 05:05
-
-
Save robzolkos/1668070 to your computer and use it in GitHub Desktop.
Integration test for accept header issue in Rails 3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'spec_helper' | |
describe "Returns page as normal" do | |
it "with accept header '*/*;q=0.6'" do | |
page.driver.header "Accept", "*/*;q=0.6" | |
visit fb_path | |
page.current_path.should == fb_path | |
end | |
it "with accept header 'text/html;q=0.7'" do | |
page.driver.header "Accept", "text/html;q=0.7" | |
visit fb_path | |
page.current_path.should == fb_path | |
end | |
it "with accept header 'text/*\\'" do | |
page.driver.header "Accept", "text/*\\" | |
visit fb_path | |
page.current_path.should == fb_path | |
end | |
it "with accept header 'text/*'" do | |
page.driver.header "Accept", "text/*" | |
visit fb_path | |
page.current_path.should == fb_path | |
end | |
it "with accept header '*/*'" do | |
page.driver.header "Accept", "*/*" | |
visit fb_path | |
page.current_path.should == fb_path | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# put this in config/initializers | |
module Mime | |
class Type | |
def self.lookup(string) | |
string = string.gsub(/\\/, "") | |
string = string.gsub(/text\/\*/, "*") | |
LOOKUP[string.split(';').first] | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment