[UNSTABLE] removeing mongoid references.
parent
9858a55900
commit
5fbc8f366b
6
Gemfile
6
Gemfile
|
@ -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'
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
|
@ -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
|
Loading…
Reference in New Issue