-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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 #as_json
glitch caused by JSON and Rails
#1318
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,3 +16,6 @@ task :bench do | |
end | ||
|
||
task :default => :test | ||
|
||
desc 'CI test task' | ||
task :ci => :default |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
version: '{build}' | ||
|
||
skip_tags: true | ||
|
||
environment: | ||
matrix: | ||
- ruby_version: "193" | ||
- ruby_version: "193-x64" | ||
- ruby_version: "200" | ||
- ruby_version: "200-x64" | ||
- ruby_version: "21" | ||
- ruby_version: "21-x64" | ||
|
||
cache: | ||
- vendor/bundle | ||
|
||
install: | ||
- SET PATH=C:\Ruby%ruby_version%\bin;%PATH% | ||
- ruby --version | ||
- gem --version | ||
- gem install bundler | ||
- bundler --version | ||
- bundle platform | ||
- bundle install --path=vendor/bundle --retry=3 --jobs=3 | ||
|
||
test_script: | ||
- bundle exec rake ci | ||
|
||
build: off |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -242,7 +242,7 @@ def test_render_json_with_status | |
|
||
def test_render_json_with_callback | ||
get :render_json_hello_world_with_callback | ||
assert_equal 'alert({"hello":"world"})', @response.body | ||
assert_equal '/**/alert({"hello":"world"})', @response.body | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. oh weird, shouldn't it have been this the whole time? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yep, it is currently failing on the 0.8 branch. This fixes it. |
||
# For JSONP, Rails 3 uses application/json, but Rails 4 uses text/javascript | ||
assert_match %r(application/json|text/javascript), @response.content_type.to_s | ||
end | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1363,6 +1363,7 @@ def name | |
def test_inheritance_does_not_used_cached_attributes | ||
parent = Class.new(ActiveModel::Serializer) do | ||
attributes :title | ||
alias :read_attribute_for_serialization :send | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is needed? If so, it probably shouldn't just be in the test, but generally in the serializer, no? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good callout. Happy to change it if this is the desired fix. |
||
end | ||
|
||
child = Class.new(parent) do | ||
|
@@ -1371,6 +1372,7 @@ def test_inheritance_does_not_used_cached_attributes | |
|
||
data_class = Class.new do | ||
attr_accessor :title, :body | ||
alias :read_attribute_for_serialization :send | ||
end | ||
|
||
item = data_class.new | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
failing test?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll check it out tomorrow.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting, these tests are already failing on 0.8.3 prior to this change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For reference: https://travis-ci.org/rails-api/active_model_serializers/builds/43605004
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like the 0-8-stable branch has been failing since 2013, looks like this PR broke it: #477
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bf4 I fixed some of your gem's tests, so this is now in a better state than the current 0-8-stable branch. It's not passing on some older versions of ruby that you guys are testing on travis because:
as seen here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mhuggins s/my/our gem. Thanks for looking into this. Sorry for being slow here...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No problem, hopefully this is helpful and looks good. :)