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

Adds Rspec matchers to spec test your audited models #119

Merged
merged 1 commit into from
Oct 12, 2012

Conversation

nhance
Copy link
Contributor

@nhance nhance commented Oct 5, 2012

The following matchers have been added:

  • be_audited
  • have_associated_audits

Usage:

Inside spec_helper.rb add the following:

require 'audited-rspec'

Then use in your models like this:

require 'spec_helper'

describe Company do
  it { should be_audited }
  it { should have_associated_audits }
end
describe User do
  it { should be_audited.associated_with(:company).except(:password) }
end

Closes reenhanced#1

LGTM given by: @codenamev

The following matchers have been added:
* `be_audited`
* `have_associated_audits`

Usage:

Inside `spec_helper.rb` add the following:
```ruby
require 'audited-rspec'
```

Then use in your models like this:
```ruby
require 'spec_helper'

describe Company do
  it { should be_audited }
  it { should have_associated_audits }
end
```

```ruby
describe User do
  it { should be_audited.associated_with(:company).except(:password) }
end
```

Closes #1

LGTM given by: @codenamev
@nhance
Copy link
Contributor Author

nhance commented Oct 5, 2012

Bringing in @codenamev to watch this so we can hopefully see it through.

@laserlemon
Copy link
Contributor

Looks wonderful! 👏
Thank you and 💯 apologies for the slow response.

laserlemon added a commit that referenced this pull request Oct 12, 2012
Adds Rspec matchers to spec test your audited models
@laserlemon laserlemon merged commit 2d6330a into collectiveidea:master Oct 12, 2012
@laserlemon
Copy link
Contributor

Ooh, I might've been a little hasty. I see you're using methods like reflect_on_association but I think that will only work for Active Record. Can you confirm?

@laserlemon
Copy link
Contributor

Perhaps these matchers should have specs. :wink2:

@drewbaumann
Copy link

This is super old, but took me too long to find. How would you feel about some of this information in the README?

rocket-turtle added a commit to rocket-turtle/audited that referenced this pull request Jan 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants