Sha256: e5c9a2204401c346c9d46d96719350f868679d36605175bd0a8c424509435bfa

Contents?: true

Size: 541 Bytes

Versions: 31

Compression:

Stored size: 541 Bytes

Contents

require 'volt/router/routes'
require 'volt/models'

def routes(&block)
  @routes = Routes.new
  @routes.define(&block)
end

describe Routes do
  it "should match routes" do
    params = Model.new({}, persistor: Persistors::Params)
    params._controller = 'blog'
    params._index = '5'
    
    routes do
      get '/', _controller: 'index'
      get '/blog', _controller: 'blog'
    end
    
    path, cleaned_params = @routes.url_for_params(params)
    expect(path).to eq('/blog')
    expect(cleaned_params).to eq({_index: '5'})
  end
end

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
volt-0.5.3 spec/router/routes_spec.rb
volt-0.5.2 spec/router/routes_spec.rb
volt-0.5.1 spec/router/routes_spec.rb
volt-0.5.0 spec/router/routes_spec.rb
volt-0.4.18 spec/router/routes_spec.rb
volt-0.4.17 spec/router/routes_spec.rb
volt-0.4.15 spec/router/routes_spec.rb
volt-0.4.14 spec/router/routes_spec.rb
volt-0.4.12 spec/router/routes_spec.rb
volt-0.4.11 spec/router/routes_spec.rb
volt-0.4.10 spec/router/routes_spec.rb