Sha256: 5b6bb928b71402ccdd5a43897a43bb77c869bef51b17f842a66c83cdb67dfa5c

Contents?: true

Size: 984 Bytes

Versions: 28

Compression:

Stored size: 984 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").must_equal 'reset'
    status("/css/reset.bar").must_equal 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").must_equal 'reset'
    status("/css/reset.bar").must_equal 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").must_equal '.css'
    status("/css/foo.bar").must_equal 404
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
roda-2.29.0 spec/plugin/path_matchers_spec.rb
roda-2.28.0 spec/plugin/path_matchers_spec.rb
roda-2.27.0 spec/plugin/path_matchers_spec.rb
roda-2.26.0 spec/plugin/path_matchers_spec.rb
roda-2.25.0 spec/plugin/path_matchers_spec.rb
roda-2.24.0 spec/plugin/path_matchers_spec.rb
roda-2.23.0 spec/plugin/path_matchers_spec.rb
roda-2.22.0 spec/plugin/path_matchers_spec.rb
roda-2.21.0 spec/plugin/path_matchers_spec.rb
roda-2.20.0 spec/plugin/path_matchers_spec.rb
roda-2.19.0 spec/plugin/path_matchers_spec.rb
roda-2.18.0 spec/plugin/path_matchers_spec.rb
roda-2.17.0 spec/plugin/path_matchers_spec.rb
roda-2.16.0 spec/plugin/path_matchers_spec.rb
roda-2.15.0 spec/plugin/path_matchers_spec.rb
roda-2.14.0 spec/plugin/path_matchers_spec.rb
roda-2.13.0 spec/plugin/path_matchers_spec.rb
roda-2.12.0 spec/plugin/path_matchers_spec.rb
roda-2.11.0 spec/plugin/path_matchers_spec.rb
roda-2.10.0 spec/plugin/path_matchers_spec.rb