From f23b45879676aa2c5aeff05f52148cbf2fe34f85 Mon Sep 17 00:00:00 2001 From: JG Date: Thu, 9 Jun 2022 06:46:37 +0100 Subject: [PATCH] spec for index schemes --- spec/requests/schemes_controller_spec.rb | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 spec/requests/schemes_controller_spec.rb diff --git a/spec/requests/schemes_controller_spec.rb b/spec/requests/schemes_controller_spec.rb new file mode 100644 index 000000000..f7684701f --- /dev/null +++ b/spec/requests/schemes_controller_spec.rb @@ -0,0 +1,22 @@ +require "rails_helper" + +RSpec.describe SchemesController, type: :request do + let(:organisation) { user.organisation } + let(:headers) { { "Accept" => "text/html" } } + let(:page) { Capybara::Node::Simple.new(response.body) } + let(:user) { FactoryBot.create(:user, :data_coordinator) } + + describe "#index" do + context "when signed in as a support user" do + before do + allow(user).to receive(:need_two_factor_authentication?).and_return(false) + sign_in user + get "/supported-housing", headers:, params: + end + + it "shows the organisation list" do + expect(page).to have_content("Supported housing services") + end + end + end +end