-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature: add helper for stub plugin into tests
- Loading branch information
1 parent
8475cac
commit 07aac88
Showing
1 changed file
with
62 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |