Sha256: 1c0617e14b3337988b03d6959d87a01f592529a00cfd1f446c738bed3bedc5f0

Contents?: true

Size: 1.08 KB

Versions: 1

Compression:

Stored size: 1.08 KB

Contents

require 'rails_helper'

module TokenAction
  RSpec.describe TokensController, type: :routing do
    describe 'routing' do
      routes { Engine.routes }

      it 'routes to #redeem with default path' do
        expect(get('/tokens/1/redeem')).to route_to('token_action/tokens#redeem', :token =>'1', :path =>'redeem')
      end

      it 'routes to #redeem with custom path' do
        expect(get('/tokens/1/unsubscribe')).to route_to('token_action/tokens#redeem', :token =>'1', :path =>'unsubscribe')
      end

      it 'routes to #redeem with long path' do
        expect(get('/tokens/1/a/b/c')).to route_to('token_action/tokens#redeem', :token =>'1', :path =>'a/b/c')
      end

      it 'routes to #redeem with trailing slash' do
        expect(get('/tokens/1/redeem/')).to route_to('token_action/tokens#redeem', :token =>'1', :path =>'redeem')
      end

      it 'does not route with empty token' do
        expect(get('/tokens//redeem')).not_to be_routable
      end

      it 'does not route with empty path' do
        expect(get('/tokens/1/')).not_to be_routable
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
token_action-0.0.2 spec/routing/token_action/tokens_routing_spec.rb