diff options
author | Gibheer <gibheer@gmail.com> | 2012-11-16 13:58:42 +0100 |
---|---|---|
committer | Gibheer <gibheer@gmail.com> | 2012-11-16 18:13:07 +0100 |
commit | a7d3106df2840b4173d762b8cc8c35d6bfbb7065 (patch) | |
tree | e13ba382616efb149bf9600da66f33363f5d5158 /spec/unit/request/accept/preferred_spec.rb | |
parent | 0986ca27f52d709a7489a106571efffcbee4e7fd (diff) |
added specs for new type
Diffstat (limited to 'spec/unit/request/accept/preferred_spec.rb')
-rw-r--r-- | spec/unit/request/accept/preferred_spec.rb | 35 |
1 files changed, 0 insertions, 35 deletions
diff --git a/spec/unit/request/accept/preferred_spec.rb b/spec/unit/request/accept/preferred_spec.rb deleted file mode 100644 index 03a7267..0000000 --- a/spec/unit/request/accept/preferred_spec.rb +++ /dev/null @@ -1,35 +0,0 @@ -require 'spec_helper' - -describe Zero::Request::Accept, '#preferred' do - subject { Zero::Request::Accept } - let(:html) { 'text/html' } - let(:json) { 'application/json' } - let(:foo) { 'text/foo' } - let(:lower_quality) { foo + ';q=0.5' } - let(:default) { '*/*;q=0.1' } - let(:simple_accept) { [html, json].join(',') } - let(:quality_accept) { [html, lower_quality, default].join(',') } - let(:random_accept) { [lower_quality, default, html].join(',') } - let(:lower_accept) { [lower_quality, default].join(',') } - - context 'without mapping' do - it { subject.new(html).preferred.should == html } - it { subject.new(json).preferred.should == json } - it { subject.new(simple_accept).preferred.should == html } - it { subject.new(quality_accept).preferred.should == html } - it { subject.new(random_accept).preferred.should == html } - it { subject.new(lower_accept).preferred.should == foo } - end - - context 'with mapping' do - before :all do - Zero::Request::Accept.map = {'text/html' => 'html'} - end - - after :all do - Zero::Request::Accept.map = {} - end - - it { subject.new(html).preferred.should == 'html' } - end -end |