Sha256: 65bac6cdea8189410179f8b865ae78f1767b8d95bae587d31f712e24ca785bcc

Contents?: true

Size: 978 Bytes

Versions: 4

Compression:

Stored size: 978 Bytes

Contents

require File.expand_path("spec_helper", File.dirname(File.dirname(__FILE__)))

describe "path_matchers plugin" do 
  it ":extension matcher should match given file extension" do
    app(:path_matchers) do |r|
      r.on "css" do
        r.on :extension=>"css" do |file|
          file
        end
      end
    end

    body("/css/reset.css").should == 'reset'
    status("/css/reset.bar").should == 404
  end

  it ":suffix matcher should match given suffix" do
    app(:path_matchers) do |r|
      r.on "css" do
        r.on :suffix=>".css" do |file|
          file
        end
      end
    end

    body("/css/reset.css").should == 'reset'
    status("/css/reset.bar").should == 404
  end

  it ":prefix matcher should match given prefix" do
    app(:path_matchers) do |r|
      r.on "css" do
        r.on :prefix=>"reset" do |file|
          file
        end
      end
    end

    body("/css/reset.css").should == '.css'
    status("/css/foo.bar").should == 404
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
roda-2.2.0 spec/plugin/path_matchers_spec.rb
roda-2.1.0 spec/plugin/path_matchers_spec.rb
roda-2.0.0 spec/plugin/path_matchers_spec.rb
roda-1.3.0 spec/plugin/path_matchers_spec.rb