Adapt existing milestone-related specs to fit the new requirement

This commit is contained in:
Angel Perez
2017-12-13 19:46:07 -04:00
parent 03ae14c613
commit 1e1028dcb4
3 changed files with 9 additions and 4 deletions

View File

@@ -362,6 +362,7 @@ FactoryGirl.define do
association :investment, factory: :budget_investment
sequence(:title) { |n| "Budget investment milestone #{n} title" }
description 'Milestone description'
publication_date Time.zone.today
end
factory :vote do

View File

@@ -18,6 +18,7 @@ feature 'Admin budget investment milestones' do
expect(page).to have_content("Milestone")
expect(page).to have_content(milestone.title)
expect(page).to have_content(milestone.id)
expect(page).to have_content(milestone.publication_date.to_date)
end
scenario 'Displaying no_milestones text' do
@@ -36,11 +37,13 @@ feature 'Admin budget investment milestones' do
fill_in 'budget_investment_milestone_title', with: 'New title milestone'
fill_in 'budget_investment_milestone_description', with: 'New description milestone'
fill_in 'budget_investment_milestone_publication_date', with: Time.zone.today.to_date
click_button 'Create milestone'
expect(page).to have_content 'New title milestone'
expect(page).to have_content 'New description milestone'
expect(page).to have_content Time.zone.today.to_date
end
scenario "Show validation errors on milestone form" do
@@ -53,7 +56,7 @@ feature 'Admin budget investment milestones' do
click_button 'Create milestone'
within "#new_budget_investment_milestone" do
expect(page).to have_content "can't be blank"
expect(page).to have_content "can't be blank", count: 2
expect(page).to have_content 'New description milestone'
end
end
@@ -72,11 +75,13 @@ 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_publication_date', with: Time.zone.today.to_date
click_button 'Update milestone'
expect(page).to have_content 'Changed title'
expect(page).to have_content 'Changed description'
expect(page).to have_content Time.zone.today.to_date
expect(page).to have_link 'Show image'
end
end

View File

@@ -493,8 +493,7 @@ feature 'Budget Investments' do
scenario "Show milestones", :js do
user = create(:user)
investment = create(:budget_investment)
milestone = create(:budget_investment_milestone, investment: investment, title: "New text to show",
created_at: DateTime.new(2015, 9, 19).utc)
milestone = create(:budget_investment_milestone, investment: investment, title: "New text to show")
image = create(:image, imageable: milestone)
login_as(user)
@@ -505,7 +504,7 @@ feature 'Budget Investments' do
within("#tab-milestones") do
expect(page).to have_content(milestone.title)
expect(page).to have_content(milestone.description)
expect(page).to have_content("Published 2015-09-19")
expect(page).to have_content(Time.zone.today.to_date)
expect(page.find("#image_#{milestone.id}")['alt']).to have_content image.title
end
end