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.
 
 
 
 

33 lines
1.1 KiB

require "rails_helper"
RSpec.describe Form, type: :model do
describe ".next_question" do
let(:previous_question) { "tenant_age" }
it "returns the next question given the previous" do
expect(Form.next_question(previous_question)).to eq("tenant_gender")
end
end
describe ".first_question_for_subsection" do
let(:subsection) { "household_characteristics" }
it "returns the next question given the previous" do
expect(Form.first_question_for_subsection(subsection)).to eq("tenant_code")
end
end
describe ".previous_question" do
context "given a question in the middle of a subsection" do
let(:current_question) { "tenant_age" }
it "returns the previous question given the current" do
expect(Form.previous_question(current_question)).to eq("tenant_code")
end
end
context "given the first question in a subsection" do
let(:current_question) { "tenant_code" }
it "returns empty string" do
expect(Form.previous_question(current_question)).to be_nil
end
end
end
end