diff --git a/Rakefile b/Rakefile index 3900d62..44846bb 100644 --- a/Rakefile +++ b/Rakefile @@ -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 \ No newline at end of file +task default: :spec diff --git a/app/controllers/lockup/lockup_controller.rb b/app/controllers/lockup/lockup_controller.rb index bb59cfc..67c0bba 100644 --- a/app/controllers/lockup/lockup_controller.rb +++ b/app/controllers/lockup/lockup_controller.rb @@ -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?(:'[]') @@ -26,7 +26,7 @@ def unlock @wrong = true end else - render :nothing => true + render nothing: true end end end @@ -34,7 +34,7 @@ def unlock 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 diff --git a/app/views/lockup/lockup/unlock.html.erb b/app/views/lockup/lockup/unlock.html.erb index f151bef..de8fccf 100644 --- a/app/views/lockup/lockup/unlock.html.erb +++ b/app/views/lockup/lockup/unlock.html.erb @@ -6,11 +6,11 @@ <% end %> -<%= form_for :lockup, :url => { :action => 'unlock' } do |form| %> +<%= form_for :lockup, url: { action: 'unlock' } do |form| %> <% unless @wrong == true %> -
<%= form.password_field "codeword", :placeholder => "code word" %>
+<%= form.password_field "codeword", placeholder: "code word" %>
<% else %> -<%= form.password_field "codeword", :value => @codeword, :class => 'nope' %>
+<%= form.password_field "codeword", value: @codeword, class: 'nope' %>
<% end %> <% if ENV["LOCKUP_HINT"].present? || ((Rails::VERSION::MAJOR >= 4 && Rails::VERSION::MINOR >= 1) && Rails.application.secrets.lockup_hint.present?) %> @@ -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 %><%= button_tag "Go" %>
diff --git a/config/routes.rb b/config/routes.rb index b1b9fa4..90f4a53 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -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 diff --git a/lib/lockup.rb b/lib/lockup.rb index 7981ec5..874e478 100644 --- a/lib/lockup.rb +++ b/lib/lockup.rb @@ -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 @@ -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 diff --git a/lib/lockup/engine.rb b/lib/lockup/engine.rb index 7afc68e..7814bd0 100644 --- a/lib/lockup/engine.rb +++ b/lib/lockup/engine.rb @@ -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 diff --git a/spec/dummy/app/controllers/application_controller.rb b/spec/dummy/app/controllers/application_controller.rb index e2f9409..a61cd9d 100644 --- a/spec/dummy/app/controllers/application_controller.rb +++ b/spec/dummy/app/controllers/application_controller.rb @@ -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 diff --git a/spec/dummy/app/models/post.rb b/spec/dummy/app/models/post.rb index 774264f..5b645b9 100644 --- a/spec/dummy/app/models/post.rb +++ b/spec/dummy/app/models/post.rb @@ -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 @@ -20,4 +20,4 @@ def to_param id end -end \ No newline at end of file +end diff --git a/spec/dummy/app/views/layouts/application.html.erb b/spec/dummy/app/views/layouts/application.html.erb index 670d187..f7c312d 100644 --- a/spec/dummy/app/views/layouts/application.html.erb +++ b/spec/dummy/app/views/layouts/application.html.erb @@ -2,8 +2,8 @@