Sha256: dde37c00b21fd97465e07548ccb4d063b6ea3a8577b0c45ba7e77ce5fa15cb8e

Contents?: true

Size: 918 Bytes

Versions: 12

Compression:

Stored size: 918 Bytes

Contents

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

describe "backtracking_array plugin" do 
  it "backtracks to next entry in array if later matcher fails" do
    app(:backtracking_array) do |r|
      r.is %w'a a/b' do |id|
        id
      end

      r.is %w'c c/d', %w'd e' do |a, b|
        "#{a}-#{b}" 
      end

      r.is [%w'f f/g', %w'g g/h'] do |id|
        id
      end
    end

    status.should == 404

    body("/a").should == 'a'
    body("/a/b").should == 'a/b'
    status("/a/b/").should == 404

    body("/c/d").should == 'c-d'
    body("/c/e").should == 'c-e'
    body("/c/d/d").should == 'c/d-d'
    body("/c/d/e").should == 'c/d-e'
    status("/c/d/").should == 404

    body("/f").should == 'f'
    body("/f/g").should == 'f/g'
    body("/g").should == 'g'
    body("/g/h").should == 'g/h'
    status("/f/g/").should == 404
    status("/g/h/").should == 404
  end
end

Version data entries

12 entries across 12 versions & 2 rubygems

Version Path
roda-1.1.0 spec/plugin/backtracking_array_spec.rb
roda-cj-1.0.5 spec/plugin/backtracking_array_spec.rb
roda-cj-1.0.4 spec/plugin/backtracking_array_spec.rb
roda-cj-1.0.3 spec/plugin/backtracking_array_spec.rb
roda-cj-1.0.2 spec/plugin/backtracking_array_spec.rb
roda-cj-1.0.1 spec/plugin/backtracking_array_spec.rb
roda-cj-1.0.0 spec/plugin/backtracking_array_spec.rb
roda-1.0.0 spec/plugin/backtracking_array_spec.rb
roda-cj-0.9.6 spec/plugin/backtracking_array_spec.rb
roda-cj-0.9.5 spec/plugin/backtracking_array_spec.rb
roda-cj-0.9.4 spec/plugin/backtracking_array_spec.rb
roda-cj-0.9.3 spec/plugin/backtracking_array_spec.rb