Sha256: 839b1b4607061719a4a1bb7d9c6740b363462312f6bb644f30c0a3ab5b25c5b4

Contents?: true

Size: 948 Bytes

Versions: 1

Compression:

Stored size: 948 Bytes

Contents

require 'test_helper'

class RouteTest < ActionDispatch::IntegrationTest

  test 'query param' do
    Rails.application.routes.draw do
      get '/' => 'pages#index'
    end

    10.times.each { Record.create }
    get '/'
    assert_select 'li.current a[href=/?page=1]', '1'
    get '/?page=2'
    assert_select 'li.current a[href=/?page=2]', '2'
    get '/?dummy='
    assert_select 'li.current a[href=/?dummy=&amp;page=1]', '1'
    get '/?dummy=&page=2'
    assert_select 'li.current a[href=/?dummy=&amp;page=2]', '2'
  end

  test 'route param' do
    Rails.application.routes.draw do
      get '(:page)' => 'pages#index'
    end

    10.times.each { Record.create }
    get '/'
    assert_select 'li.current a[href=/1]', '1'
    get '/2'
    assert_select 'li.current a[href=/2]', '2'
    get '/?dummy='
    assert_select 'li.current a[href=/1?dummy=]', '1'
    get '/2?dummy='
    assert_select 'li.current a[href=/2?dummy=]', '2'
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pagers-3.1.1 test/route_test.rb