-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bfd3ea8
commit ce9aa18
Showing
1 changed file
with
16 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |