-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make add and delete labels for authors and artists correctly reflect …
…the titles of either author or artist
- Loading branch information
1 parent
f0ec2f6
commit 14849a5
Showing
4 changed files
with
76 additions
and
8 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
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
50 changes: 50 additions & 0 deletions
50
spec/features/author_management/author_vs_artist_labels_spec.rb
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 |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'rails_helper' | ||
|
||
# When adding an author or artist for a publication, the page should | ||
# correctly display the title of the author or artist as "Author" or "Artist". | ||
# This is a feature test that checks the behavior of the page when adding | ||
# and deleting authors and artists. | ||
describe 'Author and Artist labels', :feature, js: true do | ||
let(:submitter) { FactoryBot.create(:submitter) } | ||
|
||
before do | ||
create_submitter(submitter) | ||
end | ||
|
||
it 'uses the title of Author for new books' do | ||
visit new_book_path | ||
expect(page).to have_content('Add Author') | ||
expect(page).not_to have_content('Add Artist') | ||
first_name_fields.last.set('First0') | ||
last_name_fields.last.set('Last0') | ||
click_on 'Add Author' | ||
first_name_fields.last.set('First1') | ||
last_name_fields.last.set('Last1') | ||
click_on 'Add Author' | ||
expect(page).to have_selector('button', text: 'Remove Author', count: 2) | ||
expect(page).not_to have_selector('button', text: 'Remove Artist') | ||
first('button', text: 'Remove Author').click | ||
expect(page).to have_selector('button', text: 'Remove Author', count: 1) | ||
expect(page).not_to have_content('Artist') | ||
end | ||
|
||
|
||
it 'has the title of Artist for new artworks' do | ||
visit new_artwork_path | ||
expect(page).to have_content('Add Artist') | ||
expect(page).not_to have_content('Add Author') | ||
first_name_fields.last.set('First0') | ||
last_name_fields.last.set('Last0') | ||
click_on 'Add Artist' | ||
first_name_fields.last.set('First1') | ||
last_name_fields.last.set('Last1') | ||
click_on 'Add Artist' | ||
expect(page).to have_selector('button', text: 'Remove Artist', count: 2) | ||
expect(page).not_to have_selector('button', text: 'Remove Author') | ||
first('button', text: 'Remove Artist').click | ||
expect(page).to have_selector('button', text: 'Remove Artist', count: 1) | ||
expect(page).not_to have_content('Author') | ||
end | ||
end |
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