Skip to content
This repository has been archived by the owner on Jan 24, 2018. It is now read-only.

Commit

Permalink
Fix basic ruby violations
Browse files Browse the repository at this point in the history
  • Loading branch information
David Singleton committed Feb 26, 2016
1 parent c9f5d20 commit 0478ec0
Show file tree
Hide file tree
Showing 14 changed files with 14 additions and 21 deletions.
4 changes: 2 additions & 2 deletions Gemfile
Expand Up @@ -12,12 +12,12 @@ gem 'uglifier', '>= 1.3.0'
gem 'jbuilder', '~> 2.0'

# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc
gem 'sdoc', '~> 0.4.0', group: :doc

gem 'kramdown', '1.5'

if ENV['SLIMMER_DEV']
gem 'slimmer', :path => '../slimmer'
gem 'slimmer', path: '../slimmer'
else
gem 'slimmer', '9.1.0'
end
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/application_controller.rb
Expand Up @@ -7,8 +7,8 @@ class ApplicationController < ActionController::Base

before_filter :set_custom_slimmer_headers


private

def set_custom_slimmer_headers
set_slimmer_headers(report_a_problem: 'false')
end
Expand Down
1 change: 0 additions & 1 deletion app/controllers/components_controller.rb
@@ -1,7 +1,6 @@
require 'component'

class ComponentsController < ApplicationController

def show
@component = Component.get(params[:id])
end
Expand Down
9 changes: 4 additions & 5 deletions app/controllers/fixtures_controller.rb
@@ -1,21 +1,20 @@
require 'component'

class FixturesController < ApplicationController

def show
@fixture = component.fixtures.select {|f|
@fixture = component.fixtures.find {|f|
f.id == params[:id]
}.first
}
end

def index
@fixtures = component.fixtures
end

def preview
@fixture = component.fixtures.select {|f|
@fixture = component.fixtures.find {|f|
f.id == params[:fixture_id]
}.first
}
render layout: 'preview'
end

Expand Down
4 changes: 2 additions & 2 deletions app/models/component.rb
@@ -1,6 +1,6 @@
Component = Struct.new(:id, :name, :description, :body, :fixtures) do
def self.get(id)
all.select { |component| component.id == id }.first
all.find { |component| component.id == id }
end

def self.all
Expand Down Expand Up @@ -28,7 +28,7 @@ def self.fetch_component_doc
begin
JSON.parse(
RestClient.get(component_doc_url).body,
{symbolize_names: true}
symbolize_names: true
)
rescue RestClient::BadGateway => e
raise "#{e} from #{Plek.current.find('static')} - is static running?"
Expand Down
2 changes: 1 addition & 1 deletion bin/rails
Expand Up @@ -3,6 +3,6 @@ begin
load File.expand_path("../spring", __FILE__)
rescue LoadError
end
APP_PATH = File.expand_path('../../config/application', __FILE__)
APP_PATH = File.expand_path('../../config/application', __FILE__)
require_relative '../config/boot'
require 'rails/commands'
2 changes: 1 addition & 1 deletion config.ru
@@ -1,4 +1,4 @@
# This file is used by Rack-based servers to start the application.

require ::File.expand_path('../config/environment', __FILE__)
require ::File.expand_path('../config/environment', __FILE__)
run Rails.application
2 changes: 1 addition & 1 deletion config/environments/test.rb
Expand Up @@ -13,7 +13,7 @@
config.eager_load = false

# Configure static asset server for tests with Cache-Control for performance.
config.serve_static_files = true
config.serve_static_files = true
config.static_cache_control = 'public, max-age=3600'

# Show full error reports and disable caching.
Expand Down
2 changes: 1 addition & 1 deletion config/initializers/cookies_serializer.rb
@@ -1,3 +1,3 @@
# Be sure to restart your server when you modify this file.

Rails.application.config.action_dispatch.cookies_serializer = :json
Rails.application.config.action_dispatch.cookies_serializer = :json
1 change: 0 additions & 1 deletion config/routes.rb
@@ -1,5 +1,4 @@
Rails.application.routes.draw do

get 'about' => 'about#index'

resources :components, only: [:index, :show] do
Expand Down
1 change: 0 additions & 1 deletion test/controllers/about_controller_test.rb
Expand Up @@ -5,5 +5,4 @@ class AboutControllerTest < ActionController::TestCase
get :index
assert_response :success
end

end
1 change: 0 additions & 1 deletion test/controllers/components_controller_test.rb
Expand Up @@ -10,5 +10,4 @@ class ComponentsControllerTest < ActionController::TestCase
get :show, id: 'title'
assert_response :success
end

end
3 changes: 1 addition & 2 deletions test/controllers/fixtures_controller_test.rb
Expand Up @@ -7,8 +7,7 @@ class FixturesControllerTest < ActionController::TestCase
end

test "should get show" do
get :show, {component_id: 'title', id: 'default'}
get :show, component_id: 'title', id: 'default'
assert_response :success
end

end
1 change: 0 additions & 1 deletion test/controllers/welcome_controller_test.rb
Expand Up @@ -5,5 +5,4 @@ class WelcomeControllerTest < ActionController::TestCase
get :index
assert_response :success
end

end

0 comments on commit 0478ec0

Please sign in to comment.