forked from medihack/make_flaggable
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request medihack#9 from acmetech/master
Specified a white list of attributes that can be set via mass-assignment.
- Loading branch information
Showing
5 changed files
with
24 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
require 'spec_helper' | ||
|
||
describe Flagging do | ||
describe "attributes should be white listed" do | ||
it { should allow_mass_assignment_of(:flaggable) } | ||
it { should allow_mass_assignment_of(:flagger) } | ||
it { should allow_mass_assignment_of(:flag) } | ||
end | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
RSpec::Matchers.define :allow_mass_assignment_of do |attribute| | ||
match do |response| | ||
response.class.accessible_attributes.include?(attribute) | ||
end | ||
description { "be accessible :#{attribute}" } | ||
failure_message_for_should { ":#{attribute} should be accessible" } | ||
failure_message_for_should_not { ":#{attribute} should not be accessible" } | ||
end |