Sha256: 282a36f928aa5664c0fa8b722e955777f99fe66d96f981c8ae3f16cdb0026068

Contents?: true

Size: 1.29 KB

Versions: 3

Compression:

Stored size: 1.29 KB

Contents

require 'spec_helper'

describe MassiveRecord::ORM::RawData do
  let(:value) { "FooBar!" }
  let(:created_at) { Time.now.to_s }

  subject { MassiveRecord::ORM::RawData.new(value: value, created_at: created_at) }

  describe "#initialize" do
    it "assigns value" do
      subject.value.should eq value
    end

    it "assigns created_at" do
      subject.created_at.should eq created_at
    end
  end


  describe ".new_with_data_from" do
    describe "thrift cell" do
      let(:cell) { MassiveRecord::Wrapper::Cell.new(value: value, created_at: created_at) }

      subject { described_class.new_with_data_from(cell) }

      it "assigns value" do
        subject.value.should eq value
      end

      it "assigns created_at" do
        subject.created_at.should eq created_at
      end
    end
  end


  describe "#to_s" do
    it "represents itself with it's value" do
      subject.to_s.should eq value
    end
  end

  describe "#inspect" do
    it "represents itself with it's value" do
      subject.to_s.should eq value
    end
  end

  
  describe "equality" do
    it "considered equal if created at and value are the same" do
      cell = described_class.new_with_data_from(
        MassiveRecord::Wrapper::Cell.new(value: value, created_at: created_at)
      )
      cell.should eq subject
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

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