Sha256: 31f1f49defaa57470b0351db41d7cf19fe4d4a3c6983000dcbf9d1a9b4546b2b

Contents?: true

Size: 1.3 KB

Versions: 4

Compression:

Stored size: 1.3 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

    it "should allow namespaced models" do
      Cucumber::Factory.send(:model_class_from_prose, "people/actor").should == People::Actor
    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

4 entries across 4 versions & 1 rubygems

Version Path
cucumber_factory-1.7.4 spec/factory_spec.rb
cucumber_factory-1.7.3 spec/factory_spec.rb
cucumber_factory-1.7.2 spec/factory_spec.rb
cucumber_factory-1.7.1 spec/factory_spec.rb