Sha256: 8032669d5790a3c3d5a41f8f7aeb96c3134196492ed064d3d2c79f35d2738bce
Contents?: true
Size: 1.18 KB
Versions: 30
Compression:
Stored size: 1.18 KB
Contents
require File.dirname(__FILE__) + '/spec_helper' describe Resourceful::Response, "when first created" do before(:each) { @response = Resourceful::Response.new } it "should have an empty formats array" do @response.formats.should == [] end end describe Resourceful::Response, "with a few formats" do before :each do @response = Resourceful::Response.new @response.html @response.js {'javascript'} @response.xml {'xml'} end it "should store the formats and blocks" do @response.formats.should have_any {|f,p| f == :js && p.call == 'javascript'} @response.formats.should have_any {|f,p| f == :xml && p.call == 'xml'} end it "should give formats without a block an empty block" do @response.formats.should have_any {|f,p| f == :html && Proc === p && p.call.nil?} end it "shouldn't allow duplicate formats" do @response.js {'not javascript'} @response.formats.should have_any {|f,p| f == :js && p.call == 'javascript'} @response.formats.should_not have_any {|f,p| f == :js && p.call == 'not javascript'} end it "should keep the formats in sorted order" do @response.formats.map(&:first).should == [:html, :js, :xml] end end
Version data entries
30 entries across 30 versions & 5 rubygems