diff --git a/spec/integration/actions/edit_spec.rb b/spec/integration/actions/edit_spec.rb
index f44e655296..9704a65f9a 100644
--- a/spec/integration/actions/edit_spec.rb
+++ b/spec/integration/actions/edit_spec.rb
@@ -873,7 +873,7 @@ class HelpTest < Tableless
record = FieldTest.create
visit edit_path(model_name: 'field_test', id: record.id)
expect do
- check 'field_test[open]'
+ find('label[for=field_test_open_1]').click
click_button 'Save'
end.to change { record.reload.open }.from(nil).to(true)
end
diff --git a/spec/integration/fields/boolean_spec.rb b/spec/integration/fields/boolean_spec.rb
index 088a1cdd3e..b9b7075da5 100644
--- a/spec/integration/fields/boolean_spec.rb
+++ b/spec/integration/fields/boolean_spec.rb
@@ -53,19 +53,27 @@
end
end
- it 'shows a checkbox' do
+ it 'shows 2 radio buttons' do
visit new_path(model_name: 'field_test')
is_expected.to have_content 'New Field test'
- is_expected.to have_css '[type="checkbox"][name="field_test[boolean_field]"]'
+ expect(all('[name="field_test[boolean_field]"]').map { |e| e['value'] }).to eq %w[1 0]
end
it 'can be updated' do
visit edit_path(model_name: 'field_test', id: field_test.id)
- find('.boolean_type input').check
+
+ # change the value to true and assert the values
+ find('.boolean_type label.success').click
click_button 'Save and edit'
+ # validate that the success button rendered and is active
+ expect(page).to have_selector('.boolean_type input[value="1"][checked]')
+ # validate the value is true
expect(field_test.reload.boolean_field).to be true
- find('.boolean_type input').uncheck
+
+ # change the value to false and assert the values
+ find('.boolean_type label.danger').click
click_button 'Save and edit'
+ expect(page).to have_selector('.boolean_type input[value="0"][checked]')
expect(field_test.reload.boolean_field).to be false
end
end