Sha256: 811f9cbb82929a802776e5f37faea69f20b2c9e1ebada0bd193d57f38186033f

Contents?: true

Size: 1.62 KB

Versions: 2

Compression:

Stored size: 1.62 KB

Contents

require 'lemon'
require 'ae'
require 'dnote/notes'

testcase DNote::Notes do

  concern "Coverage of DNote::Notes class."

  method :labels do
    test 'returns the list of labels' do
      notes = DNote::Notes.new([], :labels=>['TODO'])
      notes.labels.assert == ['TODO'] #DNote::Notes::DEFAULT_LABELS
    end
  end

  method :files do
    test 'returns the files attribute' do
      notes = DNote::Notes.new(["example1.rb"])
      notes.assert.files == ["example1.rb"]
      notes = DNote::Notes.new([], :paths => ["example2.rb"])
      notes.assert.files == ["example2.rb"]
    end
  end

  method :files do
    test 'changes the paths attribute' do
      notes = DNote::Notes.new([])
      notes.files = ["example1.rb"]
      notes.assert.files == ["example1.rb"]
    end
  end

  method :match_general do
    test 'works' do
      notes = DNote::Notes.new([])
      line, lineno, file = "# TODO: Do something or another!", 1, "foo.rb"
      rec = notes.match_general(line, lineno, file)
      rec.to_h.assert == {'label'=>"TODO",'file'=>file,'line'=>lineno,'text'=>"Do something or another!"}
    end
  end

  method :match_special do
    test 'works' do
      notes = DNote::Notes.new([], :labels=>['TODO'])
      line, lineno, file = "# TODO: Do something or another!", 1, "foo.rb"
      rec = notes.match_special(line, lineno, file)
      rec.to_h.assert == {'label'=>"TODO",'file'=>file,'line'=>lineno,'text'=>"Do something or another!"}
    end
  end

  method :counts do
    test{ raise NotImplementedError }
  end

  method :notes do
    test{ raise NotImplementedError }
  end

  method :parse do
    test{ raise NotImplementedError }
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
dnote-1.7.1 test/notes_case.rb
dnote-1.7.0 test/notes_case.rb