Created
October 30, 2016 14:54
-
-
Save andreas-it-dev/de6fc97ec9544f8cffdf0a6be1fa1958 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bundle exec rubocop | |
Inspecting 77 files | |
..............................W........C..............................W...... | |
Offenses: | |
bin/spring:11:13: W: Assignment in condition - you probably meant to use ==. | |
if spring = lockfile.specs.find {|spec| spec.name == 'spring' } | |
^ | |
test/test_helper.rb:5:7: C: Use nested module/class definitions instead of compact style. | |
class ActiveSupport::TestCase | |
^^^^^^^^^^^^^^^^^^^^^^^ | |
app/controllers/sessions_controller.rb:6:13: W: Assignment in condition - you probably meant to use ==. | |
if user = User.authenticate(params[:username], params[:password]) | |
^ | |
77 files inspected, 3 offenses detected |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SessionsController < ApplicationController | |
def new | |
end | |
def create | |
if user = User.authenticate(params[:username], params[:password]) | |
session[:user_id] = user.id | |
flash[:notice] = t('sessions.success_html') | |
redirect_to(session[:intended_url] || root_path) | |
session[:intended_url] = nil | |
else | |
render :new, error: t('sessions.failure') | |
end | |
end | |
def destroy | |
reset_session | |
redirect_to root_path, notice: t('sessions.signedout') | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# This file loads spring without using Bundler, in order to be fast. | |
# It gets overwritten when you run the `spring binstub` command. | |
unless defined?(Spring) | |
require 'rubygems' | |
require 'bundler' | |
lockfile = Bundler::LockfileParser.new(Bundler.default_lockfile.read) | |
if spring = lockfile.specs.find {|spec| spec.name == 'spring' } | |
Gem.use_paths Gem.dir, Bundler.bundle_path.to_s, *Gem.path | |
gem 'spring', spring.version | |
require 'spring/binstub' | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require File.expand_path('../../config/environment', __FILE__) | |
require 'rails/test_help' | |
class ActiveSupport::TestCase | |
# Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order. | |
fixtures :all | |
# Add more helper methods to be used by all tests here... | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment