Sha256: a437b7ea99331ec2c7bed357c1d6657e7a03fef20a662e3d5d6a192d984b4d1c

Contents?: true

Size: 1.12 KB

Versions: 19

Compression:

Stored size: 1.12 KB

Contents

describe "a route destination" do
  before(:each) do
    @u = Usher.new
  end

  it "should return a compound with given var args" do
    r = @u.add_route('/testsauce').to(:one, :two, :three, :four)
    r.destination.args.should  == [:one, :two, :three, :four]
  end
  
  it "should return a compound with given var args and a hash on the end" do
    r = @u.add_route('/testsauce').to(:one, :two, :three, :four, :five => 'six', :seven => 'heaven')
    r.destination.args.should  == [:one, :two, :three, :four]
    r.destination.options.should  == {:five => 'six', :seven => 'heaven'}
  end

  it "should never wrap it in a compound if its a simple hash" do
    r = @u.add_route('/testsauce').to(:five => 'six', :seven => 'heaven')
    r.destination.should  == {:five => 'six', :seven => 'heaven'}
  end

  it "should never wrap it in a compound if its a simple object" do
    r = @u.add_route('/testsauce').to(:eighteen)
    r.destination.should  == :eighteen
  end

  it "should never wrap it in a compound if its a simple block" do
    p = proc{ puts 'lovetown' }
    r = @u.add_route('/testsauce').to(&p)
    r.destination.should == p
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
usher-0.8.3 spec/private/destination_spec.rb
usher-0.8.2 spec/private/destination_spec.rb
usher-0.8.1 spec/private/destination_spec.rb
usher-0.8.0 spec/private/destination_spec.rb
usher-0.7.5 spec/private/destination_spec.rb
usher-0.7.4 spec/private/destination_spec.rb
usher-0.7.3 spec/private/destination_spec.rb
usher-0.7.2 spec/private/destination_spec.rb
usher-0.7.1 spec/private/destination_spec.rb
usher-0.7.0 spec/private/destination_spec.rb
usher-0.6.8 spec/private/destination_spec.rb
usher-0.6.7 spec/private/destination_spec.rb
usher-0.6.6 spec/private/destination_spec.rb
usher-0.6.5 spec/private/destination_spec.rb
usher-0.6.4 spec/private/destination_spec.rb
usher-0.6.3 spec/private/destination_spec.rb
usher-0.6.2 spec/private/destination_spec.rb
usher-0.6.1 spec/private/destination_spec.rb
usher-0.6.0 spec/private/destination_spec.rb