Sha256: 437ada4714f84fb72df4460b1e2e83e11e1167d905dd98a8401fca4b9cdc2c3a

Contents?: true

Size: 663 Bytes

Versions: 6

Compression:

Stored size: 663 Bytes

Contents

require 'spec_helper'
require 'wordlist/operators/unique'

describe Wordlist::Operators::Unique do
  let(:wordlist)  { %w[foo bar bar baz foo qux] }

  subject { described_class.new(wordlist) }

  describe "#each" do
    context "when given a block" do
      it "must yield the unique words from the wordlist" do
        expect { |b|
          subject.each(&b)
        }.to yield_successive_args(*wordlist.uniq)
      end
    end

    context "when not given a block" do
      it "must return an Enumerator for the #each" do
        expect(subject.each).to be_kind_of(Enumerator)
        expect(subject.each.to_a).to eq(wordlist.uniq)
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
wordlist-1.1.1 spec/operators/unique_spec.rb
wordlist-1.1.0 spec/operators/unique_spec.rb
wordlist-1.0.3 spec/operators/unique_spec.rb
wordlist-1.0.2 spec/operators/unique_spec.rb
wordlist-1.0.1 spec/operators/unique_spec.rb
wordlist-1.0.0 spec/operators/unique_spec.rb