Sha256: 34e5d6e306f66424f7182f307cc437bb884e6d3aed0b5a03a5f953b9721c5331

Contents?: true

Size: 1.32 KB

Versions: 4

Compression:

Stored size: 1.32 KB

Contents

require "spec_helper"

describe Phenomenal::RelationshipsStore do
  before :each do
    @source = context :source
    @target = context :target
    @relationship = Phenomenal::Relationship.new(:source,:target,phen_default_context)
    @relationship2 = Phenomenal::Relationship.new(:source2,:target2,phen_default_context)
    @relationship12 = Phenomenal::Relationship.new(:source,:target2,phen_default_context)
    @store = Phenomenal::RelationshipsStore.new
  end
  
  after :each do
    force_forget_context(@source)
    force_forget_context(@target)
  end
  
  describe "#add" do
    it "should add the relationship to the store" do
      @store.add(@relationship)
      @store.include?(@relationship).should be_true
    end
  end
  
  describe "#remove" do
    it "should remove the relationship from the store" do
      @store.add(@relationship)
      @store.remove(@relationship)
      @store.include?(@relationship).should be_false
    end
  end
  
  describe "#get_for" do
    it "should return the relationships that concern the target" do
      @store.add(@relationship)
      @store.add(@relationship2)
      @store.add(@relationship12)
      @store.get_for(@source).should include(@relationship)
      @store.get_for(@source).should include(@relationship12)
      @store.get_for(@source).should_not include(@relationship2)
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
phenomenal-1.1.1 spec/relationships/relationships_store_spec.rb
phenomenal-1.1.0 spec/relationships/relationships_store_spec.rb
phenomenal-1.0.1 spec/relationships/relationships_store_spec.rb
phenomenal-1.0.0 spec/relationships/relationships_store_spec.rb