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.
44 lines
1.1 KiB
44 lines
1.1 KiB
6 months ago
|
require "rails_helper"
|
||
|
|
||
|
RSpec.describe Forms::BulkUploadLettings::Guidance do
|
||
|
include Rails.application.routes.url_helpers
|
||
|
|
||
|
subject(:bu_guidance) { described_class.new(year:, referrer:) }
|
||
|
|
||
|
let(:year) { 2024 }
|
||
|
|
||
|
describe "#back_path" do
|
||
|
context "when referrer is prepare-your-file" do
|
||
|
let(:referrer) { "prepare-your-file" }
|
||
|
|
||
|
it "returns the prepare your file path" do
|
||
|
expect(bu_guidance.back_path).to eq bulk_upload_lettings_log_path(id: "prepare-your-file", form: { year: })
|
||
|
end
|
||
|
end
|
||
|
|
||
|
context "when referrer is home" do
|
||
|
let(:referrer) { "home" }
|
||
|
|
||
|
it "returns the root path" do
|
||
|
expect(bu_guidance.back_path).to eq root_path
|
||
|
end
|
||
|
end
|
||
|
|
||
|
context "when referrer is guidance" do
|
||
|
let(:referrer) { "guidance" }
|
||
|
|
||
|
it "returns the main guidance page path" do
|
||
|
expect(bu_guidance.back_path).to eq guidance_path
|
||
|
end
|
||
|
end
|
||
|
|
||
|
context "when referrer is absent" do
|
||
|
let(:referrer) { nil }
|
||
|
|
||
|
it "returns the main guidance page path" do
|
||
|
expect(bu_guidance.back_path).to eq guidance_path
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
end
|