Sha256: 63c574e95b9bdd5fddd94722b3470445b1a83eaaebec981ec257e04d6839141f

Contents?: true

Size: 1018 Bytes

Versions: 1

Compression:

Stored size: 1018 Bytes

Contents

require "#{File.dirname(__FILE__)}/../../test/helpers.rb"
require 'foundations/compact'

describe "Matching The Accepts Header" do
    
  before do
    Test = Module.new { include Waves::Foundations::Compact }
    Waves << Test
  end
  
  after do
    Waves.applications.clear
    Object.instance_eval { remove_const(:Test) if const_defined?(:Test) }
  end
    
  feature "Match an implied accept header using the file extension" do 
    Test::Resources::Map.on( :get, true, :accept => :javascript ) {}
    get("/foo.js").status.should == 200
    get("/foo").status.should == 404
  end
  
  feature "Match against an array of options" do 
    Test::Resources::Map.on( :get, true, :accept => [ :javascript, :css ] ) {}
    get("/foo.js").status.should == 200
    get("/foo").status.should == 404
  end

  feature "Match against a Mime type (rather than subtype)" do 
    Test::Resources::Map.on( :get, true, :accept => :image ) {}
    get("/foo.png").status.should == 200
    get("/foo").status.should == 404
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
waves-edge-2009.03.10.13.14 test/match/accept.rb