forgeplus/spec/routing/sponsorships_routing_spec.rb

63 lines
2.2 KiB
Ruby

require 'rails_helper'
RSpec.describe SponsorshipsController, type: :routing do
describe 'routing' do
it 'routes to #index' do
# expect(:get => "/api/sponsorships.json").to route_to("sponsorships#index")
expect(get: '/api/sponsorships.json').to route_to(
controller: 'sponsorships', action: 'index', format: 'json')
end
it 'routes to stopped' do
expect(get: '/api/sponsorships/stopped.json').to route_to(
controller: 'sponsorships', action: 'stopped', format: 'json')
end
it 'routes to sponsoring' do
expect(get: '/api/sponsorships/sponsoring.json').to route_to(
controller: 'sponsorships', action: 'sponsoring', format: 'json')
end
it 'routes to stopped_sponsoring' do
expect(get: '/api/sponsorships/stopped_sponsoring.json').to route_to(
controller: 'sponsorships', action: 'stopped_sponsoring', format: 'json')
end
it 'routes to sponsored' do
expect(get: '/api/sponsorships/sponsored.json').to route_to(
controller: 'sponsorships', action: 'sponsored', format: 'json')
end
it 'routes to stopped_sponsored' do
expect(get: '/api/sponsorships/stopped_sponsored.json').to route_to(
controller: 'sponsorships', action: 'stopped_sponsored', format: 'json')
end
it 'routes to #show' do
expect(get: '/api/sponsorships/1.json').to route_to(
controller: 'sponsorships', action: 'show', id: "1", format: 'json')
end
it 'routes to #create' do
expect(post: '/api/sponsorships.json').to route_to(
controller: 'sponsorships', action: 'create', format: 'json')
end
it 'routes to #update via PUT' do
expect(put: '/api/sponsorships/1.json').to route_to(
controller: 'sponsorships', action: 'update', id: "1", format: 'json')
end
it 'routes to #update via PATCH' do
expect(patch: '/api/sponsorships/1.json').to route_to(
controller: 'sponsorships', action: 'update', id: "1", format: 'json')
end
it 'routes to #destroy' do
expect(delete: '/api/sponsorships/1.json').to route_to(
controller: 'sponsorships', action: 'destroy', id: "1", format: 'json')
end
end
end