Add feature specs to test new admin features and documents' show in users view

This commit is contained in:
iagirre
2017-12-14 13:53:03 +01:00
parent 01a8c55936
commit ff50dc1a00
2 changed files with 11 additions and 1 deletions

View File

@@ -12,12 +12,16 @@ feature 'Admin budget investment milestones' do
context "Index" do
scenario 'Displaying milestones' do
milestone = create(:budget_investment_milestone, investment: @investment)
create(:image, imageable: milestone)
document = create(:document, documentable: milestone)
visit admin_budget_budget_investment_path(@investment.budget, @investment)
expect(page).to have_content("Milestone")
expect(page).to have_content(milestone.title)
expect(page).to have_content(milestone.id)
expect(page).to have_link 'Show image'
expect(page).to have_link document.title
end
scenario 'Displaying no_milestones text' do
@@ -60,11 +64,13 @@ feature 'Admin budget investment milestones' do
end
context "Edit" do
scenario "Change title and description" do
scenario "Change title, description and document names" do
milestone = create(:budget_investment_milestone, investment: @investment)
create(:image, imageable: milestone)
document = create(:document, documentable: milestone)
visit admin_budget_budget_investment_path(@investment.budget, @investment)
expect(page).to have_link document.title
click_link milestone.title
@@ -72,12 +78,14 @@ feature 'Admin budget investment milestones' do
fill_in 'budget_investment_milestone_title', with: 'Changed title'
fill_in 'budget_investment_milestone_description', with: 'Changed description'
fill_in 'budget_investment_milestone_documents_attributes_0_title', with: 'New document title'
click_button 'Update milestone'
expect(page).to have_content 'Changed title'
expect(page).to have_content 'Changed description'
expect(page).to have_link 'Show image'
expect(page).to have_link 'New document title'
end
end

View File

@@ -496,6 +496,7 @@ feature 'Budget Investments' do
milestone = create(:budget_investment_milestone, investment: investment, title: "New text to show",
created_at: DateTime.new(2015, 9, 19).utc)
image = create(:image, imageable: milestone)
document = create(:document, documentable: milestone)
login_as(user)
visit budget_investment_path(budget_id: investment.budget.id, id: investment.id)
@@ -507,6 +508,7 @@ feature 'Budget Investments' do
expect(page).to have_content(milestone.description)
expect(page).to have_content("Published 2015-09-19")
expect(page.find("#image_#{milestone.id}")['alt']).to have_content image.title
expect(page).to have_link document.title
end
end