Sha256: 276ae74f50be5bd8f8a5ef84deca4dbb782bb686a5d4a61d193d20693c44a111

Contents?: true

Size: 1.36 KB

Versions: 31

Compression:

Stored size: 1.36 KB

Contents

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

describe Card::Set::All::Type do
  describe "card with deckered type" do
    before do
      Card::Auth.as_bot do
        @type = Card.create! name: "Hat", type: "Cardtype"
      end
      @hat = Card.new type: "Hat"
    end

    it "has a type_name" do
      expect(@hat.type_name).to eq("Hat")
    end

    it "does not have a type_code" do
      expect(@hat.type_code).to eq(nil)
    end

    it "has a type_id" do
      expect(@hat.type_id).to eq(@type.id)
    end

    it "has a type_card" do
      expect(@hat.type_card).to eq(@type)
    end
  end

  describe "card with structured type" do
    before do
      Card::Auth.as_bot do
        Card.create! name: "Topic", type: "Cardtype"
        Card.create! name: "Topic+*type+*structure", content: "{{+results}}"
        Card.create! name: "Topic+results+*type plus right+*structure",
                     type: "Search", content: "{}"
      end
    end

    it "clears cache of structured nested card after saving" do
      pending "need new mechanism to replace #reset_type_specific_fields"
      Card::Auth.as_bot do
        expect(Card.fetch("t1+results", new: {}).type_name).to eq("Basic")

        topic1 = Card.new type: "Topic", name: "t1"
        topic1.format._render_new
        topic1.save!
        expect(Card.fetch("t1+results", new: {}).type_name).to eq("Search")
      end
    end
  end
end

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
card-1.97.0.1 mod/core/spec/set/all/type_spec.rb
card-1.97.0 mod/core/spec/set/all/type_spec.rb
card-1.96.8 mod/core/spec/set/all/type_spec.rb
card-1.96.7 mod/core/spec/set/all/type_spec.rb
card-1.96.6 mod/core/spec/set/all/type_spec.rb
card-1.96.5 mod/core/spec/set/all/type_spec.rb
card-1.96.4 mod/core/spec/set/all/type_spec.rb
card-1.96.3 mod/core/spec/set/all/type_spec.rb
card-1.96.2 mod/core/spec/set/all/type_spec.rb
card-1.96.1 mod/core/spec/set/all/type_spec.rb
card-1.96.0 mod/core/spec/set/all/type_spec.rb
card-1.95.3 mod/core/spec/set/all/type_spec.rb
card-1.95.2 mod/core/spec/set/all/type_spec.rb
card-1.95.1 mod/core/spec/set/all/type_spec.rb
card-1.95.0 mod/core/spec/set/all/type_spec.rb
card-1.94.1 mod/core/spec/set/all/type_spec.rb
card-1.94.0 mod/core/spec/set/all/type_spec.rb
card-1.93.13 mod/core/spec/set/all/type_spec.rb
card-1.93.12 mod/core/spec/set/all/type_spec.rb
card-1.93.11 mod/core/spec/set/all/type_spec.rb