Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check if audits is loaded before executing database queries #715

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Add spec for new has_version? method
  • Loading branch information
wkirby committed Aug 24, 2024
commit 888ddb9c2fd761c6dc84b3a88ed8d71b08d0b206
14 changes: 14 additions & 0 deletions spec/audited/auditor_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -917,6 +917,20 @@ def stub_global_max_audits(max_audits)
end
end

describe "has_version" do
let(:user) { create_versions(2) }

it "should return true when a version exists" do
expect(user.has_version?(1)).to eq(true)
expect(user.has_version?(2)).to eq(true)
end

it "should return false when a version does not exist" do
expect(user.has_version?(8)).to eq(false)
expect(user.has_version?(1337)).to eq(false)
end
end

describe "own_and_associated_audits" do
it "should return audits for self and associated audits" do
owner = Models::ActiveRecord::Owner.create!
Expand Down