Sha256: 835748bfc0092b10b967e7d4f08b1b539c262eb9f501ae2e7704e5c6a7ab988d

Contents?: true

Size: 901 Bytes

Versions: 5

Compression:

Stored size: 901 Bytes

Contents

require 'spec_helper'

describe FactWithContext do
  context 'klass.new with a fact and a graph' do

    let(:graph) { TestFactories::Graph.full }
    let(:fact_with_context) { described_class.new(fact: graph.last, graph: graph) }

    it '#fact returns the fact' do
      fact_with_context.fact.object.should == 'whooha'
    end

    it '#context_summary returns a string' do
      fact_with_context.context_summary.should be_a(String)
    end

    it '#context_summary should be based on visibility and created date' do
      fact_with_context.context_summary.should == 'public 2013-10-13'
    end

    context 'raises when new is not given all arguments' do
      it 'without fact' do
        lambda{ described_class.new(graph: graph) }.should raise_error
      end

      it 'without graph' do
        lambda{ described_class.new(fact: graph.last) }.should raise_error
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
dbd_data_engine-0.0.10 spec/presenters/fact_with_context/new_spec.rb
dbd_data_engine-0.0.9 spec/presenters/fact_with_context/new_spec.rb
dbd_data_engine-0.0.8 spec/presenters/fact_with_context/new_spec.rb
dbd_data_engine-0.0.7 spec/presenters/fact_with_context/new_spec.rb
dbd_data_engine-0.0.6 spec/presenters/fact_with_context/new_spec.rb