Sha256: 875139c498f6679c2be06948056fe35e2e2d679928c4aca0d1cf3d54fcc251cb

Contents?: true

Size: 1.08 KB

Versions: 2

Compression:

Stored size: 1.08 KB

Contents

require File.expand_path(File.dirname(__FILE__) + '/spec_helper')

describe Blueprints::BlueprintNameProxy do
  subject do
    Blueprints::BlueprintNameProxy.new(:regexp_blueprint, namespace_regexp_blueprint)
  end

  it "should pass matched groups as options" do
    subject.build(stage)
    stage.instance_variable_get(:@namespace_regexp_blueprint).should == {:arg0 => 'blueprint'}
  end

  it "should pass any other options" do
    namespace_regexp_blueprint.expects(:build).with(stage, :options => {:passed => 1, :arg0 => 'blueprint'}, :rebuild => true, :name => :regexp_blueprint)
    subject.build(stage, :options => {:passed => 1}, :rebuild => true)
  end

  it "should allow capturing named groups" do
    if RUBY_VERSION.start_with?('1.9')
      regexp = 'regexp_(?<name>.*)'
      namespace_regexp_blueprint(Regexp.new(regexp))
      subject.build(stage)
      stage.instance_variable_get(:@namespace_regexp_blueprint).should == {:name => 'blueprint'}
    end
  end

  it "should allow demolishing buildable" do
    subject.build(stage).expects(:destroy)
    subject.demolish(stage)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
blueprints-1.0.1 spec/unit/blueprint_name_proxy_spec.rb
blueprints-1.0.0 spec/unit/blueprint_name_proxy_spec.rb