Browse Source

swap out doubles for factories

pull/1642/head
Phil Lee 3 years ago
parent
commit
db04039b8d
  1. 35
      spec/views/schemes/check_answers.html.erb_spec.rb
  2. 30
      spec/views/schemes/show.html.erb_spec.rb

35
spec/views/schemes/check_answers.html.erb_spec.rb

@ -1,38 +1,9 @@
require "rails_helper"
RSpec.describe "schemes/check_answers.html.erb" do
let(:user) { build(:user) }
let(:scheme) do
instance_double(
Scheme,
owning_organisation: user.organisation,
id: 1,
service_name: "some name",
id_to_display: "S1",
sensitive: false,
scheme_type: "some type",
registered_under_care_act: false,
arrangement_type: "some other type",
primary_client_group: false,
has_other_client_group: false,
secondary_client_group: false,
support_type: "some support type",
intended_stay: "some intended stay",
available_from: 1.week.ago,
scheme_deactivation_periods: [],
status: :active,
to_model: Scheme.new,
check_details_attributes: [],
check_primary_client_attributes: [
{ name: "Primary client group", value: "foo", id: "primary_client_group" },
],
check_secondary_client_confirmation_attributes: [],
check_support_attributes: [],
confirmed?: false,
errors: ActiveModel::Errors.new(Scheme.new),
)
end
let(:organisation) { create(:organisation, holds_own_stock: true) }
let(:user) { build(:user, organisation:) }
let(:scheme) { create(:scheme, owning_organisation: user.organisation) }
context "when a data provider" do
it "does not render change links" do

30
spec/views/schemes/show.html.erb_spec.rb

@ -1,34 +1,10 @@
require "rails_helper"
RSpec.describe "schemes/show.html.erb" do
before do
allow(FeatureToggle).to receive(:scheme_toggle_enabled?).and_return(true)
end
context "when data provider" do
let(:user) { build(:user) }
let(:scheme) do
instance_double(
Scheme,
owning_organisation: user.organisation,
id: 1,
service_name: "some name",
id_to_display: "S1",
sensitive: false,
scheme_type: "some type",
registered_under_care_act: false,
arrangement_type: "some other type",
primary_client_group: false,
has_other_client_group: false,
secondary_client_group: false,
support_type: "some support type",
intended_stay: "some intended stay",
available_from: 1.week.ago,
scheme_deactivation_periods: [],
status: :active,
)
end
let(:organisation) { create(:organisation, holds_own_stock: true) }
let(:user) { build(:user, organisation:) }
let(:scheme) { create(:scheme, owning_organisation: user.organisation) }
it "does not render button to deactivate schemes" do
assign(:scheme, scheme)

Loading…
Cancel
Save