Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix mt6 assert_nil warnings #2017

Merged
merged 3 commits into from
Jan 7, 2017
Merged

Fix mt6 assert_nil warnings #2017

merged 3 commits into from
Jan 7, 2017

Conversation

bf4
Copy link
Member

@bf4 bf4 commented Jan 6, 2017

bundle exec rake test test:isolated 1>/dev/null
$HOME/.rvm/rubies/ruby-2.2.5/bin/ruby -w -I"lib:lib:test" -r./test/test_helper.rb  -w -I".bundle/ruby/2.2.0/gems/rake-11.3.0/lib" ".bundle/ruby/2.2.0/gems/rake-11.3.0/lib/rake/rake_test_loader.rb" "test/**/*_test.rb"
Use assert_nil if expecting nil from test/action_controller/serialization_scope_name_test.rb:78:in `test_default_serialization_scope_object'. This will fail in MT6.
Use assert_nil if expecting nil from test/cache_test.rb:174:in `test_cache_options_definition'. This will fail in MT6.
Use assert_nil if expecting nil from test/cache_test.rb:185:in `test_associations_separately_cache'. This will fail in MT6.
Use assert_nil if expecting nil from test/cache_test.rb:186:in `test_associations_separately_cache'. This will fail in MT6.
Use assert_nil if expecting nil from test/cache_test.rb:131:in `test_cache_key_definition'. This will fail in MT6.
Use assert_nil if expecting nil from test/adapter/json_api/include_data_if_sideloaded_test.rb:162:in `assert_relationship'. This will fail in MT6.
Expected string default value for '--test-framework'; got false (boolean)
Expected string default value for '--test-framework'; got false (boolean)
Use assert_nil if expecting nil from test/serializers/serializer_for_test.rb:74:in `test_serializer_for_existing_serializer_with_lookup_disabled'. This will fail in MT6.
Use assert_nil if expecting nil from test/serializers/serializer_for_test.rb:62:in `test_serializer_for_non_ams_serializer'. This will fail in MT6.
Use assert_nil if expecting nil from test/serializers/serializer_for_test.rb:131:in `test_serializer_for_nested_resource_with_lookup_disabled'. This will fail in MT6.
Use assert_nil if expecting nil from test/serializers/serializer_for_test.rb:117:in `test_serializer_for_namespaced_resource_with_lookup_disabled'. This will fail in MT6.
Use assert_nil if expecting nil from test/serializers/serializer_for_test.rb:79:in `test_serializer_for_not_existing_serializer'. This will fail in MT6.
Use assert_nil if expecting nil from test/serializers/serializer_for_test.rb:91:in `test_serializer_inherited_serializer_with_lookup_disabled'. This will fail in MT6.
Use assert_nil if expecting nil from test/active_model_serializers/railtie_test_isolated.rb:35:in `block in <class:WithRails>'. This will fail in MT6.
Use assert_nil if expecting nil from test/serializers/caching_configuration_test_isolated.rb:139:in `block in <class:PerformCachingFalse>'. This will fail in MT6.
Use assert_nil if expecting nil from test/serializers/caching_configuration_test_isolated.rb:140:in `block in <class:PerformCachingFalse>'. This will fail in MT6.
Use assert_nil if expecting nil from test/serializers/caching_configuration_test_isolated.rb:141:in `block in <class:PerformCachingFalse>'. This will fail in MT6.
Use assert_nil if expecting nil from test/serializers/caching_configuration_test_isolated.rb:72:in `block in <class:PerformCachingTrue>'. This will fail in MT6.
Use assert_nil if expecting nil from test/serializers/caching_configuration_test_isolated.rb:73:in `block in <class:PerformCachingTrue>'. This will fail in MT6.
Use assert_nil if expecting nil from test/serializers/caching_configuration_test_isolated.rb:74:in `block in <class:PerformCachingTrue>'. This will fail in MT6.

@mention-bot
Copy link

@bf4, thanks for your PR! By analyzing the history of the files in this pull request, we identified @bolshakov, @dubadub and @dgynn to be potential reviewers.

require 'grape'
TestHelper.silence_warnings do
require 'grape'
end
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rails-api/ams @rails-api/commit This commit is kind of unnecessary... might be easier to implement in grape.. :)

This was referenced Jan 6, 2017
@bf4 bf4 force-pushed the remove_warnings branch from 044bdaa to 93dbc5b Compare January 6, 2017 23:21
@bf4 bf4 force-pushed the remove_warnings branch from 93dbc5b to 6acb405 Compare January 7, 2017 04:06
@bf4 bf4 changed the title Fix warnings Fix mt6 assert_nil warnings Jan 7, 2017
assert_equal(expected, hash[:data][:relationships][relationship_name])
actual = hash[:data][:relationships][relationship_name]
if expected.nil?
assert_nil(actual)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I should check if this is a bug when expected is nil

expected = nil
assert_relationship(:unlinked_tags, expected)
expected = { meta: {} }
assert_relationship(:unlinked_tags, expected, key_transform: :unaltered)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this was returning nil before since the key was unaltered-tags. I'm not sure if meta: {} is the desired behavior, but it's what the current behavior is.

@bf4 bf4 force-pushed the remove_warnings branch from 5c476ae to c52af54 Compare January 7, 2017 05:17
@@ -44,6 +45,10 @@ def render_post_by_admin
render json: new_post, serializer: serializer, adapter: :json
end

def current_user
defined?(@current_user) ? @current_user : :current_user_not_set
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's a fun way to do it.

@NullVoxPopuli
Copy link
Contributor

LGTM 👍

@bf4 bf4 merged commit 3b155de into rails-api:master Jan 7, 2017
@bf4 bf4 deleted the remove_warnings branch January 7, 2017 21:23
bf4 added a commit that referenced this pull request Jan 7, 2017
bf4 added a commit that referenced this pull request Jan 10, 2017
* Merge pull request #1990 from mxie/mx-result-typo

Fix typos and capitalization in Relationship Links docs [ci skip]

* Merge pull request #1992 from ojiry/bump_ruby_versions

Run tests by Ruby 2.2.6 and 2.3.3

* Merge pull request #1994 from bf4/promote_architecture

Promote important architecture description that answers a lot of questions we get
Conflicts:
	docs/ARCHITECTURE.md

* Merge pull request #1999 from bf4/typos

Fix typos [ci skip]

* Merge pull request #2000 from berfarah/patch-1

Link to 0.10.3 tag instead of `master` branch

* Merge pull request #2007 from bf4/check_ci

Test was failing due to change in JSON exception message when parsing empty string

* Swap out KeyTransform for CaseTransform (#1993)

* delete KeyTransform, use CaseTransform

* added changelog

Conflicts:
	CHANGELOG.md

* Merge pull request #2005 from kofronpi/support-ruby-2.4

Update jsonapi runtime dependency to 0.1.1.beta6

* Bump to v0.10.4

* Merge pull request #2018 from rails-api/bump_version

Bump to v0.10.4 [ci skip]
Conflicts:
	CHANGELOG.md

* Merge pull request #2019 from bf4/fix_method_redefined_warning

Fix AMS warnings

* Merge pull request #2020 from bf4/silence_grape_warnings

Silence Grape warnings

* Merge pull request #2017 from bf4/remove_warnings

Fix mt6 assert_nil warnings

* Updated isolated tests to assert correct behavior. (#2010)

* Updated isolated tests to assert correct behavior.
* Added check to get unsafe params if rails version is great than 5

* Merge pull request #2012 from bf4/cleanup_isolated_jsonapi_renderer_tests_a_bit

Cleanup assertions in isolated jsonapi renderer tests a bit

* Add Model#attributes helper; make test attributes explicit

* Fix model attributes accessors

* Fix typos

* Randomize testing of compatibility layer against regressions

* Test bugfix

* Add CHANGELOG

* Merge pull request #1981 from groyoh/link_doc

Fix relationship links doc
Conflicts:
	CHANGELOG.md
GregPK pushed a commit to GregPK/active_model_serializers that referenced this pull request Apr 25, 2017
* Merge pull request rails-api#1990 from mxie/mx-result-typo

Fix typos and capitalization in Relationship Links docs [ci skip]

* Merge pull request rails-api#1992 from ojiry/bump_ruby_versions

Run tests by Ruby 2.2.6 and 2.3.3

* Merge pull request rails-api#1994 from bf4/promote_architecture

Promote important architecture description that answers a lot of questions we get
Conflicts:
	docs/ARCHITECTURE.md

* Merge pull request rails-api#1999 from bf4/typos

Fix typos [ci skip]

* Merge pull request rails-api#2000 from berfarah/patch-1

Link to 0.10.3 tag instead of `master` branch

* Merge pull request rails-api#2007 from bf4/check_ci

Test was failing due to change in JSON exception message when parsing empty string

* Swap out KeyTransform for CaseTransform (rails-api#1993)

* delete KeyTransform, use CaseTransform

* added changelog

Conflicts:
	CHANGELOG.md

* Merge pull request rails-api#2005 from kofronpi/support-ruby-2.4

Update jsonapi runtime dependency to 0.1.1.beta6

* Bump to v0.10.4

* Merge pull request rails-api#2018 from rails-api/bump_version

Bump to v0.10.4 [ci skip]
Conflicts:
	CHANGELOG.md

* Merge pull request rails-api#2019 from bf4/fix_method_redefined_warning

Fix AMS warnings

* Merge pull request rails-api#2020 from bf4/silence_grape_warnings

Silence Grape warnings

* Merge pull request rails-api#2017 from bf4/remove_warnings

Fix mt6 assert_nil warnings

* Updated isolated tests to assert correct behavior. (rails-api#2010)

* Updated isolated tests to assert correct behavior.
* Added check to get unsafe params if rails version is great than 5

* Merge pull request rails-api#2012 from bf4/cleanup_isolated_jsonapi_renderer_tests_a_bit

Cleanup assertions in isolated jsonapi renderer tests a bit

* Add Model#attributes helper; make test attributes explicit

* Fix model attributes accessors

* Fix typos

* Randomize testing of compatibility layer against regressions

* Test bugfix

* Add CHANGELOG

* Merge pull request rails-api#1981 from groyoh/link_doc

Fix relationship links doc
Conflicts:
	CHANGELOG.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants