baarkerlounger
3 years ago
4 changed files with 42 additions and 3 deletions
@ -0,0 +1,5 @@
|
||||
class RentPeriod |
||||
def self.rent_period_mappings |
||||
FormHandler.instance.current_form.get_question("period", nil).answer_options |
||||
end |
||||
end |
@ -0,0 +1,16 @@
|
||||
require "rails_helper" |
||||
|
||||
RSpec.describe RentPeriod, type: :model do |
||||
describe "rent period mapping" do |
||||
let(:form) { Form.new("spec/fixtures/forms/2021_2022.json", "2021_2022") } |
||||
|
||||
before do |
||||
allow(FormHandler.instance).to receive(:current_form).and_return(form) |
||||
end |
||||
|
||||
it "maps rent period id to display names" do |
||||
expect(described_class.rent_period_mappings).to be_a(Hash) |
||||
expect(described_class.rent_period_mappings["2"]).to eq({ "value" => "Weekly for 52 weeks" }) |
||||
end |
||||
end |
||||
end |
Loading…
Reference in new issue