Sha256: 2793f3212d31e184b46c84b8dca6e9e64e498a974cb1379738eacdbfb7537d78

Contents?: true

Size: 1.2 KB

Versions: 28

Compression:

Stored size: 1.2 KB

Contents

RSpec.describe Card::Set::Type::Cardtype do
  it "can only be deleted when no instances present" do
    city = create_cardtype "City"
    sparta = create_city "Sparta"
    expect(sparta.type_id).to eq city.id
    expect { city.delete! }.to raise_error(/this card must remain/)
    expect(Card["City"]).to be_a(Card)
    sparta.delete!
    expect { city.delete! }.not_to raise_error
  end

  it "type can't be change when instances present" do
    expect { update "Cardtype A", type_id: Card::BasicID }
      .to raise_error(/can't alter this type/)
    Card["type-a-card"].delete!
    expect { update "Cardtype A", type_id: Card::BasicID }.not_to raise_error
    expect(Card["Cardtype A"]).to have_type :basic
  end

  specify "no cards without cardtype" do
    Card.all.each do |card|
      expect(card.type_card).to be_a(Card)
    end
  end

  describe "new Cardtype" do
    let(:ct) do
      Card::Auth.as_bot do
        Card.create! name: "Animal", type: "Cardtype"
      end
    end

    it "has create permissions" do
      expect(ct.who_can(:create)).not_to be_nil
    end

    it "its create permissions should be based on Basic" do
      expect(ct.who_can(:create)).to eq(Card[:basic].who_can(:create))
    end
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
card-1.108.1 mod/core/spec/set/type/cardtype_spec.rb
card-1.108.0 mod/core/spec/set/type/cardtype_spec.rb
card-1.107.0 mod/core/spec/set/type/cardtype_spec.rb
card-1.106.0 mod/core/spec/set/type/cardtype_spec.rb
card-1.105.6 mod/core/spec/set/type/cardtype_spec.rb
card-1.105.5 mod/core/spec/set/type/cardtype_spec.rb
card-1.105.4 mod/core/spec/set/type/cardtype_spec.rb
card-1.105.3 mod/core/spec/set/type/cardtype_spec.rb
card-1.105.2.pre1 mod/core/spec/set/type/cardtype_spec.rb
card-1.105.2 mod/core/spec/set/type/cardtype_spec.rb
card-1.105.1 mod/core/spec/set/type/cardtype_spec.rb
card-1.105.0 mod/core/spec/set/type/cardtype_spec.rb
card-1.104.2 mod/core/spec/set/type/cardtype_spec.rb
card-1.104.1 mod/core/spec/set/type/cardtype_spec.rb
card-1.104.0 mod/core/spec/set/type/cardtype_spec.rb
card-1.103.4 mod/core/spec/set/type/cardtype_spec.rb
card-1.103.3 mod/core/spec/set/type/cardtype_spec.rb
card-1.103.2 mod/core/spec/set/type/cardtype_spec.rb
card-1.103.1 mod/core/spec/set/type/cardtype_spec.rb
card-1.103.0 mod/core/spec/set/type/cardtype_spec.rb