We were very inconsistent regarding these rules. Personally I prefer no empty lines around blocks, clases, etc... as recommended by the Ruby style guide [1], and they're the default values in rubocop, so those are the settings I'm applying. The exception is the `private` access modifier, since we were leaving empty lines around it most of the time. That's the default rubocop rule as well. Personally I don't have a strong preference about this one. [1] https://rubystyle.guide/#empty-lines-around-bodies
43 lines
1.1 KiB
Ruby
43 lines
1.1 KiB
Ruby
require "rails_helper"
|
|
|
|
describe "Admin Active polls" do
|
|
before do
|
|
admin = create(:administrator)
|
|
login_as(admin.user)
|
|
end
|
|
|
|
scenario "Add", :js do
|
|
expect(ActivePoll.first).to be nil
|
|
|
|
visit admin_polls_path
|
|
click_link "Polls description"
|
|
|
|
fill_in_ckeditor "Description", with: "Active polls description"
|
|
click_button "Save"
|
|
|
|
expect(page).to have_content "Polls description updated successfully."
|
|
expect(ActivePoll.first.description).to eq "<p>Active polls description</p>\r\n"
|
|
end
|
|
|
|
scenario "Edit", :js 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
|