New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Agent for Boxcar.io #1323
Agent for Boxcar.io #1323
Conversation
Cool @prathyush! Would you be up for adding some RSpec specs to this as well? |
@cantino: I haven't written a spec before but I gave a shot at. However, I couldn't quite get to mock/stub HTTParty.post and check if the event is getting generated. Can you take a look at the spec and see if I'm missing anything obvious? |
The rspec run failed on Ruby 2.1.5 and Postgresql with the following error:
Not sure how to figure out which part of my diff would have caused this issue. |
@prathyush I reran that job, looks like it has just been a random failure. |
@dsander Awesome!. |
def receive(incoming_events) | ||
incoming_events.each do |event| | ||
payload_interpolated = interpolated(event) | ||
user_credentials = payload_interpolated['user_credentials'] || credential('boxcar_api_key') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's just do payload_interpolated['user_credentials']
and then change the instructions to
Please provide your access token in the `user_credentials` option. If you'd like to use a credential, set the `user_credentials` option to `{% credential CREDENTIAL_NAME %}`.
Left some suggestions @prathyush, thanks! |
@cantino Made the changes. Please take a look. |
describe "#receive" do | ||
it "sends a message" do | ||
stub(HTTParty).post { {"id" => 1, "message" => "blah", "title" => "blah","source_name" => "Custom Notification"} } | ||
@checker.receive([@event]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this spec fail if you break the code? I think you may need mock
here so that an expectation is set.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, it fails. I even found a bug (typo) when I first ran this.
Looks good, thanks for the contribution! |
New agent to send Boxcar notifications to iOS devices.