generator_spec icon indicating copy to clipboard operation
generator_spec copied to clipboard

Warning about missing #description method.

Open sungwoncho opened this issue 9 years ago • 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?

sungwoncho avatar Apr 11 '15 00:04 sungwoncho

@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

bobf avatar Sep 27 '18 10:09 bobf

Sounds good @bobf 👍

stevehodgkiss avatar Oct 01 '18 03:10 stevehodgkiss