Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move signup lookup into it's own Interactor
Trying to stay away from direct Repository access in the controller but for now making this a static method instead of a full object as it's so simple.
- Loading branch information
1 parent
cf14657
commit 92c4fb5
Showing
4 changed files
with
26 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
require 'repository' | ||
require 'models/signup' | ||
|
||
class FindSignup | ||
def self.by_id(id) | ||
Repository.for(Signup).find(id) | ||
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,16 @@ | ||
require 'unit/test_helper' | ||
require 'models/signup' | ||
require 'interactors/find_signup' | ||
|
||
describe FindSignup do | ||
|
||
describe ".by_id" do | ||
it "returns the signup with the given id" do | ||
s = Signup.new id: 4 | ||
Repository.for(Signup).save(s) | ||
|
||
FindSignup.by_id(4).must_equal s | ||
end | ||
end | ||
|
||
end |