class Object
Public Instance Methods
a_private()
click to toggle source
# File lib/tablesalt/rspec/custom_matchers/define_thread_reader.rb, line 84 def a_private return unless private_opt " a private" end
class_stubbed_value()
click to toggle source
# File lib/tablesalt/rspec/custom_matchers/define_thread_writer.rb, line 73 def class_stubbed_value @class_stubbed_value ||= double("class thread value") end
instance()
click to toggle source
# File lib/tablesalt/rspec/custom_matchers/define_thread_reader.rb, line 70 def instance return subject unless subject.is_a?(Module) return subject unless subject.respond_to?(:new) @instance ||= begin allow(klass).to receive(:initialize).with(any_args) subject.new end end
instance_stubbed_value()
click to toggle source
# File lib/tablesalt/rspec/custom_matchers/define_thread_writer.rb, line 77 def instance_stubbed_value @instance_stubbed_value ||= double("instance thread value") end
klass()
click to toggle source
# File lib/tablesalt/rspec/custom_matchers/define_thread_reader.rb, line 66 def klass @klass ||= subject.is_a?(Module) ? subject : subject.class end
namespace_failure_message()
click to toggle source
# File lib/tablesalt/rspec/custom_matchers/define_thread_reader.rb, line 90 def namespace_failure_message return if namespace.blank? " in #{namespace.inspect} namespace" end
stubbed_value()
click to toggle source
# File lib/tablesalt/rspec/custom_matchers/define_thread_reader.rb, line 80 def stubbed_value @stubbed_value ||= double("Thread value") end
subject_module()
click to toggle source
# File lib/tablesalt/rspec/custom_matchers/define_thread_reader.rb, line 62 def subject_module subject.is_a?(Module) ? subject : subject.class end
with_value_on_thread() { || ... }
click to toggle source
# File lib/tablesalt/rspec/custom_matchers/define_thread_reader.rb, line 53 def with_value_on_thread value_before = Tablesalt::ThreadAccessor.store(namespace)[thread_key] Tablesalt::ThreadAccessor.store(namespace)[thread_key] = stubbed_value yield Tablesalt::ThreadAccessor.store(namespace)[thread_key] = value_before end