Sha256: 52f9fba92382a17557437adcb4b45e6636fcf0d1e41da3b8c0cc3e5294fc67a1

Contents?: true

Size: 1.13 KB

Versions: 18

Compression:

Stored size: 1.13 KB

Contents

require File.join(File.dirname(__FILE__), 'compat')
require 'lib/usher'

route_set = Usher::Interface.for(:rails2_2)

describe "Usher (for rails 2.2) URL generation" do
  
  before(:each) do
    route_set.reset!
  end

  it "should fill in the controller from recall" do
    route_set.add_route('/:controller/:action/:id')
    route_set.generate({:action => 'thingy'}, {:controller => 'sample', :action => 'index', :id => 123}, :generate).should == '/sample/thingy'
  end

  it "should skip the action if not provided" do
    route_set.add_route('/:controller/:action/:id')
    route_set.generate({:controller => 'thingy'}, {:controller => 'sample', :action => 'index', :id => 123}, :generate).should == '/thingy'
  end

  it "should pick the correct param from optional parts" do
    route_set.add_route('/:controller/:action(.:format)')
    route_set.generate({:action => 'thingy', :format => 'html'}, {:controller => 'sample', :action => 'index', :id => 123}, :generate).should == '/sample/thingy.html'
    route_set.generate({:action => 'thingy'}, {:controller => 'sample', :action => 'index', :id => 123}, :generate).should == '/sample/thingy'
  end

end

Version data entries

18 entries across 18 versions & 2 rubygems

Version Path
joshbuddy-usher-0.4.10 spec/private/rails2_2/generate_spec.rb
joshbuddy-usher-0.4.11 spec/private/rails2_2/generate_spec.rb
joshbuddy-usher-0.4.5 spec/private/rails2_2/generate_spec.rb
joshbuddy-usher-0.4.6 spec/private/rails2_2/generate_spec.rb
joshbuddy-usher-0.4.7 spec/private/rails2_2/generate_spec.rb
joshbuddy-usher-0.4.8 spec/private/rails2_2/generate_spec.rb
joshbuddy-usher-0.5.1 spec/private/rails2_2/generate_spec.rb
joshbuddy-usher-0.5.2 spec/private/rails2_2/generate_spec.rb
joshbuddy-usher-0.5.3 spec/private/rails2_2/generate_spec.rb
joshbuddy-usher-0.5.4 spec/private/rails2_2/generate_spec.rb
joshbuddy-usher-0.5.6 spec/private/rails2_2/generate_spec.rb
usher-0.5.6 spec/private/rails2_2/generate_spec.rb
usher-0.5.5 spec/private/rails2_2/generate_spec.rb
usher-0.5.4 spec/private/rails2_2/generate_spec.rb
usher-0.5.3 spec/private/rails2_2/generate_spec.rb
usher-0.5.2 spec/private/rails2_2/generate_spec.rb
usher-0.5.1 spec/private/rails2_2/generate_spec.rb
usher-0.4.8 spec/private/rails2_2/generate_spec.rb