Sha256: c42258ae83c525bd339fd1b6a912b84702e36a7ab1d87c0e056516e85321b694
Contents?: true
Size: 1.25 KB
Versions: 1
Compression:
Stored size: 1.25 KB
Contents
require "spec_helper" describe Turnip::Execute do let(:mod) { Module.new } let(:obj) { Object.new.tap { |o| o.extend Turnip::Execute; o.extend mod } } it "defines a step method and makes it callable" do mod.step("a test step") { "monkey" } obj.step("a test step").should == "monkey" end it "allows placeholders to be filled and passed as arguments" do mod.step("a :test step") { |test| test.upcase } obj.step("a cool step").should == "COOL" end it "allows step to be called as a method via `send`" do mod.step("a :test step") { |test| test.upcase } obj.send("a :test step", "cool").should == "COOL" end it "sends in extra arg from a builder step" do mod.step("a :test step") { |test, foo| test.upcase + foo } obj.step("a cool step", "foo").should == "COOLfoo" end it "can be executed with a builder step" do builder_step = stub(:to_s => "a cool step", :extra_args => []) mod.step("a :test step") { |test| test.upcase } obj.step(builder_step).should == "COOL" end it "sends in extra arg from a builder step" do builder_step = stub(:to_s => "a cool step", :extra_args => ["foo"]) mod.step("a :test step") { |test, foo| test.upcase + foo } obj.step(builder_step).should == "COOLfoo" end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
turnip-1.0.0 | spec/define_and_execute.rb |