Skip to content

Commit

Permalink
Fixed bigbluebutton#272 Mocked up external server requests (bigbluebu…
Browse files Browse the repository at this point in the history
…tton#286)

* <Partially filled out the stub request>

* <Mocked requests to external servers>

* <Fixed style>

* Deleting rename.js

Accidentally slipped its way into the commit
  • Loading branch information
jiama843 authored and jfederico committed Oct 4, 2018
1 parent 5c3fd15 commit daaf305
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 1 deletion.
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ group :test do
gem 'shoulda-matchers', '~> 3.1'
gem 'faker'
gem "factory_bot_rails"
gem 'webmock'

# Ruby linting.
gem 'rubocop'
Expand Down
14 changes: 13 additions & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ GEM
i18n (>= 0.7, < 2)
minitest (~> 5.1)
tzinfo (~> 1.1)
addressable (2.5.2)
public_suffix (>= 2.0.2, < 4.0)
arel (7.1.4)
ast (2.4.0)
autoprefixer-rails (8.6.4)
Expand Down Expand Up @@ -68,6 +70,8 @@ GEM
simplecov (>= 0.7)
term-ansicolor
thor
crack (0.4.3)
safe_yaml (~> 1.0.0)
crass (1.0.4)
diff-lcs (1.3)
docile (1.3.1)
Expand All @@ -91,6 +95,7 @@ GEM
ffi (1.9.25)
globalid (0.4.1)
activesupport (>= 4.2.0)
hashdiff (0.3.7)
hashie (3.5.7)
http-cookie (1.0.3)
domain_name (~> 0.5)
Expand Down Expand Up @@ -168,6 +173,7 @@ GEM
pg (0.21.0)
popper_js (1.12.9)
powerpack (0.1.2)
public_suffix (3.0.3)
puma (3.11.4)
pyu-ruby-sasl (0.0.3.3)
rack (2.0.5)
Expand Down Expand Up @@ -239,6 +245,7 @@ GEM
unicode-display_width (~> 1.0, >= 1.0.1)
ruby-progressbar (1.9.0)
rubyntlm (0.6.2)
safe_yaml (1.0.4)
sass (3.5.6)
sass-listen (~> 4.0.0)
sass-listen (4.0.0)
Expand Down Expand Up @@ -297,6 +304,10 @@ GEM
activemodel (>= 5.0)
bindex (>= 0.4.0)
railties (>= 5.0)
webmock (3.4.2)
addressable (>= 2.3.6)
crack (>= 0.3.2)
hashdiff
websocket-driver (0.6.5)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.3)
Expand Down Expand Up @@ -344,6 +355,7 @@ DEPENDENCIES
tzinfo-data
uglifier (>= 1.3.0)
web-console (>= 3.3.0)
webmock

BUNDLED WITH
1.16.3
1.16.4
21 changes: 21 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@
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
Expand All @@ -38,6 +43,22 @@
#
# 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.
Expand Down

0 comments on commit daaf305

Please sign in to comment.