Submit social housing lettings and sales data (CORE)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
1.6 KiB

require "rails_helper"
RSpec.describe LettingsLogSummaryComponent, type: :component do
let(:support_user) { FactoryBot.create(:user, :support) }
let(:coordinator_user) { FactoryBot.create(:user) }
let(:propcode) { "P3647" }
let(:tenancycode) { "T62863" }
CLDC-1917 Add Startdate Validation (#1378) * feat: add validation with feature flag, typo fix and update tests * feat: flip feature toggle * feat: update feature toggle name * feat: fix form handler inequality * refactor: linting * refactor: use between in form handler * feat: remove feature toggle * feat: add dynamic date to lettings log factory * feat: fix log_summary_component_spec.rb tests * feat: update lettings_log.rb and start fixing lettings_log_spec.rb * feat: fix more tests * feat: fix more tests * feat: fix lettings log import service * refactor: linting * feat: fix checkboxes_spec.rb * feat: fix interruption_screen_helper_spec.rb * feat: fix check_answers_helper_spec.rb * feat: fix page_routing_spec.rb * feat: fix lettings_logs_field_import_service_spec.rb * feat: fix lettings_log_spec.rb * feat: fix question_spec.rb * feat: fix lettings_logs_controller_spec.rb * feat: fix check_answers_page_lettings_logs_spec.rb * feat: fix tenancy_validations_spec.rb * feat: fix validations_spec.rb * feat: fix accessible_autocomplete_spec.rb * feat: fix form_navigation_spec.rb * feat: fix soft_validations_spec.rb * feat: fix lettings_log_export_service_spec.rb * feat: fix saving_data_spec.rb * feat: fix page_spec.rb * feat: fix form_controller_spec.rb * refactor: linting * feat: fix subsection_spec.rb * feat: fix lettings_log_spec.rb * feat: fix financial_validations_spec.rb * feat: fix tasklist_page_spec.rb * feat: fix conditional_questions_spec.rb * feat: fix form_page_error_helper_spec.rb and log_summary_component_spec.rb * feat: fix lettings_log_csv_service_spec.rb * feat: fix tasklist_helper_spec.rb * refactor: linting * refactor: linting * feat: fix lettings_log_spec.rb * refactor: linting * refactor: replace financial year with collection yaer * feat: respond to PR comments pt. 1 * feat: respond to PR comments pt. 2
2 years ago
let(:lettings_log) { FactoryBot.create(:lettings_log, needstype: 1, tenancycode:, propcode:, startdate: Time.zone.today) }
context "when rendering lettings log for a support user" do
it "shows the log summary with organisational relationships" do
result = render_inline(described_class.new(current_user: support_user, log: lettings_log))
expect(result).to have_link(lettings_log.id.to_s)
expect(result).to have_text(lettings_log.tenancycode)
expect(result).to have_text(lettings_log.propcode)
expect(result).to have_text("General needs")
expect(result).to have_text("Tenancy starts #{Time.zone.today.strftime('%e %B %Y').strip}")
expect(result).to have_text("Created #{Time.zone.today.strftime('%e %B %Y').strip}")
expect(result).to have_text("by Danny Rojas")
expect(result).to have_content("Owned by\n DLUHC")
expect(result).to have_content("Managed by\n DLUHC")
end
end
context "when rendering lettings log for a data coordinator user" do
it "does not show the user who the log is owned and managed by" do
result = render_inline(described_class.new(current_user: coordinator_user, log: lettings_log))
expect(result).not_to have_content("Owned by")
expect(result).not_to have_content("Managed by")
end
end
end