Skip to content

Commit

Permalink
update syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
gblakeman committed Dec 15, 2014
1 parent 98ae764 commit 782b53e
Show file tree
Hide file tree
Showing 12 changed files with 26 additions and 26 deletions.
2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ require 'rspec/core/rake_task'
desc "Run all specs in spec directory (excluding plugin specs)"
RSpec::Core::RakeTask.new

task :default => :spec
task default: :spec
6 changes: 3 additions & 3 deletions app/controllers/lockup/lockup_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def unlock
run_redirect
end
else
render :nothing => true
render nothing: true
end
elsif request.post?
if params[:lockup].present? && params[:lockup].respond_to?(:'[]')
Expand All @@ -26,15 +26,15 @@ def unlock
@wrong = true
end
else
render :nothing => true
render nothing: true
end
end
end

private

def set_cookie
cookies[:lockup] = { :value => @codeword.to_s.downcase, :expires => (Time.now + 5.years) }
cookies[:lockup] = { value: @codeword.to_s.downcase, expires: (Time.now + 5.years) }
end

def run_redirect
Expand Down
10 changes: 5 additions & 5 deletions app/views/lockup/lockup/unlock.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
</div>
<% end %>
<%= form_for :lockup, :url => { :action => 'unlock' } do |form| %>
<%= form_for :lockup, url: { action: 'unlock' } do |form| %>
<% unless @wrong == true %>
<p><%= form.password_field "codeword", :placeholder => "code word" %></p>
<p><%= form.password_field "codeword", placeholder: "code word" %></p>
<% else %>
<p><%= form.password_field "codeword", :value => @codeword, :class => 'nope' %></p>
<p><%= form.password_field "codeword", value: @codeword, class: 'nope' %></p>
<% end %>
<% if ENV["LOCKUP_HINT"].present? || ((Rails::VERSION::MAJOR >= 4 && Rails::VERSION::MINOR >= 1) && Rails.application.secrets.lockup_hint.present?) %>
Expand All @@ -19,9 +19,9 @@
<% end %>
<% if params[:return_to].present? %>
<%= form.hidden_field "return_to", :value => params[:return_to] %>
<%= form.hidden_field "return_to", value: params[:return_to] %>
<% elsif @return_to.present? %>
<%= form.hidden_field "return_to", :value => @return_to %>
<%= form.hidden_field "return_to", value: @return_to %>
<% end %>

<p><%= button_tag "Go" %></p>
Expand Down
2 changes: 1 addition & 1 deletion config/routes.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Lockup::Engine.routes.draw do
get 'unlock' => 'lockup#unlock', :as => 'unlock'
get 'unlock' => 'lockup#unlock', as: 'unlock'
post 'unlock' => 'lockup#unlock'
end
6 changes: 3 additions & 3 deletions lib/lockup.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module Lockup
extend ActiveSupport::Concern

included do
before_filter :check_for_lockup, :except => ["unlock"]
before_filter :check_for_lockup, except: ["unlock"]
end

private
Expand All @@ -15,10 +15,10 @@ def check_for_lockup
if cookies[:lockup] == ENV["LOCKUP_CODEWORD"].to_s.downcase || ((Rails::VERSION::MAJOR >= 4 && Rails::VERSION::MINOR >= 1) && cookies[:lockup] == Rails.application.secrets.lockup_codeword.to_s.downcase)
return
else
redirect_to lockup.unlock_path(:return_to => request.fullpath.split('?lockup_codeword')[0], :lockup_codeword => params[:lockup_codeword])
redirect_to lockup.unlock_path(return_to: request.fullpath.split('?lockup_codeword')[0], lockup_codeword: params[:lockup_codeword])
end
else
redirect_to lockup.unlock_path(:return_to => request.fullpath.split('?lockup_codeword')[0], :lockup_codeword => params[:lockup_codeword])
redirect_to lockup.unlock_path(return_to: request.fullpath.split('?lockup_codeword')[0], lockup_codeword: params[:lockup_codeword])
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/lockup/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ class Engine < ::Rails::Engine
isolate_namespace Lockup

config.generators do |g|
g.test_framework :rspec, :fixture => false
g.test_framework :rspec, fixture: false
g.assets false
g.helper false
end
Expand Down
2 changes: 1 addition & 1 deletion spec/dummy/app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ class ApplicationController < ActionController::Base
protect_from_forgery with: :exception

def render_404
render :file => Rails.root.join('public', '404.html'), :status => 404
render file: Rails.root.join('public', '404.html'), status: 404
end
end
6 changes: 3 additions & 3 deletions spec/dummy/app/models/post.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ class Post
attr_accessor :id, :title, :body

POSTS = [
{:id => 1, :title => 'Title One', :body => 'Body One'},
{:id => 2, :title => 'Title Two', :body => 'Body Two'}
{id: 1, title: 'Title One', body: 'Body One'},
{id: 2, title: 'Title Two', body: 'Body Two'}
]

def self.all
Expand All @@ -20,4 +20,4 @@ def to_param
id
end

end
end
4 changes: 2 additions & 2 deletions spec/dummy/app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
<html>
<head>
<title>Dummy</title>
<%= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true %>
<%= javascript_include_tag "application", "data-turbolinks-track" => true %>
<%= stylesheet_link_tag "application", media: "all", data: {turbolinks_track: true} %>
<%= javascript_include_tag "application", data: {turbolinks_track: true} %>
<%= csrf_meta_tags %>
</head>
<body>
Expand Down
6 changes: 3 additions & 3 deletions spec/dummy/config/routes.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
Rails.application.routes.draw do

mount Lockup::Engine, :at => '/lockup', :as => 'lockup'
mount Lockup::Engine, at: '/lockup', as: 'lockup'

resources :posts, :only => [:index, :show]
resources :posts, only: [:index, :show]

# this makes tests fail with endless redirect loop b/c it is before lockup routes
# catch all route b/c Rails `rescue_from` doesn't catch ActionController::RoutingError
match '*path', :via => :all, :to => 'application#render_404'
match '*path', via: :all, to: 'application#render_404'
end
2 changes: 1 addition & 1 deletion spec/features/access_restricted_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
describe "Accessing a page in the application" do

def enter_code_word(code_word)
fill_in 'code word', :with => code_word
fill_in 'code word', with: code_word
click_on 'Go'
end

Expand Down
4 changes: 2 additions & 2 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@
config.mock_with :rspec
config.infer_base_class_for_anonymous_controllers = false
config.order = "random"
config.include UserAgentHelper, :type => :feature
end
config.include UserAgentHelper, type: :feature
end

0 comments on commit 782b53e

Please sign in to comment.