-
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.
- Loading branch information
1 parent
89b432d
commit 93a0c4a
Showing
12 changed files
with
33 additions
and
70 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,12 @@ | ||
module CafeCar::Queryable | ||
extend ActiveSupport::Concern | ||
|
||
class_methods do | ||
def query(params) = query_builder.query(params).scope | ||
def query!(params) = query_builder.query!(params).scope | ||
|
||
def query_builder | ||
CafeCar::QueryBuilder.new(self) | ||
end | ||
end | ||
end |
This file was deleted.
Oops, something went wrong.
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,12 @@ | ||
require "test_helper" | ||
|
||
class CafeCar::QueryableTest < ActiveSupport::TestCase | ||
test "query attributes" do | ||
assert_includes Article.query(title: "bob").to_sql, %("title" = 'bob') | ||
end | ||
|
||
test "query associations" do | ||
assert_includes Article.query(author: true).to_sql, %(EXISTS) | ||
assert_includes Article.query(author: {username: "bob"}).to_sql, %(EXISTS) | ||
end | ||
end |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,13 +1,10 @@ | ||
require "test_helper" | ||
# require "presenters/cafe_car/presenter" | ||
require "cafe_car" | ||
|
||
module CafeCar | ||
class PresenterTest < ActionView::TestCase | ||
tests CafeCar::Presenter | ||
|
||
def test_find | ||
assert_equal SymbolPresenter, Presenter.find(:hi) | ||
test "find" do | ||
assert_equal SymbolPresenter, Presenter.find(Symbol) | ||
end | ||
end | ||
end |