-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add belongs_to custom type support (#142)
* add belongs_to custom type support * add tests for mysql and sqlite * fix custom types
- Loading branch information
Showing
3 changed files
with
72 additions
and
1 deletion.
There are no files selected for viewing
20 changes: 20 additions & 0 deletions
20
spec/granite_orm/associations/belongs_to_custom_type_spec.cr
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,20 @@ | ||
require "../../spec_helper" | ||
|
||
{% for adapter in GraniteExample::ADAPTERS %} | ||
module {{adapter.capitalize.id}} | ||
describe "{{ adapter.id }} belongs_to" do | ||
it "supports custom types for the join" do | ||
book = Book.new | ||
book.name = "Screw driver" | ||
book.save | ||
|
||
review = BookReview.new | ||
review.book = book | ||
review.body = "Best book ever!" | ||
review.save | ||
|
||
review.book.name.should eq "Screw driver" | ||
end | ||
end | ||
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