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:
Benjamin Fleischer
2015-08-30 23:17:25 -05:00
parent 6784866a2d
commit 09c97de90d
12 changed files with 430 additions and 10 deletions

View File

@@ -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

View File

@@ -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}"

View File

@@ -26,7 +26,7 @@ module ActiveModel
end
end
class SerializerTest < Minitest::Test
class SerializerTest < Minitest::Test
class MyProfile < Profile
end
class CustomProfile

View File

@@ -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)