Sha256: e1b9d688a4c426790f8cbfcf8be92729bdb9ff5ec292cfbb904b223ec439915f

Contents?: true

Size: 1.26 KB

Versions: 10

Compression:

Stored size: 1.26 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 "#cardname" do
      subject { :wagn_bot.cardname }
      it "converts into a cardname" 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

10 entries across 10 versions & 1 rubygems

Version Path
card-1.92.2 spec/config/initializers/core_extensions_spec.rb
card-1.92.1 spec/config/initializers/core_extensions_spec.rb
card-1.92 spec/config/initializers/core_extensions_spec.rb
card-1.91 spec/config/initializers/core_extensions_spec.rb
card-1.21.0 spec/config/initializers/core_extensions_spec.rb
card-1.20.4 spec/config/initializers/core_extensions_spec.rb
card-1.20.3 spec/config/initializers/core_extensions_spec.rb
card-1.20.2 spec/config/initializers/core_extensions_spec.rb
card-1.20.1 spec/config/initializers/core_extensions_spec.rb
card-1.20.0 spec/config/initializers/core_extensions_spec.rb