Sha256: 30209d2058436a35573fa4cd574dbd69b61f9ad31447310db673bb6e960de527

Contents?: true

Size: 1.05 KB

Versions: 9

Compression:

Stored size: 1.05 KB

Contents

require 'spec_helper'

require 'cucumber/pickles/fill_in'

RSpec.describe '#FillIN::Factory' do

  class NewCoolStep
    def initialize(*); end
  end

  Pickles.configure do |config|
    config.fill_tag_steps_map = {
      'new_cool_step' => NewCoolStep
    }
  end

  it 'uses custom step if label demands it' do
    label = "input (new_cool_step)"

    step = FillIN::Factory.new(label, nil).call

    expect(step).to be_instance_of(NewCoolStep)
  end

  it 'uses input step if custom step required but not defined' do
    label = "input (another_cool_step)"

    step = FillIN::Factory.new(label, nil).call

    expect(step).to be_instance_of(FillIN::Input)
  end

  it 'uses complex input step if value has :' do
    label = "input (new_cool_step)"
    value = "1:2:3"

    step = FillIN::Factory.new(label, value).call

    expect(step).to be_instance_of(FillIN::ComplexInput)
  end

  it 'uses input step by default' do
    label = "input"
    value = "1"

    step = FillIN::Factory.new(label, value).call

    expect(step).to be_instance_of(FillIN::Input)
  end

end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
pickles-0.1.8 spec/steps/fill_in/factory_spec.rb
pickles-0.1.7 spec/steps/fill_in/factory_spec.rb
pickles-0.1.6 spec/steps/fill_in/factory_spec.rb
pickles-0.1.5 spec/steps/fill_in/factory_spec.rb
pickles-0.1.4 spec/steps/fill_in/factory_spec.rb
pickles-0.1.3 spec/steps/fill_in/factory_spec.rb
pickles-0.1.2 spec/steps/fill_in/factory_spec.rb
pickles-0.1.1 spec/steps/fill_in/factory_spec.rb
pickles-0.1.0 spec/steps/fill_in/factory_spec.rb