mirror of
https://github.com/aasm/aasm
synced 2023-03-27 23:22:41 -04:00
reduce warning output when running specs
This commit is contained in:
parent
8a63cf504f
commit
0a11594066
4 changed files with 16 additions and 6 deletions
|
@ -208,7 +208,9 @@ module AASM
|
|||
klass.defined_enums.values.any?{ |methods|
|
||||
methods.keys{| enum | enum + '?' == method_name }
|
||||
})
|
||||
@state_machine.config.logger.warn "#{klass.name}: overriding method '#{method_name}'!"
|
||||
unless AASM::Configuration.hide_warnings
|
||||
@state_machine.config.logger.warn "#{klass.name}: overriding method '#{method_name}'!"
|
||||
end
|
||||
end
|
||||
|
||||
klass.send(:define_method, method_name, method_definition)
|
||||
|
|
|
@ -34,5 +34,9 @@ module AASM
|
|||
|
||||
# Configure a logger, with default being a Logger to STDERR
|
||||
attr_accessor :logger
|
||||
|
||||
class << self
|
||||
attr_accessor :hide_warnings
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,5 +1 @@
|
|||
RSpec.configure do |config|
|
||||
config.before(:each) do
|
||||
allow_any_instance_of(Logger).to receive(:warn)
|
||||
end
|
||||
end
|
||||
AASM::Configuration.hide_warnings = true
|
||||
|
|
|
@ -1,6 +1,14 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'warns when overrides a method' do
|
||||
before do
|
||||
AASM::Configuration.hide_warnings = false
|
||||
end
|
||||
|
||||
after do
|
||||
AASM::Configuration.hide_warnings = true
|
||||
end
|
||||
|
||||
module Clumsy
|
||||
def self.included base
|
||||
base.send :include, AASM
|
||||
|
|
Loading…
Reference in a new issue