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.

Parameters:

  • names (Array<Symbol, String, Hash>)

    Names of blueprints/namespaces to build. Pass Hash if you want to pass additional options.


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.

Parameters:

  • names (Array<Symbol, String, Hash>)

    Names of blueprints/namespaces to build. Pass Hash if you want to pass additional options.


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}

Returns:

  • (Blueprints::Dependency)

    Dependency object that can be passed as option when building blueprint/namespace.

See Also:


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

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