Sha256: c7d8a5e69c916c20bf89f444e723cbd183ab2f8c4afcd6aefda8e44c61498ec3

Contents?: true

Size: 733 Bytes

Versions: 3

Compression:

Stored size: 733 Bytes

Contents

require "spec_helper"
require "hamster/deque"

describe Hamster::Deque do
  [:enqueue, :push].each do |method|
    describe "##{method}" do
      [
        [[], "A", ["A"]],
        [["A"], "B", %w[A B]],
        [["A"], "A", %w[A A]],
        [%w[A B C], "D", %w[A B C D]],
      ].each do |values, new_value, expected|
        describe "on #{values.inspect} with #{new_value.inspect}" do
          let(:deque) { D[*values] }

          it "preserves the original" do
            deque.send(method, new_value)
            deque.should eql(D[*values])
          end

          it "returns #{expected.inspect}" do
            deque.send(method, new_value).should eql(D[*expected])
          end
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
files.com-1.0.55 docs/vendor/bundle/ruby/2.5.0/gems/hamster-3.0.0/spec/lib/hamster/deque/enqueue_spec.rb
hamster-3.0.0 spec/lib/hamster/deque/enqueue_spec.rb
hamster-2.0.0 spec/lib/hamster/deque/enqueue_spec.rb