Sha256: 23544c50460cebca29e627585436964a9967cefcea748d5d8a4c694839c5a0b9

Contents?: true

Size: 683 Bytes

Versions: 3

Compression:

Stored size: 683 Bytes

Contents

shared_examples_for "a zelda base model" do
  it "should respond to the attributes set in the constructor" do
    described_class.new(:foo => 'bar').foo.should eq('bar')
  end
  
  it "should return nil for an attribute set to nil" do
    described_class.new(:foo => nil).foo.should be_nil
  end
  
  it "should not respond to attributes not set in the constructor" do
    lambda { subject.no_not_here_nope }.should raise_error(NoMethodError)
  end
  
  it "allows successive initialization" do
    list = []
    list << described_class.new(:foo => 'bar')
    list << described_class.new(:foo => 'baz')
    
    list[0].foo.should eq('bar')
    list[1].foo.should eq('baz')
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
zelda-1.4.0 spec/support/shared_examples.rb
zelda-1.3.0 spec/support/shared_examples.rb
zelda-1.2.1 spec/support/shared_examples.rb