Sha256: 7d0d01fe4c4ed01001e21ec00af000d10751d155ef9928c36f08b92d7bd24a84

Contents?: true

Size: 731 Bytes

Versions: 1

Compression:

Stored size: 731 Bytes

Contents

require_relative "test_helper"

class LogBookTest < MiniTest::Unit::TestCase
  def setup
    LogBook::Event.destroy_all
    User.destroy_all
    Item.destroy_all

    @user = User.create!(:name => "User Name")
    @item = Item.create!(:title => "Item Title")
  end

  def test_event_on_create
    item = Item.new(:log_book_historian => @user)
    LogBook.expects(:created).with(@user, item)
    item.save!
  end

  def test_event_on_update
    @item.log_book_historian = @user
    LogBook.expects(:updated).with(@user, @item)
    @item.update_attributes(:title => "Other Title")
  end

  def test_event_on_destroy
    @item.log_book_historian = @user
    LogBook.expects(:destroyed).with(@user, @item)
    @item.destroy
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
log_book-0.0.1 test/log_book_test.rb