-
Notifications
You must be signed in to change notification settings - Fork 230
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 #326 from novikserg/325_mass_assignment_bug_fix
mass assignment bug fix fixes #325
- Loading branch information
Showing
6 changed files
with
42 additions
and
29 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
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,28 @@ | ||
require 'spec_helper' | ||
|
||
describe "Adding attribute called 'attributes'" do | ||
|
||
context "when mass assignment is disabled" do | ||
before do | ||
module Examples | ||
class User | ||
include Virtus.model(mass_assignment: false) | ||
|
||
attribute :attributes | ||
end | ||
end | ||
end | ||
|
||
it "allows model to use `attributes` attribute" do | ||
user = Examples::User.new | ||
expect(user.attributes).to eq(nil) | ||
user.attributes = "attributes string" | ||
expect(user.attributes).to eq("attributes string") | ||
end | ||
|
||
it "doesn't accept `attributes` key in initializer" do | ||
user = Examples::User.new(attributes: 'attributes string') | ||
expect(user.attributes).to eq(nil) | ||
end | ||
end | ||
end |
8d8755f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Has this bugfix been released yet?