Skip to content

Commit

Permalink
correct the where example test.
Browse files Browse the repository at this point in the history
  • Loading branch information
apotonick committed Jun 25, 2024
1 parent 9f2e7f5 commit eefc20b
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions test/docs/model/find_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ class Update < Trailblazer::Activity::Railway
class FindByQueryTest < Minitest::Spec
Song = Class.new(DocsModelFindTest::Song) do
def self.where(id:, user:)
return if id.nil?
new([id, user])
return [] if id.nil?
[new([id, user])]
end
end

Expand All @@ -113,7 +113,7 @@ module Song::Activity
class Update < Trailblazer::Activity::Railway
step Model::Find(
Song,
query: ->(ctx, id:, current_user:, **) { where(id: id, user: current_user) }
query: ->(ctx, id:, current_user:, **) { where(id: id, user: current_user).first }
)
step :validate
step :save
Expand Down Expand Up @@ -148,7 +148,7 @@ class FindByQueryWithParamsKeyTest < Minitest::Spec
module Song::Activity
class Update < Trailblazer::Activity::Railway
step Model::Find(Song,
query: ->(ctx, id:, current_user:, **) { where(id: id, user: current_user) },
query: ->(ctx, id:, current_user:, **) { where(id: id, user: current_user).first },
params_key: :slug
)
step :validate
Expand Down Expand Up @@ -183,7 +183,7 @@ class FindByQueryWithParamsBlockTest < Minitest::Spec

module Song::Activity
class Update < Trailblazer::Activity::Railway
step Model::Find(Song, query: ->(ctx, id:, current_user:, **) { where(id: id, user: current_user) }) { |ctx, params:, **|
step Model::Find(Song, query: ->(ctx, id:, current_user:, **) { where(id: id, user: current_user).first }) { |ctx, params:, **|
params[:slug_from_params]
}
step :validate
Expand Down

0 comments on commit eefc20b

Please sign in to comment.