Sha256: e2898140ca1059deb63c5e4f129924a5e9ab6de31c95bd74ced3b9c5a476939d

Contents?: true

Size: 1.46 KB

Versions: 8

Compression:

Stored size: 1.46 KB

Contents

require "spec_helper"

describe Phenomenal::Relationship do
  describe "#==" do
    it "should be true for two relationships with the same source and target" do
      a = Phenomenal::Relationship.new(:source,:target,nil)
      b = Phenomenal::Relationship.new(:source,:target,nil)
      a.should == b
    end
    
    it "should be false for relationships concerning different contexts" do
      a = Phenomenal::Relationship.new(:source,:target,nil)
      c = Phenomenal::Relationship.new(:source,:other_target,nil)
      a.should_not == c
      d = Phenomenal::Relationship.new(:other_source,:other_target,nil)
      a.should_not == d
      e = Phenomenal::Relationship.new(:other_source,:target,nil)
      a.should_not == e
      e = Phenomenal::Relationship.new(:other_source,:target,:test)
      a.should_not == e
    end
    
    it "should be false for relationships of different types" do
      a = Phenomenal::Implication.new(:source,:target,nil)
      b = Phenomenal::Requirement.new(:source,:target,nil)
      a.should_not == b
    end
  end
  
  describe "#refresh" do
    it "should update the references of the source and the target contexts" do
      a = Phenomenal::Implication.new(:source,:target,nil)
      expect{a.refresh}.to_not raise_error
      context :source
      context :target
      a.refresh
      a.source.should==context(:source)
      a.target.should==context(:target)
      force_forget_context(:source)
      force_forget_context(:target)
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
phenomenal-1.2.4 spec/relationships/relationship_spec.rb
phenomenal-1.2.3 spec/relationships/relationship_spec.rb
phenomenal-1.2.2 spec/relationships/relationship_spec.rb
phenomenal-1.2.1 spec/relationships/relationship_spec.rb
phenomenal-1.1.1 spec/relationships/relationship_spec.rb
phenomenal-1.1.0 spec/relationships/relationship_spec.rb
phenomenal-1.0.1 spec/relationships/relationship_spec.rb
phenomenal-1.0.0 spec/relationships/relationship_spec.rb