Sha256: d1c6078685586c822086eed0e1a72483ae215679fbf6b6f5faa418ce59474fdf

Contents?: true

Size: 1.08 KB

Versions: 3

Compression:

Stored size: 1.08 KB

Contents

require File.expand_path('../../test_helper', __FILE__)

class FollowTest < ActiveModel::TestCase
  #include ActiveModel::Lint::Tests

  def setup
    super
    @pig = Pig.create!
    @pigkeeper = Pigkeeper.create! :visited => true, :pockets => 1
    @attributes = {:follower => @pig, :resource => @pigkeeper}
    @model = Fauna::Follow.new(@attributes)
  end

  def test_create
    follow = Fauna::Follow.create(@attributes)
    assert follow.persisted?
    assert follow.ref
  end

  def test_save
    follow = Fauna::Follow.new(@attributes)
    follow.save
    assert follow.persisted?
    assert follow.ref
  end

  def test_update
    follow = Fauna::Follow.create(@attributes)
    assert_raises(Fauna::Invalid) do
      follow.update(@attributes)
    end
  end

  def test_find
    Fauna::Follow.create(@attributes)
    follow = Fauna::Follow.find_by_follower_and_resource(@pig, @pigkeeper)
    assert follow.persisted?
    assert follow.ref
  end

  def test_destroy
    follow = Fauna::Follow.create(@attributes)
    follow.destroy
    assert !follow.persisted?
    assert follow.ref
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
fauna-0.1.2 test/model/follow_test.rb
fauna-0.1.1 test/model/follow_test.rb
fauna-0.1 test/model/follow_test.rb