stevehodgkiss/generator_spec

Warning about missing #description method.

sungwoncho opened this issue · 2 comments

When I run a spec, I get the following warning:

specify { expect(object).to matcher }

or this:

it { is_expected.to matcher }

RSpec expects the matcher to have a #description method. You should either
add a String to the example this matcher is being used in, or give it a
description method. Then you won't have to suffer this lengthy warning again.

My spec looks like this:

  specify { 
    expect(destination_root).to have_structure { 
      directory "db" do
        directory "migrate" do
          migration "create_friendships"
        end
      end
    }
  }

Is it the way I am using this gem, or is there something missing in the gem, as the warning suggests?

bobf commented

@sungwoncho You're not missing anything. This code removes the warning (though not with anything useful):

class GeneratorSpec::Matcher::File
  def description
    'hello'
  end
end

class GeneratorSpec::Matcher::Directory
  def description
    'hello'
  end
end

I'll submit a PR to fix it properly if the author is interested ? @stevehodgkiss

Sounds good @bobf 👍