Sha256: d8afb06878b24daf5a570a7b54e488b628d7c77637b66162a1bb68efabc0d07d

Contents?: true

Size: 698 Bytes

Versions: 7

Compression:

Stored size: 698 Bytes

Contents

require 'test_helper'

class CallbacksTest < ActiveSupport::TestCase
  def setup
    @remote_product = RemoteProduct.create!(name: 'MBP', price: '2000', id: 123456).tap{|product| product.update_column :type, nil}
  end

  test "should invoke the configured 'after_each' callback" do
    after_each_callback_mock = MiniTest::Mock.new
    after_each_callback_mock.expect(:call, nil) do |args|
      assert_equal Product.find_by_name('MBP'), args[0]
      assert_identical @remote_product, args[1]
    end

    Forceps.configure :after_each => {Product => after_each_callback_mock}

    Forceps::Remote::Product.find(@remote_product).copy_to_local

    assert after_each_callback_mock.verify
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
forceps-0.6.7 test/callbacks_test.rb
forceps-0.6.4 test/callbacks_test.rb
forceps-0.6.3 test/callbacks_test.rb
forceps-0.6.2 test/callbacks_test.rb
forceps-0.6.1 test/callbacks_test.rb
forceps-0.6.0 test/callbacks_test.rb
forceps-0.5.0 test/callbacks_test.rb