-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #836 from rails-api/stores-passed-in-options
Makes passed in options accessible inside serializers
- Loading branch information
Showing
3 changed files
with
28 additions
and
0 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,21 @@ | ||
require 'test_helper' | ||
|
||
module ActiveModel | ||
class Serializer | ||
class OptionsTest < Minitest::Test | ||
def setup | ||
@profile = Profile.new(name: 'Name 1', description: 'Description 1') | ||
end | ||
|
||
def test_options_are_accessible | ||
@profile_serializer = ProfileSerializer.new(@profile, my_options: :accessible) | ||
assert @profile_serializer.arguments_passed_in? | ||
end | ||
|
||
def test_no_option_is_passed_in | ||
@profile_serializer = ProfileSerializer.new(@profile) | ||
refute @profile_serializer.arguments_passed_in? | ||
end | ||
end | ||
end | ||
end |