Skip to content
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

Fixed expectation failures when client.say is passed extra arguments #160

Merged
merged 3 commits into from
Sep 21, 2017

Conversation

gcraig99
Copy link
Contributor

Fixed expectation failures when client.say is passed extra arguments such as as_user: true
Added test cases for this situation as well.
Closes #159

@@ -28,3 +28,31 @@ http_interactions:
string: '{"ok":false,"error":"unknown"}'
http_version:
recorded_at: Tue, 28 Apr 2015 12:55:22 GMT
- request:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You have a spec that's making 3 requests somehow, this shouldn't be here, especially that the last one is not responding with migration_in_progress.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't my spec at all. None of my code changes deal with this part of the code whatsoever. This spec was failing on my last PR #157 because the slack-ruby-client was selecting rtm.connect where it used to call rtm.start and there were no fixtures for that method. I updated the fixture file in the last PR, but the test failed again on this PR, but only on the build server. Worked on my machine (I know), so I surmised that the client had tried to use rtm.start on the build machine, as it has the ability to choose either now. So to handle that I simply duplicated the fixture responses to handle either rtm.start or rtm.connect.

If that's not the approach you want to take, I'm open to suggestions.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's fine, but the last request that doesn't return migration in progress shouldn't be there then. Which spec fails with that?

@dblock
Copy link
Collaborator

dblock commented Sep 21, 2017

This is great, see my comment re yml fix and it can be merged.

As a followup item, maybe we should add support for taking a hash in respond_with_slack_message for exact expectation?

string: '{"ok":false,"error":"migration_in_progress"}'
http_version:
recorded_at: Tue, 28 Apr 2015 12:55:22 GMT
- request:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one should not be necessary.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the '{"ok":false,"error":"unknown"}' responses are removed, the migration_in_progress spec fails. It's part of the expectations:

1) SlackRubyBot::Server retries on rtm.start errors migration_in_progress
     Failure/Error:
       expect do
         subject.run
       end.to raise_error Slack::Web::Api::Error, 'unknown'
     
       expected Slack::Web::Api::Errors::SlackError with "unknown" got #<VCR::Errors::UnhandledHTTPRequestError: 

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh I see. It's all good.

@dblock dblock merged commit e1f5772 into slack-ruby:master Sep 21, 2017
@gcraig99
Copy link
Contributor Author

I was thinking that I'd add extra expectations that would allow for parameter matching, so you could have a spec that makes sure a command is using as_user: true, or whatever other parameters are supported.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants