Sha256: 5db7960b17482349f3edbde89fc8f1da5f5616653402f21870531b73afab11b9

Contents?: true

Size: 720 Bytes

Versions: 1

Compression:

Stored size: 720 Bytes

Contents

require_relative "test_helper"

class PluginTest < MiniTest::Test
  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.7 test/plugin_test.rb