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
40 lines
941 B
Ruby
40 lines
941 B
Ruby
require "rails_helper"
|
|
|
|
describe "Email campaigns" do
|
|
let(:campaign1) { create(:campaign) }
|
|
let(:campaign2) { create(:campaign) }
|
|
|
|
before do
|
|
login_as(create(:administrator).user)
|
|
end
|
|
|
|
scenario "Track email templates" do
|
|
3.times { visit root_path(track_id: campaign1.track_id) }
|
|
5.times { visit root_path(track_id: campaign2.track_id) }
|
|
|
|
visit admin_stats_path
|
|
click_link campaign1.name
|
|
|
|
expect(page).to have_content "#{campaign1.name} (3)"
|
|
|
|
click_link "Go back"
|
|
click_link campaign2.name
|
|
|
|
expect(page).to have_content "#{campaign2.name} (5)"
|
|
end
|
|
|
|
scenario "Do not track erroneous track_ids" do
|
|
visit root_path(track_id: campaign1.track_id)
|
|
visit root_path(track_id: "999")
|
|
|
|
visit admin_stats_path
|
|
click_link campaign1.name
|
|
|
|
expect(page).to have_content "#{campaign1.name} (1)"
|
|
|
|
click_link "Go back"
|
|
|
|
expect(page).not_to have_content campaign2.name.to_s
|
|
end
|
|
end
|