Light cleanup, fixed failing spec

pull/48/head
rick carlino 2014-05-23 06:59:57 -07:00
commit fdc6a71e19
10 changed files with 96 additions and 8 deletions

View File

@ -12,7 +12,7 @@ gem 'rails', '4.1.0'
gem 'mongoid', '~> 4.0.0.beta1', github: 'mongoid/mongoid'
gem 'sass-rails'
gem 'sass-rails'
gem 'coffee-rails'
gem 'uglifier'
gem 'high_voltage', '~> 2.1.0'
@ -31,6 +31,10 @@ group :development, :test do
gem 'faker'
end
group :development do
gem 'metric_fu' # Run this to see where the code smells. metric_fu in terminal
end
gem 'haml'
group :test do

View File

@ -50,15 +50,31 @@ GEM
tzinfo (~> 1.1)
addressable (2.3.6)
arel (5.0.1.20140414130214)
arrayfields (4.9.2)
awesome_print (1.2.0)
bcrypt (3.1.7)
bson (2.2.3)
builder (3.2.2)
cane (2.6.2)
parallel
capybara (2.2.1)
mime-types (>= 1.16)
nokogiri (>= 1.3.3)
rack (>= 1.0.0)
rack-test (>= 0.5.4)
xpath (~> 2.0)
chronic (0.10.2)
churn (0.0.35)
chronic (>= 0.2.3)
hirb
json_pure
main
rest-client (>= 1.6.0)
ruby_parser (~> 3.0)
sexp_processor (~> 4.1)
code_analyzer (0.4.5)
sexp_processor
code_metrics (0.1.3)
coderay (1.1.0)
coffee-rails (4.0.1)
coffee-script (>= 2.2.0)
@ -67,6 +83,7 @@ GEM
coffee-script-source
execjs
coffee-script-source (1.7.0)
colored (1.2)
connection_pool (2.0.0)
diff-lcs (1.2.5)
docile (1.1.3)
@ -79,21 +96,51 @@ GEM
railties (>= 3.0.0)
faker (1.3.0)
i18n (~> 0.5)
fattr (2.2.2)
flay (2.4.0)
ruby_parser (~> 3.0)
sexp_processor (~> 4.0)
flog (4.2.0)
ruby_parser (~> 3.1, > 3.1.0)
sexp_processor (~> 4.4)
haml (4.0.5)
tilt
high_voltage (2.1.0)
hike (1.2.3)
hirb (0.7.1)
i18n (0.6.9)
jbuilder (1.5.3)
activesupport (>= 3.0.0)
multi_json (>= 1.2.0)
json (1.8.1)
json_pure (1.8.1)
launchy (2.4.2)
addressable (~> 2.3)
mail (2.5.4)
mime-types (~> 1.16)
treetop (~> 1.4.8)
main (6.0.0)
arrayfields (>= 4.7.4)
chronic (>= 0.6.2)
fattr (>= 2.2.0)
map (>= 5.1.0)
map (6.5.3)
method_source (0.8.2)
metric_fu (4.11.1)
cane (~> 2.5, >= 2.5.2)
churn (~> 0.0.35)
code_metrics (~> 0.1)
coderay
flay (~> 2.1, >= 2.0.1)
flog (~> 4.1, >= 4.1.1)
launchy (~> 2.0)
metric_fu-Saikuro (~> 1.1, >= 1.1.3)
multi_json
rails_best_practices (~> 1.14, >= 1.14.3)
redcard
reek (~> 1.3, >= 1.3.4)
roodi (~> 3.1)
metric_fu-Saikuro (1.1.3)
mime-types (1.25.1)
mini_portile (0.5.3)
minitest (5.3.3)
@ -108,6 +155,7 @@ GEM
optionable (0.2.0)
origin (2.1.1)
orm_adapter (0.5.0)
parallel (1.0.0)
polyglot (0.3.4)
pry (0.9.12.6)
coderay (~> 1.0)
@ -129,6 +177,16 @@ GEM
rails_12factor (0.0.2)
rails_serve_static_assets
rails_stdout_logging
rails_best_practices (1.15.4)
activesupport
awesome_print
code_analyzer (>= 0.4.3)
colored
erubis
i18n
json
require_all
ruby-progressbar
rails_serve_static_assets (0.0.2)
rails_stdout_logging (0.0.3)
railties (4.1.0)
@ -136,9 +194,21 @@ GEM
activesupport (= 4.1.0)
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
rainbow (2.0.0)
rake (10.3.1)
rdoc (4.1.1)
json (~> 1.4)
redcard (1.1.0)
reek (1.3.7)
rainbow
ruby2ruby (~> 2.0.8)
ruby_parser (~> 3.3)
sexp_processor
require_all (1.3.2)
rest-client (1.6.7)
mime-types (>= 1.16)
roodi (3.3.1)
ruby_parser (~> 3.2, >= 3.2.2)
rspec (2.14.1)
rspec-core (~> 2.14.0)
rspec-expectations (~> 2.14.0)
@ -155,6 +225,12 @@ GEM
rspec-core (~> 2.14.0)
rspec-expectations (~> 2.14.0)
rspec-mocks (~> 2.14.0)
ruby-progressbar (1.5.1)
ruby2ruby (2.0.8)
ruby_parser (~> 3.1)
sexp_processor (~> 4.0)
ruby_parser (3.6.1)
sexp_processor (~> 4.1)
sass (3.2.19)
sass-rails (4.0.3)
railties (>= 4.0.0, < 5.0)
@ -164,6 +240,7 @@ GEM
sdoc (0.4.0)
json (~> 1.8)
rdoc (~> 4.0, < 5.0)
sexp_processor (4.4.3)
simplecov (0.8.2)
docile (~> 1.1.0)
multi_json
@ -208,6 +285,7 @@ DEPENDENCIES
high_voltage (~> 2.1.0)
jbuilder (~> 1.2)
launchy
metric_fu
mongoid (~> 4.0.0.beta1)!
ng-rails-csrf
pry

View File

@ -1,6 +1,6 @@
class Api::DevicesController < ApplicationController
respond_to :json
before_action :authenticate_user!
before_action :set_device, only: [:show, :edit, :update, :destroy]
# GET /api/devices

View File

@ -1,9 +1,12 @@
### Main application controller.
class ApplicationController < ActionController::Base
# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
protect_from_forgery with: :exception
def after_sign_in_path_for(resource)
def after_sign_in_path_for()
# We can add a 'resource' parameter to this method if we end up adding more
# devise resources (eg: admin users, etc.)
dashboard_path
end

View File

@ -11,7 +11,7 @@ class RegistrationsController < Devise::RegistrationsController
devise_parameter_sanitizer.for(:sign_up) do |user|
user.permit(:name, :email, :password, :password_confirmation)
end
devise_parameter_sanitizer.for(:account_update) do |user|
user.permit(:name,
:email,

View File

@ -1,3 +1,4 @@
### A single system User on the decision support system.
class User
include Mongoid::Document

View File

@ -4,7 +4,7 @@
<li><a href="#" class="button secondary"> $0.73/day <span>Pesticide </span></a></li>
<li><a href="#" class="button secondary"> $1.19/day <span>Fertilizer </span></a></li>
</ul>
<div class="container">
<div class="large-2 columns">

View File

@ -260,4 +260,4 @@ Devise.setup do |config|
# When using omniauth, Devise cannot automatically set Omniauth path,
# so you need to do it manually. For the users scope, it would be:
# config.omniauth_path_prefix = '/my_engine/users/auth'
end
end

View File

@ -1,5 +1,7 @@
require 'spec_helper'
# Api::DevicesController is the RESTful endpoint for managing device related
# settings. Consumed by the Angular SPA on the front end.
describe Api::DevicesController do
include Devise::TestHelpers
@ -21,9 +23,9 @@ describe Api::DevicesController do
end
it 'handles requests from unauthenticated users' do
binding.pry
get :index
expect(response.status).to eq(401)
end
end
end

View File

@ -9,7 +9,7 @@ describe Device do
expect(user.devices).to be_kind_of(Array)
expect(user.devices.first).to be_kind_of(Device)
end
it 'destroys dependant devices' do
bot_id = device.id
user_id = user.id