Simplify system tests using a small window
This commit is contained in:
@@ -98,6 +98,15 @@ RSpec.configure do |config|
|
||||
Delayed::Worker.delay_jobs = false
|
||||
end
|
||||
|
||||
config.before(:each, :small_window) do
|
||||
@window_size = Capybara.current_window.size
|
||||
Capybara.current_window.resize_to(639, 479)
|
||||
end
|
||||
|
||||
config.after(:each, :small_window) do
|
||||
Capybara.current_window.resize_to(*@window_size)
|
||||
end
|
||||
|
||||
config.before(:each, :remote_translations) do
|
||||
allow(RemoteTranslations::Microsoft::AvailableLocales)
|
||||
.to receive(:available_locales).and_return(I18n.available_locales.map(&:to_s))
|
||||
|
||||
@@ -103,17 +103,7 @@ describe "Debates" do
|
||||
end
|
||||
end
|
||||
|
||||
context "On small devices" do
|
||||
let!(:window_size) { Capybara.current_window.size }
|
||||
|
||||
before do
|
||||
Capybara.current_window.resize_to(639, 479)
|
||||
end
|
||||
|
||||
after do
|
||||
Capybara.current_window.resize_to(*window_size)
|
||||
end
|
||||
|
||||
context "On small devices", :small_window do
|
||||
scenario "Shows links to share on telegram and whatsapp too" do
|
||||
visit debate_path(create(:debate))
|
||||
|
||||
|
||||
@@ -148,17 +148,7 @@ describe "Proposals" do
|
||||
end
|
||||
end
|
||||
|
||||
context "On small devices" do
|
||||
let!(:window_size) { Capybara.current_window.size }
|
||||
|
||||
before do
|
||||
Capybara.current_window.resize_to(639, 479)
|
||||
end
|
||||
|
||||
after do
|
||||
Capybara.current_window.resize_to(*window_size)
|
||||
end
|
||||
|
||||
context "On small devices", :small_window do
|
||||
scenario "Shows links to share on telegram and whatsapp too" do
|
||||
visit proposal_path(create(:proposal))
|
||||
|
||||
@@ -253,17 +243,7 @@ describe "Proposals" do
|
||||
end
|
||||
end
|
||||
|
||||
describe "Show sticky support button on mobile screens" do
|
||||
let!(:window_size) { Capybara.current_window.size }
|
||||
|
||||
before do
|
||||
Capybara.current_window.resize_to(640, 480)
|
||||
end
|
||||
|
||||
after do
|
||||
Capybara.current_window.resize_to(*window_size)
|
||||
end
|
||||
|
||||
describe "Show sticky support button on small screens", :small_window do
|
||||
scenario "On a first visit" do
|
||||
proposal = create(:proposal)
|
||||
visit proposal_path(proposal)
|
||||
|
||||
Reference in New Issue
Block a user