Skip to content

Commit

Permalink
#1211 extra tests
Browse files Browse the repository at this point in the history
  • Loading branch information
yegor256 committed Feb 1, 2024
1 parent e9fe65d commit 1a2d8bd
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
11 changes: 11 additions & 0 deletions test/test_bout.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,15 @@ def test_turns_into_json
assert(json[:tags].empty?)
assert(json[:guests].empty?)
end

def test_checks_permission
owner = Nb::Humans.new(test_pgsql).take(test_name).create
friend = Nb::Humans.new(test_pgsql).take(test_name).create
bouts = owner.bouts
bout = bouts.start('hi')
bout.post(test_name)
assert(!friend.bouts.take(bout.id).mine?)
bout.guests.invite(friend.identity)
assert(friend.bouts.take(bout.id).mine?)
end
end
9 changes: 9 additions & 0 deletions test/test_search.rb
Original file line number Diff line number Diff line change
Expand Up @@ -117,4 +117,13 @@ def test_search_by_absence
assert_equal(3, human.search(Nb::Query.new(''), 0, 10).to_a.size)
assert_equal(1, human.search(Nb::Query.new('($one-)'), 0, 10).to_a.size)
end

def test_finds_only_my_bouts
owner = Nb::Humans.new(test_pgsql).take(test_name).create
bouts = owner.bouts
bout = bouts.start(test_name)
bout.post(test_name)
friend = Nb::Humans.new(test_pgsql).take(test_name).create
assert(friend.search(Nb::Query.new("(bout=#{bout.id})"), 0, 10).to_a.empty?)
end
end

0 comments on commit 1a2d8bd

Please sign in to comment.