Skip to content

Commit

Permalink
PR feedback and fixing CI tests
Browse files Browse the repository at this point in the history
  • Loading branch information
joshcanhelp committed Sep 25, 2018
1 parent 0760d8d commit f245673
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 21 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ group :development do
end

group :test do
gem 'webmock'
gem 'webmock', require: false
end
13 changes: 4 additions & 9 deletions spec/lib/auth0/api/authentication_endpoints_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,12 @@
it { expect(@instance).to respond_to(:obtain_access_token) }
it "is expected to make post request to '/oauth/token'" do
allow(@instance).to receive(:post).with(
'/oauth/token',
client_id: @instance.client_id,
client_secret: @instance.client_secret,
grant_type: 'client_credentials'
).and_return('access_token' => 'AccessToken')
'/oauth/token', client_id: @instance.client_id, client_secret: @instance.client_secret, grant_type: 'client_credentials'
)
.and_return('access_token' => 'AccessToken')

expect(@instance).to receive(:post).with(
'/oauth/token',
client_id: @instance.client_id,
client_secret: @instance.client_secret,
grant_type: 'client_credentials'
'/oauth/token', client_id: @instance.client_id, client_secret: @instance.client_secret, grant_type: 'client_credentials'
)
expect(@instance.obtain_access_token).to eql 'AccessToken'
end
Expand Down
18 changes: 10 additions & 8 deletions spec/lib/auth0/client_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
describe 'V2 client without token' do

before do
stub_token
stub_api_token
end

context 'should try to get an API token' do
Expand Down Expand Up @@ -132,15 +132,17 @@
end
end

def stub_token
def stub_api_token
stub_request(:post, "https://#{domain}/oauth/token")
.with(
body: hash_including({
grant_type: 'client_credentials',
client_id: client_id,
client_secret: client_secret,
audience: audience
})
body: hash_including(
{
grant_type: 'client_credentials',
client_id: client_id,
client_secret: client_secret,
audience: audience
}
)
)
.to_return(
headers: { 'Content-Type' => 'application/json' },
Expand Down
4 changes: 3 additions & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
require 'dotenv'

Dotenv.load

require 'webmock/rspec'
WebMock.allow_net_connect!

mode = ENV['MODE'] || 'unit'

$LOAD_PATH.unshift File.expand_path('..', __FILE__)
Expand Down
2 changes: 0 additions & 2 deletions spec/spec_helper_unit.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
require 'webmock/rspec'

RSpec.configure do |config|
config.fail_fast = true
end

0 comments on commit f245673

Please sign in to comment.