Sha256: 72fafc9df8cccf0a57fa9ffc7b966329d8a927a4b38547b86c07588580174cf4
Contents?: true
Size: 1.25 KB
Versions: 13
Compression:
Stored size: 1.25 KB
Contents
require 'rails_helper' describe Fe::TextField do describe '#ptemplate' do it 'default style' do text_field = Fe::TextField.new expect(text_field.ptemplate).to eq("fe/text_field") end it 'essay style' do text_field = Fe::TextField.new text_field.style = "essay" expect(text_field.ptemplate).to eq("fe/text_area_field") end end it 'should match conditional_match' do qs = create(:question_sheet) app = create(:application) app.question_sheets << qs e = create(:text_field_element, conditional_answer: 'a;b', style: 'drop-down') qs.pages << create(:page) qs.pages.reload.first.elements << e a = create(:answer, question_id: e.id, value: 'b', answer_sheet_id: app.id) expect(e.conditional_match(app)).to be true end it "should not match conditional_match if the answer doesn't match" do qs = create(:question_sheet) app = create(:application) app.question_sheets << qs e = create(:text_field_element, conditional_answer: 'a;b', style: 'drop-down') qs.pages << create(:page) qs.pages.reload.first.elements << e a = create(:answer, question_id: e.id, value: 'c', answer_sheet_id: app.id) expect(e.conditional_match(app)).to_not be true end end
Version data entries
13 entries across 13 versions & 1 rubygems