Sha256: 5da7c9b9f3ce296b64f6438fb980b3de3cdadd6a41e3b1cc8fff4e035425f912

Contents?: true

Size: 1.25 KB

Versions: 4

Compression:

Stored size: 1.25 KB

Contents

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

describe CoreExtensions do
  context Hash do
    describe "#new_nested" do
      it "creates nested hashes" do
        nested_hash = Hash.new_nested Hash, Hash
        expect(nested_hash[:a]).to be_instance_of Hash
        expect(nested_hash[:a][:b]).to be_instance_of Hash
        expect(nested_hash[:d][:c]).to be_instance_of Hash
      end

      it "creates set in hash" do
        nested_hash = Hash.new_nested ::Set
        expect(nested_hash[:a]).to be_instance_of ::Set
      end
    end
  end

  context CoreExtensions::PersistentIdentifier do
    describe "#name" do
      subject { :wagn_bot.cardname }
      it "converts into a name" do
        is_expected.to be_instance_of Card::Name
        expect(subject.s).to eq "Wagn Bot"
      end
    end

    describe "#card" do
      context "called on Integer" do
        subject { Card::LogoID.card }
        it "converts into a card" do
          is_expected.to be_instance_of Card
          expect(subject.id).to eq Card::LogoID
        end
      end

      context "called on Symbol" do
        subject { :logo.card }
        it "converts into a card" do
          is_expected.to be_instance_of Card
          expect(subject.key).to eq(:logo.cardname.key)
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
card-1.93.3 spec/config/initializers/core_extensions_spec.rb
card-1.93.2 spec/config/initializers/core_extensions_spec.rb
card-1.93.1 spec/config/initializers/core_extensions_spec.rb
card-1.93.0 spec/config/initializers/core_extensions_spec.rb