Add tests
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
class Command::GoToCard < Command
|
||||
store_accessor :data, :card_id
|
||||
|
||||
validates_presence_of :card_id
|
||||
validates_presence_of :card
|
||||
|
||||
def title
|
||||
"Visit card '#{card.title}'"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
class Command::GoToUser < Command
|
||||
store_accessor :data, :user_id
|
||||
|
||||
validates_presence_of :user_id
|
||||
validates_presence_of :user
|
||||
|
||||
def title
|
||||
"View profile of '#{user.name}'"
|
||||
@@ -13,6 +13,6 @@ class Command::GoToUser < Command
|
||||
|
||||
private
|
||||
def user
|
||||
User.find(user_id)
|
||||
User.find_by_id(user_id)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -22,7 +22,7 @@ class Command::Parser::Context
|
||||
attr_reader :controller, :action, :params
|
||||
|
||||
def extract_url_components(url)
|
||||
uri = URI.parse(url)
|
||||
uri = URI.parse(url || "")
|
||||
route = Rails.application.routes.recognize_path(uri.path)
|
||||
@controller = route[:controller]
|
||||
@action = route[:action]
|
||||
|
||||
Reference in New Issue
Block a user