Simplify playlists CRUD specs
This commit is contained in:
parent
9d37916e17
commit
e1c8a6038d
@ -3,31 +3,11 @@ feature 'Playlists CRUD' do
|
|||||||
|
|
||||||
background { sign_in }
|
background { sign_in }
|
||||||
|
|
||||||
scenario 'lists playlists' do
|
|
||||||
FactoryGirl.create(:playlist, name: 'Electro')
|
|
||||||
FactoryGirl.create(:playlist, name: 'Reggae')
|
|
||||||
|
|
||||||
visit playlists_path
|
|
||||||
|
|
||||||
expect(page.body).to match /Electro.+Reggae/m
|
|
||||||
end
|
|
||||||
|
|
||||||
scenario 'creates playlist' do
|
|
||||||
visit playlists_path
|
|
||||||
|
|
||||||
click_link 'Create playlist'
|
|
||||||
fill_in 'Name', with: 'Electro'
|
|
||||||
click_button 'Create'
|
|
||||||
|
|
||||||
expect(current_path).to eq playlists_path
|
|
||||||
expect(page).to have_content 'Electro'
|
|
||||||
end
|
|
||||||
|
|
||||||
scenario 'edits playlist' do
|
scenario 'edits playlist' do
|
||||||
FactoryGirl.create(:playlist, name: 'Electro')
|
playlist = create_playlist
|
||||||
visit playlists_path
|
visit playlists_path
|
||||||
|
|
||||||
click_link 'Electro'
|
click_link playlist[:name]
|
||||||
fill_in 'Name', with: 'Rock'
|
fill_in 'Name', with: 'Rock'
|
||||||
click_button 'Save'
|
click_button 'Save'
|
||||||
|
|
||||||
|
@ -15,4 +15,13 @@ module AcceptanceHelpers
|
|||||||
password: user.password
|
password: user.password
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def create_playlist
|
||||||
|
playlist = attributes_for :playlist
|
||||||
|
visit playlists_path
|
||||||
|
click_link 'Create playlist'
|
||||||
|
fill_in 'Name', with: playlist[:name]
|
||||||
|
click_button 'Create'
|
||||||
|
playlist
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user