Skip to content

Commit

Permalink
Refs #12: red test
Browse files Browse the repository at this point in the history
  • Loading branch information
ErikBrendel committed Nov 3, 2017
1 parent bfd3ea8 commit ce9aa18
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions spec/features/author/new_author_spec.rb
Original file line number Diff line number Diff line change
@@ -1,28 +1,34 @@
require 'rails_helper'

describe "New author page", type: :feature do

it "should render withour error" do
describe 'New author page', type: :feature do
it 'should render withour error' do
visit new_author_path
end

it "should have text input for first name, last name, and homepage" do
it 'should have text input for first name, last name, and homepage' do
visit new_author_path

expect(page).to have_field('First name')
expect(page).to have_field('Last name')
expect(page).to have_field('Homepage')
end

it "should save the entered values to the database" do
it 'should save the entered values to the database' do
visit new_author_path

fill_in "author_first_name", :with => 'Alan'
fill_in "author_last_name", :with => 'Turing'
fill_in "author_homepage", :with => 'http://wikipedia.org/Alan_Turing'
fill_in 'author_first_name', with: 'Alan'
fill_in 'author_last_name', with: 'Turing'
fill_in 'author_homepage', with: 'http://wikipedia.org/Alan_Turing'
find('input[type="submit"]').click
expect(Author.find_by_first_name('Alan')).not_to be_nil

end

end
it 'should display error messages when the created author is not valid' do
visit new_author_path
fill_in 'author_first_name', with: 'Alan'
fill_in 'author_homepage', with: 'http://wikipedia.org/Alan_Turing'
find('input[type="submit"]').click

expect(page.text).to match(/last name can't be blank/i)
end
end

0 comments on commit ce9aa18

Please sign in to comment.