Files
grecia/spec/system/admin/poll/active_polls_spec.rb
Javi Martín 405c6e6d14 Test data introduced from the user's point of view
Users don't care about database content; they care about what they see
on the screen.

Writing tests this way we also avoid potencial database inconsistencies
due to accessing the database after starting the browser.
2021-04-16 14:33:26 +02:00

41 lines
1.1 KiB
Ruby

require "rails_helper"
describe "Admin Active polls", :admin do
scenario "Add" do
visit admin_polls_path
click_link "Polls description"
expect(page).to have_ckeditor "Description", with: ""
fill_in_ckeditor "Description", with: "Active polls description"
click_button "Save"
expect(page).to have_content "Polls description updated successfully."
click_link "Polls description"
expect(page).to have_ckeditor "Description", with: "Active polls description"
end
scenario "Edit" do
create(:active_poll, description_en: "Old description")
visit polls_path
within ".polls-description" do
expect(page).to have_content "Old description"
end
visit edit_admin_active_polls_path
fill_in_ckeditor "Description", with: "New description"
click_button "Save"
expect(page).to have_content "Polls description updated successfully."
visit polls_path
within ".polls-description" do
expect(page).not_to have_content "Old description"
expect(page).to have_content "New description"
end
end
end