Sha256: 8342145ca17cffebda291a1a63aab2eff2bf75cf7fb9f97c2bfa9ef47f4c86a0

Contents?: true

Size: 1.16 KB

Versions: 1

Compression:

Stored size: 1.16 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.send(:model_class_from_prose, "movie").should == Movie
      Cucumber::Factory.send(: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.send(:variable_name_from_prose, "movie").should == :'@movie'
      Cucumber::Factory.send(:variable_name_from_prose, "Some Movie").should == :'@some_movie'
    end
    
    it "should make sure the generated instance variable names are legal" do
      Cucumber::Factory.send(:variable_name_from_prose, "1973").should == :'@_1973'
      Cucumber::Factory.send(:variable_name_from_prose, "%$ยง").should == :'@_'
    end
    
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cucumber_factory-1.7.0 spec/factory_spec.rb