2017-11-22 17:35:15 +01:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe 'users/description/champs/engagement.html.haml', type: :view do
|
2018-02-13 17:00:19 +01:00
|
|
|
let(:type_champ) { create(:type_de_champ, type_champ: :engagement) }
|
2017-11-22 17:35:15 +01:00
|
|
|
|
|
|
|
subject { render 'users/description/champs/engagement.html.haml', champ: champ }
|
|
|
|
|
|
|
|
context "when the value is on" do
|
|
|
|
let!(:champ) { create(:champ, type_de_champ: type_champ, value: "on").decorate }
|
|
|
|
|
|
|
|
it { is_expected.to have_selector("input[type='checkbox'][checked]") }
|
|
|
|
end
|
|
|
|
|
|
|
|
context "when the value is nil" do
|
|
|
|
let!(:champ) { create(:champ, type_de_champ: type_champ, value: nil).decorate }
|
|
|
|
|
|
|
|
it { is_expected.to have_selector("input[type='checkbox']") }
|
|
|
|
it { is_expected.not_to have_selector("input[type='checkbox'][checked]") }
|
|
|
|
end
|
|
|
|
end
|