commit
2543e37789
1 changed files with 24 additions and 10 deletions
|
@ -1,27 +1,41 @@
|
||||||
describe 'users/description/champs/render_list_champs.html.haml', type: :view do
|
describe 'users/description/champs/render_list_champs.html.haml', type: :view do
|
||||||
let(:type_champ) { create(:type_de_champ_public, :checkbox) }
|
let(:type_champ) { create(:type_de_champ_public, :checkbox) }
|
||||||
|
|
||||||
context "with a checkbox champ with value equals nil" do
|
context "with any champ" do
|
||||||
let!(:champ_checkbox_checked) { create(:champ, type_de_champ: type_champ, value: nil) }
|
let!(:champ) { create(:champ, type_de_champ: type_champ, value: nil) }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
render 'users/description/champs/render_list_champs.html.haml', champs: Champ.all, order_place: 0
|
render 'users/description/champs/render_list_champs.html.haml', champs: Champ.all, order_place: 0
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should not render a checked checkbox' do
|
it "should render the champ's libelle" do
|
||||||
expect(rendered).not_to have_css('input[type=checkbox][checked]')
|
expect(rendered).to have_content(champ.libelle)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context "with a checkbox champ with value equals 'on'" do
|
context "with a checkbox champ" do
|
||||||
let!(:champ_checkbox_checked) { create(:champ, type_de_champ: type_champ, value: 'on') }
|
context "whose value equals nil" do
|
||||||
|
let!(:champ_checkbox_checked) { create(:champ, type_de_champ: type_champ, value: nil) }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
render 'users/description/champs/render_list_champs.html.haml', champs: Champ.all, order_place: 0
|
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
|
end
|
||||||
|
|
||||||
it 'should render a checked checkbox' do
|
context "whose value equals 'on'" do
|
||||||
expect(rendered).to have_css('input[type=checkbox][checked]')
|
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
|
||||||
|
|
||||||
|
it 'should render a checked checkbox' do
|
||||||
|
expect(rendered).to have_css('input[type=checkbox][checked]')
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue