Conversation
slack.rbWhat We're Looking For
|
| @@ -0,0 +1 @@ | |||
| require "test_helper" | |||
There was a problem hiding this comment.
This should be require_relative, not require. Using require here breaks rake (but not guard).
| require "test_helper" | |
| require_relative "test_helper" |
There was a problem hiding this comment.
Also, while it's hard to test an abstract class it would be good to at a minimum make sure that your template methods raise NotImplementedError.
| url = CHANNEL_URL | ||
| end | ||
|
|
||
| response = HTTParty.get(url, query: params) |
| "icon_emoji" => settings["icon_emoji"], | ||
| } | ||
| if recipient.class == User | ||
| params["as_user"] = true |
There was a problem hiding this comment.
as_user isn't for if the target is a user, it lets you send things as though you are the user whose token you are making the call with.
| def self.list | ||
| raw_data = self.get("user") | ||
|
|
||
| unless raw_data.code == 200 |
There was a problem hiding this comment.
Forgot to check for the parsed out ok.
| selected = channels.select do |channel| | ||
| channel.name == user_input || channel.slack_id == user_input | ||
| end | ||
| @selected = selected.first |
There was a problem hiding this comment.
Ruby's .find enumerable method might be helpful to clarify this code.
| @@ -0,0 +1,15 @@ | |||
| require_relative "test_helper" | |||
|
|
|||
| describe "Channel class" do | |||
There was a problem hiding this comment.
I would have liked to see some edge case tests on Channel. What happens if you try to get a channel that doesn't exist, etc?
| end | ||
|
|
||
| def print_details(recipients) | ||
| if recipients == "users" |
There was a problem hiding this comment.
I'd like to see recipients just be an array of objects, but if you want it to be something you switch on like this you should use :users instead of "users" since generally we want to use atoms when we match on things like this.
| return return_array | ||
| end | ||
|
|
||
| def update_settings(name, emoji) |
There was a problem hiding this comment.
I like that your configuration system is persistent and uses JSON. 😃
| end | ||
| end | ||
|
|
||
| it "returns a user object from select_user" do |
There was a problem hiding this comment.
What if the user you try to select doesn't exist? What happens to a previously selected user if you try to select a bad user?
| end | ||
| end | ||
|
|
||
| it "returns a channel object from select_channel" do |
slack.rb
Congratulations! You're submitting your assignment!
You and your partner should collaborate on the answers to these questions.
Comprehension Questions