Sha256: 344efb23f16d87e47c774f94aeb207c6faf9fc95b9f59ffdef7f6e3636ae1a37

Contents?: true

Size: 742 Bytes

Versions: 3

Compression:

Stored size: 742 Bytes

Contents

require File.expand_path("../spec_helper", __FILE__)

module Danger
  describe Danger::DiffInlineTodoFinder do
    let(:subject) { Danger::DiffInlineTodoFinder.new(%w(TODO FIXME)) }

    describe "#call" do
      it "finds todos inline after code" do
        patch = <<PATCH
+ function bla() {}; // TODO: fix this
PATCH

        diff = sample_diff(patch)

        todos = subject.call([diff])

        expect(todos.first.text).to eq("fix this")
      end

      it "doesn't find floating todos" do
        patch = <<PATCH
+ # TODO: practice you must
+ def practice
+   return false
+ end
+ # FIXME: with you the force is
PATCH

        todos = subject.call([sample_diff(patch)])

        expect(todos).to be_empty
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
danger-todoist-2.0.1 spec/diff_inline_todo_finder_spec.rb
danger-todoist-2.0.0 spec/diff_inline_todo_finder_spec.rb
danger-todoist-1.3.0 spec/diff_inline_todo_finder_spec.rb