Module: SuperDiff::RSpec

Defined in:
lib/super_diff/rspec.rb,
lib/super_diff/rspec/differ.rb,
lib/super_diff/rspec/differs.rb,
lib/super_diff/rspec/augmented_matcher.rb,
lib/super_diff/rspec/object_inspection.rb,
lib/super_diff/rspec/matcher_text_builders.rb,
lib/super_diff/rspec/matcher_text_template.rb,
lib/super_diff/rspec/differs/hash_including.rb,
lib/super_diff/rspec/operation_tree_builders.rb,
lib/super_diff/rspec/matcher_text_builders/base.rb,
lib/super_diff/rspec/matcher_text_builders/match.rb,
lib/super_diff/rspec/differs/collection_including.rb,
lib/super_diff/rspec/object_inspection/inspectors.rb,
lib/super_diff/rspec/differs/object_having_attributes.rb,
lib/super_diff/rspec/matcher_text_builders/respond_to.rb,
lib/super_diff/rspec/matcher_text_builders/raise_error.rb,
lib/super_diff/rspec/matcher_text_builders/be_predicate.rb,
lib/super_diff/rspec/matcher_text_builders/have_predicate.rb,
lib/super_diff/rspec/object_inspection/inspectors/kind_of.rb,
lib/super_diff/rspec/differs/collection_containing_exactly.rb,
lib/super_diff/rspec/matcher_text_builders/contain_exactly.rb,
lib/super_diff/rspec/object_inspection/inspectors/primitive.rb,
lib/super_diff/rspec/operation_tree_builders/hash_including.rb,
lib/super_diff/rspec/object_inspection/inspectors/instance_of.rb,
lib/super_diff/rspec/object_inspection/inspectors/value_within.rb,
lib/super_diff/rspec/object_inspection/inspectors/hash_including.rb,
lib/super_diff/rspec/operation_tree_builders/collection_including.rb,
lib/super_diff/rspec/operation_tree_builders/object_having_attributes.rb,
lib/super_diff/rspec/object_inspection/inspectors/collection_including.rb,
lib/super_diff/rspec/object_inspection/inspectors/object_having_attributes.rb,
lib/super_diff/rspec/operation_tree_builders/collection_containing_exactly.rb,
lib/super_diff/rspec/object_inspection/inspectors/collection_containing_exactly.rb

Defined Under Namespace

Modules: AugmentedMatcher, Differs, MatcherTextBuilders, ObjectInspection, OperationTreeBuilders Classes: Differ, MatcherTextTemplate

Class Method Summary collapse

Class Method Details

.a_collection_containing_exactly_something?(value) ⇒ Boolean

Returns:

  • (Boolean)


40
41
42
43
# File 'lib/super_diff/rspec.rb', line 40

def self.a_collection_containing_exactly_something?(value)
  fuzzy_object?(value) &&
    value.base_matcher.is_a?(::RSpec::Matchers::BuiltIn::ContainExactly)
end

.a_collection_including_something?(value) ⇒ Boolean

Returns:

  • (Boolean)


29
30
31
32
33
# File 'lib/super_diff/rspec.rb', line 29

def self.a_collection_including_something?(value)
  fuzzy_object?(value) &&
    value.respond_to?(:expecteds) &&
    !(value.expecteds.one? && value.expecteds.first.is_a?(::Hash))
end

.a_hash_including_something?(value) ⇒ Boolean

Returns:

  • (Boolean)


22
23
24
25
26
27
# File 'lib/super_diff/rspec.rb', line 22

def self.a_hash_including_something?(value)
  fuzzy_object?(value) &&
    value.respond_to?(:expecteds) &&
    value.expecteds.one? &&
    value.expecteds.first.is_a?(::Hash)
end

.a_kind_of_something?(value) ⇒ Boolean

Returns:

  • (Boolean)


45
46
47
48
# File 'lib/super_diff/rspec.rb', line 45

def self.a_kind_of_something?(value)
  fuzzy_object?(value) &&
    value.base_matcher.is_a?(::RSpec::Matchers::BuiltIn::BeAKindOf)
end

.a_value_within_something?(value) ⇒ Boolean

Returns:

  • (Boolean)


55
56
57
58
# File 'lib/super_diff/rspec.rb', line 55

def self.a_value_within_something?(value)
  fuzzy_object?(value) &&
    value.base_matcher.is_a?(::RSpec::Matchers::BuiltIn::BeWithin)
end

.an_instance_of_something?(value) ⇒ Boolean

Returns:

  • (Boolean)


50
51
52
53
# File 'lib/super_diff/rspec.rb', line 50

def self.an_instance_of_something?(value)
  fuzzy_object?(value) &&
    value.base_matcher.is_a?(::RSpec::Matchers::BuiltIn::BeAnInstanceOf)
end

.an_object_having_some_attributes?(value) ⇒ Boolean

Returns:

  • (Boolean)


35
36
37
38
# File 'lib/super_diff/rspec.rb', line 35

def self.an_object_having_some_attributes?(value)
  fuzzy_object?(value) &&
    value.base_matcher.is_a?(::RSpec::Matchers::BuiltIn::HaveAttributes)
end

.configurationObject



18
19
20
# File 'lib/super_diff/rspec.rb', line 18

def self.configuration
  SuperDiff.configuration
end

.configure {|configuration| ... } ⇒ Object

Yields:



14
15
16
# File 'lib/super_diff/rspec.rb', line 14

def self.configure
  yield configuration
end

.fuzzy_object?(value) ⇒ Boolean

Returns:

  • (Boolean)


60
61
62
# File 'lib/super_diff/rspec.rb', line 60

def self.fuzzy_object?(value)
  value.is_a?(::RSpec::Matchers::AliasedMatcher)
end

.rspec_versionObject



64
65
66
67
68
69
# File 'lib/super_diff/rspec.rb', line 64

def self.rspec_version
  @_rspec_version ||= begin
    require "rspec/core/version"
    GemVersion.new(::RSpec::Core::Version::STRING)
  end
end