Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[api] Use better way to set container object for attributes
Before we had this logic in our controller. This code should belong to the model and cleans up the controller.
- Loading branch information
Manuel Schnitzer
committed
Mar 8, 2017
1 parent
39f911d
commit de3cdc0
Showing
3 changed files
with
28 additions
and
6 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,19 @@ | ||
require 'rails_helper' | ||
|
||
RSpec.describe Attrib do | ||
let(:attribute) { create(:attrib, project: create(:project)) } | ||
let(:project) { create(:project) } | ||
let(:package) { create(:package) } | ||
|
||
context "#container=" do | ||
it "sets the project" do | ||
attribute.container = project | ||
expect(attribute.container).to be(project) | ||
end | ||
|
||
it "sets the package" do | ||
attribute.container = package | ||
expect(attribute.container).to be(package) | ||
end | ||
end | ||
end |