Reformat the _render_list_champs template test

This commit is contained in:
gregoirenovel 2017-04-26 12:44:32 +02:00
parent 6e8ee504a9
commit 4ce6c92394

View file

@ -1,27 +1,29 @@
describe 'users/description/champs/render_list_champs.html.haml', type: :view do
let(:type_champ) { create(:type_de_champ_public, :checkbox) }
context "with a checkbox champ with value equals nil" do
let!(:champ_checkbox_checked) { create(:champ, type_de_champ: type_champ, value: nil) }
context "with a checkbox champ" do
context "whose value equals nil" do
let!(:champ_checkbox_checked) { create(:champ, type_de_champ: type_champ, value: nil) }
before do
render 'users/description/champs/render_list_champs.html.haml', champs: Champ.all, order_place: 0
before do
render 'users/description/champs/render_list_champs.html.haml', champs: Champ.all, order_place: 0
end
it 'should not render a checked checkbox' do
expect(rendered).not_to have_css('input[type=checkbox][checked]')
end
end
it 'should not render a checked checkbox' do
expect(rendered).not_to have_css('input[type=checkbox][checked]')
end
end
context "whose value equals 'on'" do
let!(:champ_checkbox_checked) { create(:champ, type_de_champ: type_champ, value: 'on') }
context "with a checkbox champ with value equals 'on'" do
let!(:champ_checkbox_checked) { create(:champ, type_de_champ: type_champ, value: 'on') }
before do
render 'users/description/champs/render_list_champs.html.haml', champs: Champ.all, order_place: 0
end
before do
render 'users/description/champs/render_list_champs.html.haml', champs: Champ.all, order_place: 0
end
it 'should render a checked checkbox' do
expect(rendered).to have_css('input[type=checkbox][checked]')
it 'should render a checked checkbox' do
expect(rendered).to have_css('input[type=checkbox][checked]')
end
end
end