Module: Blueprints::DescribeHelper

Defined in:
lib/blueprints/extensions/rspec.rb

Instance Method Summary collapse

Instance Method Details

#build_blueprint(*names) ⇒ Object Also known as: build

Creates new before filter that builds blueprints before each spec.



5
6
7
# File 'lib/blueprints/extensions/rspec.rb', line 5

def build_blueprint(*names)
  before { build_blueprint *names }
end

#build_blueprint!(*names) ⇒ Object Also known as: build!

Same as DescribeHelper#build_blueprint except that you can use it to build same blueprint several times.



11
12
13
# File 'lib/blueprints/extensions/rspec.rb', line 11

def build_blueprint!(*names)
  before { build_blueprint! *names }
end

#d(*args) ⇒ Blueprints::Dependency Also known as: blueprint_dependency

Returns Blueprint::Dependency object that can be used to define dependencies on other blueprints.

Examples:

Building :post blueprint with different user.

build :post => {:user => d(:admin)}

Building :post blueprint by first building :user_profile with :name => ‘John’, then taking value of @profile and calling user on it.

build :post => {:user => d(:user_profile, :profile, :name => 'John').user}

See Also:



22
23
24
# File 'lib/blueprints/extensions/rspec.rb', line 22

def d(*args)
  Dependency.new(*args)
end