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
35 lines
1.6 KiB
2 years ago
|
require "rails_helper"
|
||
|
|
||
2 years ago
|
RSpec.describe LettingsLogSummaryComponent, type: :component do
|
||
2 years ago
|
let(:support_user) { FactoryBot.create(:user, :support) }
|
||
|
let(:coordinator_user) { FactoryBot.create(:user) }
|
||
2 years ago
|
let(:propcode) { "P3647" }
|
||
|
let(:tenancycode) { "T62863" }
|
||
2 years ago
|
let(:lettings_log) { FactoryBot.create(:lettings_log, needstype: 1, tenancycode:, propcode:, startdate: Time.zone.today) }
|
||
2 years ago
|
|
||
2 years ago
|
context "when rendering lettings log for a support user" do
|
||
2 years ago
|
it "shows the log summary with organisational relationships" do
|
||
2 years ago
|
result = render_inline(described_class.new(current_user: support_user, log: lettings_log))
|
||
2 years ago
|
|
||
2 years ago
|
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)
|
||
2 years ago
|
expect(result).to have_text("General needs")
|
||
2 years ago
|
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}")
|
||
2 years ago
|
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
|
||
|
|
||
2 years ago
|
context "when rendering lettings log for a data coordinator user" do
|
||
2 years ago
|
it "does not show the user who the log is owned and managed by" do
|
||
2 years ago
|
result = render_inline(described_class.new(current_user: coordinator_user, log: lettings_log))
|
||
2 years ago
|
|
||
2 years ago
|
expect(result).not_to have_content("Owned by")
|
||
|
expect(result).not_to have_content("Managed by")
|
||
|
end
|
||
|
end
|
||
2 years ago
|
end
|