Skip to content

Commit

Permalink
feature: add helper for stub plugin into tests
Browse files Browse the repository at this point in the history
  • Loading branch information
artofhuman committed Mar 2, 2016
1 parent 8475cac commit 07aac88
Showing 1 changed file with 62 additions and 0 deletions.
62 changes: 62 additions & 0 deletions lib/treasury/spec_helpers.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
module Treasury
module CoreDenormalizationFake
ROOT_REDIS_KEY = 'denormalization'.freeze

module Processors
module Company
class Base
end
end

module User
class Base
def interesting_event?
true
end
end
end
end

module Fields
module User
class Base
end

class Companies
end
end

module Company
class Base
end

class Translator
end
end

class Base
end
end
end

# Treasury::SpecHelpers provides method for stub plugin denormalization classes
# with fake class.
#
# Example:
# spec_helper.rb
#
# require 'treasury/spec_helpers'
#
# Treasury::SpecHelpers.stub_core_denormalization
#
# RSpec.configure do |config|
# ...
# end
module SpecHelpers
def stub_core_denormalization
Object.const_set('CoreDenormalization', CoreDenormalizationFake)
end

module_function :stub_core_denormalization
end
end

0 comments on commit 07aac88

Please sign in to comment.