Sha256: 8eec085e98ba261f2c9812daeff2d4019702f28b19fb885d2a96706fe034bd80

Contents?: true

Size: 878 Bytes

Versions: 8

Compression:

Stored size: 878 Bytes

Contents

require File.expand_path(File.dirname(__FILE__) + "../../spec_helper")

class MyTestPage < PageModels::Base
  attr_accessor :args
  def initialize(*args)
    @args = args
  end
end

describe PageModels do
  describe "creating instances from cucumber (or similar) text" do
    it "should create an instance with no args" do
      page_model = PageModels.create("my test page", "")
      page_model.args.should == []
    end
  
    it "should create an instance with 1..n args" do
      page_model = PageModels.create("my test page", 'with "some" additional "arguments" denoted by "quotes"')
      page_model.args.should == ["some", "arguments", "quotes"]
    end
    
    it "should raise a helpful error when the class does not exist" do
      lambda { page_model = PageModels.create("not real page", "") }.should raise_error(PageModels::MissingPageModelError)
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
pagemodels-0.1.8 spec/page_models/core_spec.rb
pagemodels-0.1.7 spec/page_models/core_spec.rb
pagemodels-0.1.6 spec/page_models/core_spec.rb
pagemodels-0.1.5 spec/page_models/core_spec.rb
pagemodels-0.1.4 spec/page_models/core_spec.rb
pagemodels-0.1.3 spec/page_models/core_spec.rb
pagemodels-0.1.2 spec/page_models/core_spec.rb
pagemodels-0.1.1 spec/page_models/core_spec.rb