mirror of
https://github.com/ENSL/ensl.org.git
synced 2024-12-25 12:01:03 +00:00
Stub Google Calendar's JSON response globally for each spec
This commit is contained in:
parent
ee0f92262d
commit
8f73a18500
2 changed files with 8 additions and 6 deletions
|
@ -1,13 +1,7 @@
|
|||
require 'spec_helper'
|
||||
|
||||
feature 'Google Calendar widget', js: :true do
|
||||
let(:events_list_json) { JSON.parse(File.read(Rails.root.join('spec/fixtures/google_calendar.json'))) }
|
||||
|
||||
before do
|
||||
GoogleCalendar::Request.stub(:events_list) do
|
||||
GoogleCalendar::EventList.new(events_list_json, Time.zone.name)
|
||||
end
|
||||
|
||||
visit root_path
|
||||
end
|
||||
|
||||
|
|
|
@ -31,4 +31,12 @@ RSpec.configure do |config|
|
|||
config.fixture_path = "#{::Rails.root}/spec/fixtures"
|
||||
config.order = 'random'
|
||||
config.use_transactional_fixtures = false
|
||||
|
||||
config.before(:each) do
|
||||
events_list_json = JSON.parse(File.read(Rails.root.join('spec/fixtures/google_calendar.json')))
|
||||
|
||||
GoogleCalendar::Request.stub(:events_list) do
|
||||
GoogleCalendar::EventList.new(events_list_json, Time.zone.name)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue