Browse Source
* CLDC-3532: Make BU guidance back link depend on referrer * Add tests for back_path * Add guidance to homepage * CLDC-3526: Update back_path --------- Co-authored-by: Kat <katrina@kosiak.co.uk>pull/2487/head
Rachael Booth
6 months ago
committed by
GitHub
12 changed files with 112 additions and 9 deletions
@ -0,0 +1,43 @@
|
||||
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 |
@ -0,0 +1,43 @@
|
||||
require "rails_helper" |
||||
|
||||
RSpec.describe Forms::BulkUploadSales::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_sales_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 |
Loading…
Reference in new issue