Class: Quarry::Design::Specification::Context

Inherits:
Object
  • Object
show all
Defined in:
lib/quarry/design/spec.rb

Overview

A context provides a “clean room” to build a specification.

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(relation, *description, &specification) ⇒ Object



123
124
125
126
127
128
129
# File 'lib/quarry/design/spec.rb', line 123

def method_missing(relation, *description, &specification)
  if description.size > 1
    super
  else
    specifications << Specification.new(relation, description.first, self, &specification)
  end
end

Instance Method Details

#after(&after) ⇒ Object



119
120
121
# File 'lib/quarry/design/spec.rb', line 119

def after(&after)
  after ? @after = after : after
end

#before(&before) ⇒ Object



115
116
117
# File 'lib/quarry/design/spec.rb', line 115

def before(&before)
  before ? @before = before : before
end

#specificationsObject



111
112
113
# File 'lib/quarry/design/spec.rb', line 111

def specifications
  @specifications ||= []
end