Add tests

This commit is contained in:
Jorge Manrubia
2025-05-06 14:09:50 +02:00
parent 279a5be717
commit 863ced55c4
8 changed files with 74 additions and 4 deletions
+1 -1
View File
@@ -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}'"
+2 -2
View File
@@ -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
+1 -1
View File
@@ -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]