Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions lib/mixpanel-ruby/consumer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ def send!(type, message)
if result['status'] != 1
raise ServerError.new("Could not write to Mixpanel, server responded with #{response_code} returning: '#{response_body}'")
end

[response_code, response_body]
end

# This method was deprecated in release 2.0.0, please use send! instead
Expand Down
6 changes: 6 additions & 0 deletions spec/mixpanel-ruby/consumer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,12 @@
expect(WebMock).to have_requested(:post, 'https://api.mixpanel.com/track').
with(:body => {'data' => 'IlRFU1QgRVZFTlQgTUVTU0FHRSI=', 'verbose' => '1' })
end

it 'should return the response status and body' do
stub_request(:any, 'https://api.mixpanel.com/track').to_return({:body => '{"status": 1, "error": null}'})
expect(subject.send!(:event, {'data' => 'TEST EVENT MESSAGE'}.to_json))
.to eq(['200', '{"status": 1, "error": null}'])
end
end

context 'raw consumer' do
Expand Down