Sha256: cf64c9025430852901d7aef6fc845e60fbd5a68838208da79307c3344270242d

Contents?: true

Size: 948 Bytes

Versions: 3

Compression:

Stored size: 948 Bytes

Contents

require 'spec_helper'

describe "default values" do
  include SetUpHbaseConnectionBeforeAll 
  include SetTableNamesToTestTable

  subject do
    Person.new("id", {
      :name => "Thorbjorn",
      :age => 22,
      :points => 1
    })
  end

  context "new record" do
    its(:dictionary) { should eq Hash.new }
    its(:points) { should eq 1 }
    its(:status) { should eq false }
    its(:positive_as_default) { should eq true }
    its(:phone_numbers) { should eq [] }
  end

  context "persisted record" do
    before do
      subject.dictionary = nil
      subject.points = nil
      subject.status = nil
      subject.positive_as_default = false
      subject.phone_numbers = nil
      subject.save!
      subject.reload
    end

    its(:dictionary) { should be_nil }
    its(:points) { should be_nil }
    its(:status) { should be_nil }
    its(:positive_as_default) { should be_false }
    its(:phone_numbers) { should eq [] }
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
massive_record-0.2.2 spec/orm/cases/default_values_spec.rb
massive_record-0.2.2.rc2 spec/orm/cases/default_values_spec.rb
massive_record-0.2.2.rc1 spec/orm/cases/default_values_spec.rb