Skip to content

Commit

Permalink
Add additional spec for organization_id support in events (#289)
Browse files Browse the repository at this point in the history
* Add spec for organization

* typo

* rubocop
  • Loading branch information
alisherry authored Apr 26, 2024
1 parent d6c8c4f commit 13f0dcf
Show file tree
Hide file tree
Showing 3 changed files with 103 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/workos/events.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class << self
#
# @param [Hash] options An options hash
# @option options [String] event The type of event
# retrieved.
# @option options [String] organization_id Limit scope of events to an organization
# @option options [String] limit Maximum number of records to return.
# @option options [String] after Pagination cursor to receive records
# after a provided Event ID.
Expand Down
22 changes: 22 additions & 0 deletions spec/lib/workos/event_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -83,5 +83,27 @@
end
end
end

context 'with the organization_id option' do
it 'forms the proper request to the API' do
request_args = [
'/events?organization_id=org_1234',
'Content-Type' => 'application/json'
]

expected_request = Net::HTTP::Get.new(*request_args)

expect(Net::HTTP::Get).to receive(:new).with(*request_args).
and_return(expected_request)

VCR.use_cassette 'events/list_events_with_organization_id' do
events = described_class.list_events(
organization_id: 'org_1234',
)

expect(events.data.size).to eq(1)
end
end
end
end
end

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 13f0dcf

Please sign in to comment.