Add tests of controllers

This commit is contained in:
riggraz
2019-09-04 17:37:08 +02:00
parent 542bbcfb85
commit 2a42d3069c
7 changed files with 152 additions and 17 deletions

View File

@@ -1,7 +1,7 @@
require 'rails_helper'
RSpec.describe 'board routing', :aggregate_failures, type: :routing do
it 'only routes the page to show a board' do
RSpec.describe 'boards routing', :aggregate_failures, type: :routing do
it 'routes boards' do
expect(get: '/boards/1').to route_to(
controller: 'boards', action: 'show', id: '1'
)

View File

@@ -0,0 +1,17 @@
require 'rails_helper'
RSpec.describe 'posts routing', :aggregate_failures, type: :routing do
it 'routes posts' do
expect(get: '/posts').to route_to(
controller: 'posts', action: 'index'
)
expect(post: '/posts').to route_to(
controller: 'posts', action: 'create'
)
expect(get: '/posts/1').not_to be_routable
expect(get: '/posts/1/edit').not_to be_routable
expect(patch: '/posts/1').not_to be_routable
expect(delete: '/posts/1').not_to be_routable
end
end