-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make fields hash allow :except key; more test refactoring.
- Loading branch information
1 parent
a768a87
commit 69fbc69
Showing
17 changed files
with
50 additions
and
46 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
class Api::Test::AddedSelectController < Api::TestController | ||
include RESTFramework::ModelControllerMixin | ||
|
||
self.model = Movie | ||
self.fields = {include: [:selected_value]} | ||
|
||
def get_recordset | ||
return Movie.select("*, 5 as selected_value") | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
class Api::Test::BareCreateController < Api::TestController | ||
include RESTFramework::ModelControllerMixin | ||
|
||
self.model = Movie | ||
self.fields = %w(id name) | ||
self.create_from_recordset = false | ||
end |
2 changes: 1 addition & 1 deletion
2
...est/genres_with_fields_hash_controller.rb → ...pi/test/fields_hash_exclude_controller.rb
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
6 changes: 6 additions & 0 deletions
6
test/app/controllers/api/test/fields_hash_only_except_controller.rb
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,6 @@ | ||
class Api::Test::FieldsHashOnlyExceptController < Api::TestController | ||
include RESTFramework::ModelControllerMixin | ||
|
||
self.fields = {only: %w(id login age balance), except: %w(balance)} | ||
self.model = User | ||
end |
2 changes: 1 addition & 1 deletion
2
...rs/api/test/read_only_users_controller.rb → ...trollers/api/test/read_only_controller.rb
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
10 changes: 0 additions & 10 deletions
10
test/app/controllers/api/test/users_with_added_select_controller.rb
This file was deleted.
Oops, something went wrong.
7 changes: 0 additions & 7 deletions
7
test/app/controllers/api/test/users_with_bare_create_controller.rb
This file was deleted.
Oops, something went wrong.
6 changes: 0 additions & 6 deletions
6
test/app/controllers/api/test/users_with_fields_hash_controller.rb
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
2 changes: 1 addition & 1 deletion
2
...sers_with_added_select_controller_test.rb → .../api/test/added_select_controller_test.rb
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
11 changes: 11 additions & 0 deletions
11
test/test/controllers/api/test/bare_create_controller_test.rb
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,11 @@ | ||
require_relative "base" | ||
|
||
class Api::Test::BareCreateControllerTest < ActionController::TestCase | ||
include BaseApi::TestControllerTests | ||
|
||
def test_bare_create | ||
post(:create, as: :json, params: {name: "Test Bare Create"}) | ||
assert_response(:success) | ||
assert(Movie.find_by(name: "Test Bare Create")) | ||
end | ||
end |
2 changes: 1 addition & 1 deletion
2
...users_with_fields_hash_controller_test.rb → ...ields_hash_only_except_controller_test.rb
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
2 changes: 1 addition & 1 deletion
2
...i/test/read_only_users_controller_test.rb → ...ers/api/test/read_only_controller_test.rb
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
11 changes: 0 additions & 11 deletions
11
test/test/controllers/api/test/users_with_bare_create_controller_test.rb
This file was deleted.
Oops, something went wrong.