Skip to content

Commit

Permalink
fix unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lluft committed Oct 5, 2017
1 parent 2760dfd commit f1ab9ba
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions spec/lib/castle/client_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,19 +51,19 @@
let(:options) { { user_id: '1234', traits: { name: 'Jo' } } }

it do
assert_requested :post, 'https://api.castle.io/v1/identify',
times: 1,
body: request_body.to_json
assert_requested :post, 'https://api.castle.io/v1/identify', times: 1 do |req|
JSON.parse(req.body) == JSON.parse(request_body.to_json)
end
end
end

context 'string keys' do
let(:options) { { 'user_id' => '1234', 'traits' => { 'name' => 'Jo' } } }

it do
assert_requested :post, 'https://api.castle.io/v1/identify',
times: 1,
body: request_body.to_json
assert_requested :post, 'https://api.castle.io/v1/identify', times: 1 do |req|
JSON.parse(req.body) == JSON.parse(request_body.to_json)
end
end
end
end
Expand Down Expand Up @@ -167,19 +167,19 @@
let(:options) { { event: '$login.succeeded', user_id: '1234' } }

it do
assert_requested :post, 'https://api.castle.io/v1/track',
times: 1,
body: request_body.to_json
assert_requested :post, 'https://api.castle.io/v1/track', times: 1 do |req|
JSON.parse(req.body) == JSON.parse(request_body.to_json)
end
end
end

context 'string keys' do
let(:options) { { 'event' => '$login.succeeded', 'user_id' => '1234' } }

it do
assert_requested :post, 'https://api.castle.io/v1/track',
times: 1,
body: request_body.to_json
assert_requested :post, 'https://api.castle.io/v1/track', times: 1 do |req|
JSON.parse(req.body) == JSON.parse(request_body.to_json)
end
end
end
end
Expand Down

0 comments on commit f1ab9ba

Please sign in to comment.