Class: ActiveSpec::Specifications::NotSpecification

Inherits:
Object
  • Object
show all
Defined in:
lib/active_spec/specifications/not_specification.rb

Overview

A simple decorator class that negates the specification that it wraps, e.g.:

include ActiveSpec::Specifications

spec = AlwaysPassSpec.new(:foo)
spec.satisfied_by? # returns true
NotSpecification.new(spec).satisfied_by? # returns false

Instance Method Summary collapse

Constructor Details

#initialize(decorated_spec) ⇒ NotSpecification

Returns a new instance of NotSpecification.



11
12
13
# File 'lib/active_spec/specifications/not_specification.rb', line 11

def initialize(decorated_spec)
  @decorated_spec = decorated_spec
end

Instance Method Details

#satisfied_by?(object) ⇒ Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/active_spec/specifications/not_specification.rb', line 15

def satisfied_by?(object)
  not @decorated_spec.satisfied_by?(object)
end