Fixed #272 Mocked up external server requests (#286)

* <Partially filled out the stub request>

* <Mocked requests to external servers>

* <Fixed style>

* Deleting rename.js

Accidentally slipped its way into the commit
This commit is contained in:
John Ma
2018-10-04 14:16:12 -04:00
committed by Jesus Federico
parent 5c3fd15323
commit daaf305c30
3 changed files with 35 additions and 1 deletions

View File

@ -22,6 +22,11 @@ Coveralls.wear!
require 'faker'
require 'factory_bot_rails'
require 'webmock/rspec'
# For testing, disable connections to external servers
WebMock.disable_net_connect!(allow_localhost: true)
# This file was generated by the `rails generate rspec:install` command. Conventionally, all
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
# The generated `.rspec` file contains `--require spec_helper` which will cause
@ -38,6 +43,22 @@ require 'factory_bot_rails'
#
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
RSpec.configure do |config|
# rspec webmock config goes here. To prevent tests from defaulting to
# external servers, api stubbing is used to simulate external server
# responses
config.before(:each) do
stub_request(:any, /#{ENV['BIGBLUEBUTTON_ENDPOINT']}/)
.with(
headers:
{
'Accept': '*/*',
'Accept-Encoding': 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3',
'User-Agent': 'Ruby',
}
)
.to_return(status: 200, body: "", headers: {})
end
# rspec-expectations config goes here. You can use an alternate
# assertion/expectation library such as wrong or the stdlib/minitest
# assertions if you prefer.