Sha256: 34618839b4f437ac09ea86c57713fe530792363eae95d4dea272b02e95a75a62

Contents?: true

Size: 1.32 KB

Versions: 4

Compression:

Stored size: 1.32 KB

Contents

require "spec_helper"

describe Phenomenal::RelationshipStore do
  before :each do
    @source = context :source
    @target = context :target
    @relationship = Phenomenal::Relationship.new(:source,:target,phen_default_feature)
    @relationship2 = Phenomenal::Relationship.new(:source2,:target2,phen_default_feature)
    @relationship12 = Phenomenal::Relationship.new(:source,:target2,phen_default_feature)
    @store = Phenomenal::RelationshipStore.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.2.4 spec/relationships/relationships_store_spec.rb
phenomenal-1.2.3 spec/relationships/relationships_store_spec.rb
phenomenal-1.2.2 spec/relationships/relationships_store_spec.rb
phenomenal-1.2.1 spec/relationships/relationships_store_spec.rb