mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-25 07:16:49 +00:00
Add Style enforcer (via Rubocop)
It will fail the build, but as it is currently, most of the cops are 'todos'. Great for new contributors.. :)
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
|
||||
require 'test_helper'
|
||||
|
||||
module ActionController
|
||||
@@ -189,7 +188,7 @@ module ActionController
|
||||
def test_render_array_using_custom_root
|
||||
get :render_array_using_custom_root
|
||||
|
||||
expected = {custom_roots: [{name: "Name 1", description: "Description 1"}]}
|
||||
expected = {custom_roots: [{name: "Name 1", description: "Description 1"}]}
|
||||
assert_equal 'application/json', @response.content_type
|
||||
assert_equal expected.to_json, @response.body
|
||||
end
|
||||
@@ -197,7 +196,7 @@ module ActionController
|
||||
def test_render_array_that_is_empty_using_custom_root
|
||||
get :render_array_that_is_empty_using_custom_root
|
||||
|
||||
expected = {custom_roots: []}
|
||||
expected = {custom_roots: []}
|
||||
assert_equal 'application/json', @response.content_type
|
||||
assert_equal expected.to_json, @response.body
|
||||
end
|
||||
@@ -205,7 +204,7 @@ module ActionController
|
||||
def test_render_object_using_custom_root
|
||||
get :render_object_using_custom_root
|
||||
|
||||
expected = {custom_root: {name: "Name 1", description: "Description 1"}}
|
||||
expected = {custom_root: {name: 'Name 1', description: 'Description 1'}}
|
||||
assert_equal 'application/json', @response.content_type
|
||||
assert_equal expected.to_json, @response.body
|
||||
end
|
||||
|
||||
2
test/fixtures/poro.rb
vendored
2
test/fixtures/poro.rb
vendored
@@ -83,7 +83,7 @@ Location = Class.new(Model)
|
||||
Place = Class.new(Model)
|
||||
Tag = Class.new(Model)
|
||||
VirtualValue = Class.new(Model)
|
||||
Comment = Class.new(Model) do
|
||||
Comment = Class.new(Model) do
|
||||
# Uses a custom non-time-based cache key
|
||||
def cache_key
|
||||
"#{self.class.name.downcase}/#{self.id}"
|
||||
|
||||
@@ -26,7 +26,7 @@ module ActiveModel
|
||||
end
|
||||
end
|
||||
|
||||
class SerializerTest < Minitest::Test
|
||||
class SerializerTest < Minitest::Test
|
||||
class MyProfile < Profile
|
||||
end
|
||||
class CustomProfile
|
||||
|
||||
@@ -29,7 +29,7 @@ rescue LoadError
|
||||
def capture(stream)
|
||||
stream = stream.to_s
|
||||
captured_stream = Tempfile.new(stream)
|
||||
stream_io = eval("$#{stream}")
|
||||
stream_io = eval("$#{stream}") # rubocop:disable Lint/Eval
|
||||
origin_stream = stream_io.dup
|
||||
stream_io.reopen(captured_stream)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user