Sha256: c3f842b08f36d13ebf414a833195a87e89d91846b35053bcea8128e6d0aa2d0f

Contents?: true

Size: 842 Bytes

Versions: 5

Compression:

Stored size: 842 Bytes

Contents

require "pp"        # to avoid an error in fakefs
require "fakefs"
require "noter/note_file"

module Noter
  describe NoteFile do
    let(:file) { Noter::NoteFile.new("2014_09_21_18_20_22.txt") }

    before do
      FileUtils.mkdir_p NoteFile.dir
    end

    it "returns a formatted time from the filename" do
      expect(file.formatted_time).to eql("09-21 18:20")
    end

    describe "#content" do
      before do
        File.write(file.filename, "some content")
      end

      it "returns the content of the file" do
        expect(file.content).to eql("some content")
      end
    end

    describe "#first_line" do
      before do
        File.write(file.filename, "some content\nline 2")
      end

      it "returns the content of the file" do
        expect(file.first_line).to eql("some content")
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
noter-0.4.0 spec/lib/noter/note_file_spec.rb
noter-0.3.0 spec/lib/noter/note_file_spec.rb
noter-0.2.0 spec/lib/noter/note_file_spec.rb
noter-0.1.0 spec/lib/noter/note_file_spec.rb
noter-0.0.2 spec/lib/noter/note_file_spec.rb