Sha256: 5fb2cae3963d49aa42c933c437ee2b87b5a4b76eee27e5f79bb4cd8f02fa93c7

Contents?: true

Size: 931 Bytes

Versions: 6

Compression:

Stored size: 931 Bytes

Contents

require 'spec_helper'
require 'wordlist/modifiers/mutate_case'

describe Wordlist::Modifiers::MutateCase do
  let(:wordlist) { %w[foo BaR] }

  subject { described_class.new(wordlist) }

  describe "#each" do
    let(:expected_words) do
      %w[
        foo
        Foo
        fOo
        foO
        FOo
        FoO
        fOO
        FOO
        BaR
        baR
        BAR
        Bar
        bAR
        bar
        BAr
        bAr
      ]
    end

    context "when given a block" do
      it "must enumerate through every possible uppercase/lowercase combination" do
        expect { |b|
          subject.each(&b)
        }.to yield_successive_args(*expected_words)
      end
    end

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

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
wordlist-1.1.1 spec/modifiers/mutate_case_spec.rb
wordlist-1.1.0 spec/modifiers/mutate_case_spec.rb
wordlist-1.0.3 spec/modifiers/mutate_case_spec.rb
wordlist-1.0.2 spec/modifiers/mutate_case_spec.rb
wordlist-1.0.1 spec/modifiers/mutate_case_spec.rb
wordlist-1.0.0 spec/modifiers/mutate_case_spec.rb