From 12eee3f5d10c48680834398aa536d64a670876be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Tue, 19 Nov 2019 23:25:17 +0100 Subject: [PATCH] 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. --- spec/features/admin/dashboard/actions_spec.rb | 5 ++--- spec/models/dashboard/action_spec.rb | 3 +-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/spec/features/admin/dashboard/actions_spec.rb b/spec/features/admin/dashboard/actions_spec.rb index 2aa1aee23..654c41ea3 100644 --- a/spec/features/admin/dashboard/actions_spec.rb +++ b/spec/features/admin/dashboard/actions_spec.rb @@ -69,7 +69,6 @@ describe "Admin dashboard actions" do context "when editing an action" do let!(:action) { create :dashboard_action } - let(:title) { Faker::Lorem.sentence } before do visit admin_dashboard_actions_path @@ -79,10 +78,10 @@ describe "Admin dashboard actions" do end scenario "Updates the action" do - fill_in "dashboard_action_title", with: title + fill_in "dashboard_action_title", with: "Great action!" click_button "Save" - expect(page).to have_content(title) + expect(page).to have_content "Great action!" end scenario "Renders edit form in case data is invalid" do diff --git a/spec/models/dashboard/action_spec.rb b/spec/models/dashboard/action_spec.rb index f9453def5..e0bb10594 100644 --- a/spec/models/dashboard/action_spec.rb +++ b/spec/models/dashboard/action_spec.rb @@ -3,7 +3,7 @@ require "rails_helper" describe Dashboard::Action do subject do build :dashboard_action, - title: title, + title: "Take action!", description: description, day_offset: day_offset, required_supports: required_supports, @@ -11,7 +11,6 @@ describe Dashboard::Action do action_type: action_type end - let(:title) { Faker::Lorem.sentence } let(:description) { Faker::Lorem.sentence } let(:day_offset) { 0 } let(:required_supports) { 0 }