Sha256: 2483644da425db1f0a7d5d164b75183b6ad1718dcee900451891e0fd748d8d6a
Contents?: true
Size: 1.57 KB
Versions: 2
Compression:
Stored size: 1.57 KB
Contents
require 'spec_helper' describe Turnip::DSL do let(:context) { stub.tap { |s| s.extend(Turnip::DSL) }} let(:an_object) { Object.new.tap { |o| o.extend(Turnip::Execute) }} describe '.steps_for' do before do ::RSpec.stub(:configure) end it 'creates a new module and adds steps to it' do mod = context.steps_for(:foo) do step("foo") { "foo" } end an_object.extend mod an_object.step("foo").should == "foo" end it 'remembers the name of the module' do mod = context.steps_for(:foo) {} mod.tag.should == :foo end it 'tells RSpec to include the module' do config = stub RSpec.should_receive(:configure).and_yield(config) config.should_receive(:include) context.steps_for(:foo) {} end it 'warns of deprecation when called with :global' do context.should_receive(:warn) mod = context.steps_for(:global) do step("foo") { "foo" } end an_object.extend Turnip::Steps an_object.step("foo").should == "foo" end end describe '.step' do it 'adds steps to Turnip::Steps' do context.step('this is a test') { "foo" } context.step('this is another test') { "bar" } an_object.extend Turnip::Steps an_object.step("this is a test").should == "foo" end end describe '.placeholder' do before { Turnip::Placeholder.send(:placeholders).clear } it 'registers the placeholder globally' do context.placeholder('example') { true } Turnip::Placeholder.send(:placeholders).should have_key('example') end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
turnip-1.1.0 | spec/dsl_spec.rb |
turnip-1.0.0 | spec/dsl_spec.rb |