Class: RunnerHelpers::FakeContext
- Inherits:
-
Object
- Object
- RunnerHelpers::FakeContext
- Defined in:
- lib/humboldt/rspec.rb
Instance Attribute Summary collapse
-
#counters ⇒ Object
readonly
Returns the value of attribute counters.
-
#results ⇒ Object
readonly
Returns the value of attribute results.
Instance Method Summary collapse
- #configuration ⇒ Object
- #get_counter(group, name) ⇒ Object
-
#initialize(key_accessor, value_accessor) ⇒ FakeContext
constructor
A new instance of FakeContext.
- #write(key, value) ⇒ Object
Constructor Details
#initialize(key_accessor, value_accessor) ⇒ FakeContext
Returns a new instance of FakeContext.
72 73 74 75 76 |
# File 'lib/humboldt/rspec.rb', line 72 def initialize(key_accessor, value_accessor) @key_accessor, @value_accessor = key_accessor, value_accessor @results = [] @counters = Hash.new { |h,k| h[k] = Hash.new { |h2,k2| h2[k2] = 0 } } end |
Instance Attribute Details
#counters ⇒ Object (readonly)
Returns the value of attribute counters.
70 71 72 |
# File 'lib/humboldt/rspec.rb', line 70 def counters @counters end |
#results ⇒ Object (readonly)
Returns the value of attribute results.
70 71 72 |
# File 'lib/humboldt/rspec.rb', line 70 def results @results end |
Instance Method Details
#configuration ⇒ Object
84 85 86 87 88 |
# File 'lib/humboldt/rspec.rb', line 84 def configuration @configuration ||= ::Hadoop::Conf::Configuration.new.tap do |config| config.set 'mapred.job.tracker', 'local' end end |
#get_counter(group, name) ⇒ Object
90 91 92 93 94 |
# File 'lib/humboldt/rspec.rb', line 90 def get_counter(group, name) FakeCounter.new do |amount| @counters[group][name] += amount end end |
#write(key, value) ⇒ Object
78 79 80 81 82 |
# File 'lib/humboldt/rspec.rb', line 78 def write(key, value) @key_accessor.hadoop = key @value_accessor.hadoop = value @results << [@key_accessor.ruby, @value_accessor.ruby] end |