Sha256: 61d7184c7bf1834d24dc42738f976af4f4ec6be7ba14b2509aa5db059e19081c

Contents?: true

Size: 692 Bytes

Versions: 6

Compression:

Stored size: 692 Bytes

Contents

require 'spec_helper'
require 'wordlist/modifiers/downcase'

describe Wordlist::Modifiers::Downcase do
  let(:wordlist) { %w[Foo BAR baz] }

  subject { described_class.new(wordlist) }

  describe "#each" do
    let(:expected_words) { wordlist.map(&:downcase) }

    context "when given a block" do
      it "must downcase each word" 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/downcase_spec.rb
wordlist-1.1.0 spec/modifiers/downcase_spec.rb
wordlist-1.0.3 spec/modifiers/downcase_spec.rb
wordlist-1.0.2 spec/modifiers/downcase_spec.rb
wordlist-1.0.1 spec/modifiers/downcase_spec.rb
wordlist-1.0.0 spec/modifiers/downcase_spec.rb