[UNSTABLE] removeing mongoid references.

pull/260/head
Connor Rigby 2016-09-01 08:02:54 -07:00
parent 9858a55900
commit 5fbc8f366b
7 changed files with 38 additions and 33 deletions

View File

@ -29,6 +29,8 @@ source 'https://rails-assets.org' do
end
group :development, :test do
gem "bullet"
gem 'metric_fu' # Run this to see where the code smells. metric_fu in terminal
gem 'pry'
gem 'factory_girl_rails'
gem 'faker'
@ -36,10 +38,6 @@ group :development, :test do
gem 'sqlite3'
end
group :development do
gem 'metric_fu' # Run this to see where the code smells. metric_fu in terminal
end
group :test do
gem 'rspec'
gem 'rspec-rails'

View File

@ -66,6 +66,9 @@ GEM
ast (2.3.0)
bcrypt (3.1.11)
builder (3.2.2)
bullet (5.3.0)
activesupport (>= 3.0.0)
uniform_notifier (~> 1.10.0)
cane (2.6.2)
parallel
capybara (2.7.1)
@ -319,6 +322,7 @@ GEM
unf (0.1.4)
unf_ext
unf_ext (0.0.7.2)
uniform_notifier (1.10.0)
unparser (0.2.5)
abstract_type (~> 0.0.7)
adamantium (~> 0.2.0)
@ -338,6 +342,7 @@ PLATFORMS
DEPENDENCIES
active_model_serializers (~> 0.8.3)
bullet
capybara
codeclimate-test-reporter
coffee-rails

View File

@ -14,13 +14,6 @@ module Api
sorry "Document not found.", 404
end
rescue_from Mongoid::Errors::InvalidFind do
sorry 'You most likely forgot to provide an `*_id` attribute in your '\
'request parameters. Examples of possible missing params: '\
'schedule_id, sequence_id, id, etc..', 400
end
rescue_from ActiveRecord::RecordInvalid do |exc|
render json: {error: exc.message}, status: 422
end

View File

@ -9,7 +9,7 @@ module Auth
def execute
Device.find_by(uuid: bot_uuid, token: bot_token)
rescue Mongoid::Errors::DocumentNotFound
rescue ActiveRecord::RecordNotFound
add_error :auth, :*, 'Bad uuid or token'
end
end

View File

@ -34,4 +34,16 @@ FarmBot::Application.configure do
# Print deprecation notices to the stderr.
config.active_support.deprecation = :stderr
config.after_initialize do
Bullet.enable = true
Bullet.alert = true
Bullet.bullet_logger = true
Bullet.console = true
Bullet.rails_logger = true
# Bullet.stacktrace_includes = [ 'your_gem', 'your_middleware' ]
# Bullet.stacktrace_excludes = [ 'their_gem', 'their_middleware' ]
end
config.log_level = :error
end

View File

@ -1,18 +1,18 @@
module Mongoid
puts "TODO: DELETE THIS!!"
module Errors
puts "TODO: DELETE THIS!!"
class DocumentNotFound < Exception
puts "TODO: DELETE THIS!!"
end
# module Mongoid
# puts "TODO: DELETE THIS!!"
# module Errors
# puts "TODO: DELETE THIS!!"
# class DocumentNotFound < Exception
# puts "TODO: DELETE THIS!!"
# end
class InvalidFind < Exception
puts "TODO: DELETE THIS!!"
end
# class InvalidFind < Exception
# puts "TODO: DELETE THIS!!"
# end
class Validations < Exception
puts "TODO: DELETE THIS!!"
end
end
end
# class Validations < Exception
# puts "TODO: DELETE THIS!!"
# end
# end
# end

View File

@ -48,12 +48,9 @@ RSpec.configure do |config|
SmarfDoc.run!(request, response)
end
end
config.before(:each) do
config.after(:suite) do
ActiveRecord::Base.subclasses.map(&:delete_all)
end
config.after(:suite) { SmarfDoc.finish! }
config.after do
puts "TODO: Purge the database!!!"
SmarfDoc.finish!
end
end