Sha256: 261fbd706b3c151c3be7b83f20af076595e572babfa54720c1537a04d6ea8e3e

Contents?: true

Size: 1.3 KB

Versions: 12

Compression:

Stored size: 1.3 KB

Contents

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

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

    it 'should have a type_name' do
      expect(@hat.type_name).to eq('Hat')
    end

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

    it 'should have a type_id' do
      expect(@hat.type_id).to eq(@type.id)
    end

    it 'should have 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 "should clear cache of structured nested card after saving" do
      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

12 entries across 12 versions & 1 rubygems

Version Path
card-1.17.4 mod/01_core/spec/set/all/type_spec.rb
card-1.17.3 mod/01_core/spec/set/all/type_spec.rb
card-1.17.2 mod/01_core/spec/set/all/type_spec.rb
card-1.17.1 mod/01_core/spec/set/all/type_spec.rb
card-1.17.0 mod/01_core/spec/set/all/type_spec.rb
card-1.16.15 mod/01_core/spec/set/all/type_spec.rb
card-1.16.14 mod/01_core/spec/set/all/type_spec.rb
card-1.16.13 mod/01_core/spec/set/all/type_spec.rb
card-1.16.12 mod/01_core/spec/set/all/type_spec.rb
card-1.16.11 mod/01_core/spec/set/all/type_spec.rb
card-1.16.10 mod/01_core/spec/set/all/type_spec.rb
card-1.16.9 mod/01_core/spec/set/all/type_spec.rb