This file contains hidden or 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
module RR::Adapters::RRMethods | |
def lazy(expected) | |
RR::WildcardMatchers::LazyMatcher.new(expected) | |
end | |
end | |
module RR::WildcardMatchers | |
class LazyMatcher | |
def initialize(value) | |
@value = value |
This file contains hidden or 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
module RR::Adapters::RRMethods | |
def has_keys(*expected_keys) | |
RR::WildcardMatchers::HasKeys.new(expected_keys) | |
end | |
end | |
module RR::WildcardMatchers | |
class HasKeys | |
def initialize(keys) | |
@keys = keys.flatten |
This file contains hidden or 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
module RR | |
module DoubleDefinitions | |
class DoubleDefinition | |
def stub_chain(*args, &block) | |
eval( | |
args.flatten.inject('self') do |obj, name| | |
"#{obj}.stub!.#{name}" | |
end + ( block_given? ? ' { block.call }' : '' ) | |
) | |
end |
This file contains hidden or 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
class LRUCache | |
def initialize(max_size) | |
@max_size = max_size | |
end | |
def put(name, value) | |
queue << name unless queue.include?(name) | |
data[name] = value | |
data[queue.shift] = nil if queue.size > @max_size | |
end |
This file contains hidden or 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
module Spec | |
module Example | |
class ExampleGroupMethods | |
def run_examples(success, instance_variables, examples, run_options) | |
return [success, instance_variables] unless success | |
after_all_instance_variables = instance_variables | |
examples.each do |example| | |
example_group_instance = new(example, &example_implementations[example]) |
NewerOlder