Sha256: 8e8d644903735ea1d23d6b2a70f72f0009dccf03e3a86cef6a3c8acb50d83522

Contents?: true

Size: 774 Bytes

Versions: 6

Compression:

Stored size: 774 Bytes

Contents

shared_examples_for "an Etapper abstract type" do
  def api_base
    described_class.name.gsub(/::/, "::API::")
  end

  @api_methods.each do |attribute|
    it "knows its #{attribute}" do
      eval("@this.#{attribute}").should == eval("@api_object.#{attribute}")
    end
  end
  
  (@api_methods - @api_readonly_methods).each do |attribute|
    it "can set its #{attribute}" do
      eval("@this.#{attribute} = 'foo'")
      eval("@this.#{attribute}").should == 'foo'
    end
  end
      
  @api_readonly_methods.each do |attribute|
    it "cannot set #{attribute}" do
      eval("lambda \{@this.#{attribute} = 'foo'\}").should raise_error(Etapper::ReadOnlyError)
    end
  end
  
  it "returns its base" do
    @this.base.class.name.should == api_base
  end
  
      
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
etapper-0.0.5 spec/shared_etap_abstract_spec.rb
etapper-0.0.4 spec/shared_etap_abstract_spec.rb
etapper-0.0.3 spec/shared_etap_abstract_spec.rb
etapper-0.0.2 spec/shared_etap_abstract_spec.rb
etapper-0.0.1 spec/shared_etap_abstract_spec.rb
etapper-0.0.0 spec/shared_etap_abstract_spec.rb