-
Notifications
You must be signed in to change notification settings - Fork 26
Leaves-Bri & Yasmin #25
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
base: master
Are you sure you want to change the base?
Conversation
…_user: true to user.rb
…, all tests passing
| *.rbc | ||
| *.yml | ||
| /.config | ||
| /coverage/ |
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.
this should be coverage/
| end | ||
|
|
||
| # method for send_message - just like in User.rb | ||
| def send_message(message) |
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.
You should raise an exception here if the post request is not successful. It is best practice to raise a custom exception such as APIError that inherits from StandardError.
| CHAT_URL = "https://slack.com/api/chat.postMessage" | ||
|
|
||
| module Slack | ||
| class Recipient |
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.
As you mention in your comprehension questions. You could make good use of inheritance by having User and Channel inherit from Recipient.
| end | ||
| end | ||
|
|
||
| it "raises an Argument for invalid selected user" do |
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.
Good test for a negative result. It would be good to define your own custom exception.
| # Send message test | ||
| describe "Send message" do | ||
| it "sends a message to selected recipient" do | ||
| VCR.use_cassette("send_message") do |
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.
Consider confirming that an exception is raised when a message is attempted to be sent to no recipient.
| query = { | ||
| token: ENV["SLACK_API_TOKEN"] | ||
| } | ||
| response = HTTParty.get(CHANNELS_LIST, query: query) |
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.
This is a key place where a parent class that has a self.get(url, params) method could help you make sure this functionality works the same in these 2 classes.
slack.rbWhat We're Looking For
|
slack.rb
Congratulations! You're submitting your assignment!
You and your partner should collaborate on the answers to these questions.
Comprehension Questions