Sha256: 8efa01d85fa287521a48aa13c6a4c705dd9ad51aa9325b559d85b3cb12db3fd2

Contents?: true

Size: 1.12 KB

Versions: 2

Compression:

Stored size: 1.12 KB

Contents

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

describe Cucumber::Factory do

  describe 'add_steps' do
  
    it "should add Given rules to the world" do
      world = mock('world').as_null_object
      world.should_receive(:Given).exactly(2).times
      Cucumber::Factory.add_steps(world)
    end
    
  end
  
  describe 'model_class_from_prose' do

    it "should return the class matching a natural language expression" do
      Cucumber::Factory.model_class_from_prose("movie").should == Movie
      Cucumber::Factory.model_class_from_prose("job offer").should == JobOffer
    end

  end

  describe 'variable_name_from_prose' do
  
    it "should translate natural language to instance variable names" do
      Cucumber::Factory.variable_name_from_prose("movie").should == :'@movie'
      Cucumber::Factory.variable_name_from_prose("Some Movie").should == :'@some_movie'
    end
    
    it "should make sure the generated instance variable names are legal" do
      Cucumber::Factory.variable_name_from_prose("1973").should == :'@_1973'
      Cucumber::Factory.variable_name_from_prose("%$ยง").should == :'@_'
    end
    
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
cucumber_factory-1.6.0 spec/factory_spec.rb
cucumber_factory-1.5.0 spec/factory_spec.rb