1
0
Fork 0
mirror of https://github.com/thoughtbot/shoulda-matchers.git synced 2022-11-09 12:01:38 -05:00
thoughtbot--shoulda-matchers/lib/shoulda/matchers/matcher_context.rb
Elliot Winkler 542f715d5a Documentation updates
[ci skip]
2014-12-25 01:13:30 -05:00

36 lines
674 B
Ruby

module Shoulda
module Matchers
# @private
class MatcherContext
def initialize(context)
@context = context
end
def subject_is_a_class?
if inside_a_shoulda_context_project? && outside_a_should_block?
assume_that_subject_is_not_a_class
else
context.subject.is_a?(Class)
end
end
protected
attr_reader :context
private
def inside_a_shoulda_context_project?
defined?(Shoulda::Context)
end
def outside_a_should_block?
context.is_a?(Class)
end
def assume_that_subject_is_not_a_class
false
end
end
end
end