Sha256: 9670263b34fb666ef3e27b148b811d4ebf9200cd3270407f9974ff5ef1b92b5f

Contents?: true

Size: 792 Bytes

Versions: 28

Compression:

Stored size: 792 Bytes

Contents

require 'spec_helper'

class Document
  include CouchPotato::Persistence
  
  property :title
  property :content
end

describe "new" do
  context "without arguments" do
    subject { Document.new }

    it { should be_a(Document) }
    its(:title) { should be_nil }
    its(:content) { should be_nil }
  end

  context "with an argument hash" do
    subject { Document.new(:title => 'My Title') }

    it { should be_a(Document) }
    its(:title) { should == 'My Title'}
    its(:content) { should be_nil }
  end

  context "yielding to a block" do
    subject {
      Document.new(:title => 'My Title') do |doc|
        doc.content = 'My Content'
      end
    }

    it { should be_a(Document) }
    its(:title) { should == 'My Title'}
    its(:content) { should == 'My Content'}
  end
end

Version data entries

28 entries across 28 versions & 3 rubygems

Version Path
couch_potato-1.4.0 spec/unit/initialize_spec.rb
couch_potato-1.3.0 spec/unit/initialize_spec.rb
couch_potato-1.2.0 spec/unit/initialize_spec.rb
couch_potato-1.1.4 spec/unit/initialize_spec.rb
couch_potato-1.1.2 spec/unit/initialize_spec.rb
couch_potato-1.1.1 spec/unit/initialize_spec.rb
couch_potato-1.1.0 spec/unit/initialize_spec.rb
couch_potato-1.0.1 spec/unit/initialize_spec.rb
couch_potato-1.0.0 spec/unit/initialize_spec.rb
couch_potato-0.7.1 spec/unit/initialize_spec.rb
couch_potato-0.7.0 spec/unit/initialize_spec.rb
couch_potato-0.7.0.pre.1 spec/unit/initialize_spec.rb
couch_potato-0.6.0 spec/unit/initialize_spec.rb
couch_potato-0.5.7 spec/unit/initialize_spec.rb
couch_potato-rails2-0.5.10 spec/unit/initialize_spec.rb
couch_potato-rails2-0.5.9 spec/unit/initialize_spec.rb
couch_potato-rails2-0.5.8 spec/unit/initialize_spec.rb
couch_potato-rails2-0.5.7 spec/unit/initialize_spec.rb
couch_potato-rails2-0.5.6 spec/unit/initialize_spec.rb
couch_potato-0.5.6 spec/unit/initialize_spec.rb