Sha256: ded8bc9cea0cd01f8860db0d1941d0dd238c29f485539976e99975f1e2f8d06f

Contents?: true

Size: 851 Bytes

Versions: 4

Compression:

Stored size: 851 Bytes

Contents

require 'spec_helper'

describe Hemlock::CSVtoFlashcards do

  subject { described_class }
  let(:csv) { './spec/stub.csv' }

  context '#from_file' do
    let(:flashcards) { subject.from_file(csv) }

    specify { expect(flashcards.length).to eq 3 }
    specify { expect(flashcards.first).to be_a_kind_of Hemlock::Flashcard }
    specify { expect(flashcards.first.question).to eq 'do' }
    specify { expect(flashcards.last.answer).to eq 'a name I call myself' }
  end

  context '#create_flashcards' do
    specify { expect(subject.create_flashcards('')).to_not eq [] }
  end

  context "#replace_tildes" do
    let(:dropbox) { "~/dropbox/" }
    let(:ohmy) { "~/ohmy~/" }

    specify { expect(subject.replace_tildes(dropbox)).to eq "#{Dir.home}/dropbox/" }
    specify { expect(subject.replace_tildes(ohmy)).to eq "#{Dir.home}/ohmy~/" }
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
hemlock-0.0.9 spec/hemlock/csv_to_flashcards_spec.rb
hemlock-0.0.8 spec/hemlock/csv_to_flashcards_spec.rb
hemlock-0.0.7 spec/hemlock/csv_to_flashcards_spec.rb
hemlock-0.0.6 spec/hemlock/csv_to_flashcards_spec.rb