Sha256: 8ab80b90e0d0023652a1e045ccd23c5018311b94eb3628e316c292c64fe1e2da

Contents?: true

Size: 730 Bytes

Versions: 1

Compression:

Stored size: 730 Bytes

Contents

require_relative "test_helper"

class PluginTest < 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.1.1 test/plugin_test.rb