Sha256: 7011d26d1d970cae850869d251b8d49533bb650ae5625a868a41b8a5fa03210a

Contents?: true

Size: 973 Bytes

Versions: 1

Compression:

Stored size: 973 Bytes

Contents

require 'helper'

describe TomatoHarvest::List do

  def add_task(name)
    task = TomatoHarvest::Task.new(name)
    TomatoHarvest::List.add(task)
  end

  describe '.add' do

    it 'adds to the list' do
      add_task('foo')
      expect(described_class.all.first).to be_an_instance_of(TomatoHarvest::Task)
    end

  end

  describe '.list' do

    it 'should have two items' do
      add_task('foo')
      add_task('bar')
      expect(described_class.all.count).to eql(2)
    end

  end

  describe '.find' do

    it 'returns the task with the corresponding id' do
      add_task('foo')
      add_task('bar')
      expect(described_class.find(1).name).to eql('foo')
      expect(described_class.find(2).name).to eql('bar')
    end

  end

  describe '#add' do

    it 'adds the task to the items array' do
      task = TomatoHarvest::Task.new('foo')
      list = described_class.new
      list.add(task)
      expect(list.items.first.id).to eql(1)
    end

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tomatoharvest-0.0.1 spec/lib/tomatoharvest/list_spec.rb