adds create and destroy to the tags CRUD

This commit is contained in:
David Gil
2015-08-15 20:01:52 +02:00
parent 664f656fe3
commit a4ec38d752
8 changed files with 74 additions and 11 deletions

View File

@@ -74,14 +74,40 @@ feature 'Admin' do
end
context 'Tags' do
scenario 'marking tags as featured / unfeatured' do
unfeatured_tag = create :tag, :unfeatured, name: 'Mi barrio'
let(:unfeatured_tag) { create :tag, :unfeatured, name: 'Mi barrio' }
background do
login_as(administrator)
end
scenario 'adding a new tag' do
visit admin_tags_path
fill_in 'tag_name', with: 'Papeleras'
click_on 'Create Tag'
expect(page).to have_content 'Papeleras'
end
scenario 'deleting tag' do
unfeatured_tag
visit admin_tags_path
expect(page).to have_content 'Mi barrio'
click_link 'Delete Tag'
expect(page).not_to have_content 'Mi barrio'
end
scenario 'marking tags as featured / unfeatured' do
expect(unfeatured_tag).not_to be_featured
visit admin_tags_path
expect(page).to have_content 'Mi barrio'
save_and_open_page
check "tag_featured_#{unfeatured_tag.id}"
click_button 'Update Tag'