Foodcritic / foodcritic

Lint tool for Chef cookbooks.
http://foodcritic.io
MIT License
408 stars 153 forks source link

readme_file method doesn't mock out a file in testing #762

Open jjasghar opened 6 years ago

jjasghar commented 6 years ago
describe "FC123" do
  context "the readme has the REQUIREMENTS section" do
    readme_file <<-EOF
    # cookbook

    ## Requirements
    EOF
    it { is_expected.not_to violate_rule }
  end

  context "the readme does not have a REQUIREMENTS section" do
   readme_file <<-EOF
    # cookbook

    Some description.
    EOF
   it { is_expected.to violate_rule }
 end
end

In the above example, inspired from https://github.com/Foodcritic/foodcritic/blob/master/spec/functional/fc093_spec.rb seem to be reading in the README.md from the main repo not overwriting it for the mocked out cookbook.