Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions lib/fbe/tombstone.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ def issues(where, repo)
raise(Fbe::Error, 'The type of "where" is not String') unless where.is_a?(String)
raise(Fbe::Error, 'The type of "repo" is not Integer') unless repo.is_a?(Integer)
f = @fb.query(
"(and (eq where '#{where}') (eq what 'tombstone') (eq repository #{repo}) (exists issues))"
).each.first
"(and (eq where $where) (eq what 'tombstone') (eq repository #{repo}) (exists issues))"
).each(@fb, where:).first
return [] if f.nil?
f['issues'].flat_map do |ii|
a, b = ii.split('-').map { |i| Integer(i, 10) }
Expand Down Expand Up @@ -93,8 +93,8 @@ def has?(where, repo, issue)
end
issue = numbers(issue)
f = @fb.query(
"(and (eq where '#{where}') (eq what 'tombstone') (eq repository #{repo}) (exists issues))"
).each.first
"(and (eq where $where) (eq what 'tombstone') (eq repository #{repo}) (exists issues))"
).each(@fb, where:).first
return false if f.nil?
return false if issue.empty?
issue.all? do |i|
Expand Down
10 changes: 10 additions & 0 deletions test/fbe/test_tombstone.rb
Original file line number Diff line number Diff line change
Expand Up @@ -201,4 +201,14 @@ def test_dont_touch_factbase_when_member_is_invalid
end
assert_equal(0, fb.size, "factbase is touched by member #{member.inspect}, seed is #{seed}")
end

def test_where_with_a_quote
fb = Factbase.new
ts = Fbe::Tombstone.new(fb:)
where = "git'hub"
ts.bury!(where, 42, 7)
assert_equal([7], ts.issues(where, 42))
assert(ts.has?(where, 42, 7))
refute(ts.has?('github', 42, 7))
end
end
Loading