|
33 | 33 | end |
34 | 34 | end |
35 | 35 |
|
36 | | - context "with FrontMatterPropertyExists check only checking that description exists" do |
| 36 | + context "with FrontMatterPropertyExists check only checking description" do |
37 | 37 | pre_commit_config = {"check" => "FrontMatterPropertyExists", "properties" => ["description"]} |
38 | 38 | let(:site) { build_site({ 'pre-commit' => [pre_commit_config] }) } |
39 | 39 |
|
|
61 | 61 | end |
62 | 62 | end |
63 | 63 |
|
| 64 | + context "with FrontMatterPropertyExistsCheck checking description and image" do |
| 65 | + pre_commit_config = {"check" => "FrontMatterPropertyExists", "properties" => ["description", "image"]} |
| 66 | + let(:site) { build_site({ 'pre-commit' => [pre_commit_config] }) } |
| 67 | + |
| 68 | + it "fails if a staged post has a description, but no image" do |
| 69 | + result = runner.run(site, ["spec/fixtures/_posts/2017-01-06-has-description.md"]) |
| 70 | + expect(result[:ok]).to eql(false) |
| 71 | + expect(result[:messages]).to match_array(["Has Description was missing a image. "]) |
| 72 | + end |
| 73 | + |
| 74 | + it "fails if a staged post is missing a description and an image" do |
| 75 | + result = runner.run(site, ["spec/fixtures/_posts/2017-01-06-no-description.md"]) |
| 76 | + expect(result[:ok]).to eql(false) |
| 77 | + message = "No Description was missing a description. No Description was missing a image. " |
| 78 | + expect(result[:messages]).to match_array([message]) |
| 79 | + end |
| 80 | + |
| 81 | + it "succeeds if all staged posts have descriptions and images" do |
| 82 | + result = runner.run(site, ["spec/fixtures/_posts/2017-01-07-has-description-and-image.md"]) |
| 83 | + expect(result[:ok]).to eql(true) |
| 84 | + expect(result[:messages]).to match_array([]) |
| 85 | + end |
| 86 | + end |
| 87 | + |
64 | 88 | context "with description is not duplicate check" do |
65 | 89 | let(:site) { build_site({'pre-commit' => [{"check" => "DescriptionIsNotDuplicate"}]}) } |
66 | 90 |
|
|
0 commit comments