Browse Source

Added factory bot for supported housing schemes

pull/648/head
Ted 3 years ago committed by JG
parent
commit
58fb93a48f
  1. 8
      spec/factories/scheme.rb
  2. 14
      spec/features/schemes_spec.rb

8
spec/factories/scheme.rb

@ -0,0 +1,8 @@
FactoryBot.define do
factory :scheme do
code { Faker::Name.initials(number: 4) }
service { Faker::Name.name_with_middle }
managing_agent { Faker::Company.name }
created_at { Time.zone.now }
end
end

14
spec/features/schemes_spec.rb

@ -4,7 +4,19 @@ RSpec.describe "Supported housing scheme Features" do
context "when viewing list of schemes" do
context "when I am signed as a support user in there are schemes in the database" do
let(:user) { FactoryBot.create(:user, :support, last_sign_in_at: Time.zone.now) }
let!(:schemes) { FactoryBot.create(:schemes) }
let!(:schemes) { FactoryBot.create(:scheme) }
before do
visit("/logs")
fill_in("user[email]", with: user.email)
fill_in("user[password]", with: user.password)
click_button("Sign in")
end
it "displays the link to the supported housing" do
expect(page).to have_link("Supported housing")
end
end
end

Loading…
Cancel
Save