Browse Source

added to organisation factory and fixed tests

pull/822/head
Ted-U 3 years ago
parent
commit
c96c2acd89
  1. 1
      spec/factories/organisation.rb
  2. 20
      spec/features/organisation_spec.rb

1
spec/factories/organisation.rb

@ -8,6 +8,7 @@ FactoryBot.define do
postcode { "SW1P 4DF" } postcode { "SW1P 4DF" }
created_at { Time.zone.now } created_at { Time.zone.now }
updated_at { Time.zone.now } updated_at { Time.zone.now }
holds_own_stock { true }
end end
factory :organisation_la do factory :organisation_la do

20
spec/features/organisation_spec.rb

@ -40,21 +40,25 @@ RSpec.describe "User Features" do
expect(page).to have_current_path("/organisations/#{org_id}/details") expect(page).to have_current_path("/organisations/#{org_id}/details")
end end
context "when the user is a coordinator and the organisation holds housing stock" do context "when the user is a coordinator and the organisation does not hold housing stock" do
let(:organisation) { FactoryBot.create(:organisation, holds_own_stock: true) } before do
organisation.update(holds_own_stock: false)
end
it "shows schemes in the navigation bar" do it "does not show schemes in the navigation bar" do
visit("/logs") visit("/logs")
expect(page).to have_link("Schemes", href: "/schemes") expect(page).not_to have_link("Schemes", href: "/schemes")
end end
end end
context "when the user is a coordinator and the organisation does not hold housing stock" do context "when the user is a coordinator and the organisation holds housing stock" do
let(:organisation) { FactoryBot.create(:organisation, holds_own_stock: false) } before do
organisation.update(holds_own_stock: true)
end
it "does not show schemes in the navigation bar" do it "shows schemes in the navigation bar" do
visit("/logs") visit("/logs")
expect(page).not_to have_link("Schemes", href: "/schemes") expect(page).to have_link("Schemes", href: "/schemes")
end end
end end
end end

Loading…
Cancel
Save