Avoid invalid random titles in dashboard specs

Generating a random title with `Faker::Lorem.sentence` sometimes caused
validation errors in tests because the generated sentence was more than
80 characters long.
This commit is contained in:
Javi Martín
2019-11-19 23:25:17 +01:00
parent e629e4e245
commit 12eee3f5d1
2 changed files with 3 additions and 5 deletions

View File

@@ -69,7 +69,6 @@ describe "Admin dashboard actions" do
context "when editing an action" do context "when editing an action" do
let!(:action) { create :dashboard_action } let!(:action) { create :dashboard_action }
let(:title) { Faker::Lorem.sentence }
before do before do
visit admin_dashboard_actions_path visit admin_dashboard_actions_path
@@ -79,10 +78,10 @@ describe "Admin dashboard actions" do
end end
scenario "Updates the action" do scenario "Updates the action" do
fill_in "dashboard_action_title", with: title fill_in "dashboard_action_title", with: "Great action!"
click_button "Save" click_button "Save"
expect(page).to have_content(title) expect(page).to have_content "Great action!"
end end
scenario "Renders edit form in case data is invalid" do scenario "Renders edit form in case data is invalid" do

View File

@@ -3,7 +3,7 @@ require "rails_helper"
describe Dashboard::Action do describe Dashboard::Action do
subject do subject do
build :dashboard_action, build :dashboard_action,
title: title, title: "Take action!",
description: description, description: description,
day_offset: day_offset, day_offset: day_offset,
required_supports: required_supports, required_supports: required_supports,
@@ -11,7 +11,6 @@ describe Dashboard::Action do
action_type: action_type action_type: action_type
end end
let(:title) { Faker::Lorem.sentence }
let(:description) { Faker::Lorem.sentence } let(:description) { Faker::Lorem.sentence }
let(:day_offset) { 0 } let(:day_offset) { 0 }
let(:required_supports) { 0 } let(:required_supports) { 0 }