Sha256: 999478c1cc59c78bff1a1a3b12a5497fd29469169cde960cd7338e2007ebd072

Contents?: true

Size: 1.55 KB

Versions: 4

Compression:

Stored size: 1.55 KB

Contents

# -*- encoding : utf-8 -*-

describe Card::Set::All::Collection do
  describe "#item_names" do
    it "returns item for each line of basic content" do
      Card.new( :name=>"foo", :content => "X\nY" ).item_names.should == ["X","Y"]
    end

    it "returns list of card names for search" do
      c = Card.new( :name=>"foo", :type=>"Search", :content => %[{"name":"Z"}])
      c.item_names.should == ["Z"]
    end

    it "handles searches relative to context card" do
      # note: A refers to 'Z'
      Card.new(:name=>"foo", :type=>"Search", :content => %[{"referred_to_by":"_self"}]).item_names( :context=>'A' ).should == ["Z"]
    end
  end

  describe "#extended_list" do
    it "returns item's content for pointer setting" do
      c = Card.new(:name=>"foo", :type=>"Pointer", :content => "[[Z]]")
      c.extended_list.should == ["I'm here to be referenced to"]
    end
  end

  describe "#contextual_content" do

    it "processes inclusions relative to context card" do
      context_card = Card["A"] # refers to 'Z'
      c = Card.new(:name=>"foo", :content => "{{_self+B|core}}")
      c.contextual_content( context_card ).should == "AlphaBeta"
    end

    it "returns content even when context card is hard templated" do #why the heck is this good?  -efm
      context_card = Card["A"] # refers to 'Z'
      
      Card::Auth.as_bot do
        Card.create! :name => "A+*self+*structure", :content => "Banana"
      end
      c = Card.new( :name => "foo", :content => "{{_self+B|core}}" )
      c.contextual_content( context_card ).should == "AlphaBeta"
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
wagn-1.13.0 spec/mod/core/set/all/collection_spec.rb
wagn-1.13.0.pre2 spec/mods/core/sets/all/collection_spec.rb
wagn-1.13.0.pre1 spec/mods/core/sets/all/collection_spec.rb
wagn-1.13.0.pre spec/mods/core/sets/all/collection_spec.rb