Sha256: c47456101bed17f026dd7083dbfc3d4898e113d0861ffa242a6ba888765ca533

Contents?: true

Size: 1.02 KB

Versions: 10

Compression:

Stored size: 1.02 KB

Contents

require 'test_helper'

class MonitorshipsTest < ActiveSupport::TestCase
  all_fixtures

  def test_should_find_monitorships_from_users
    assert_equal [monitorships(:aaron_pdi)], users(:aaron).monitorships
    assert_equal [monitorships(:sam_pdi)],   users(:sam).monitorships
  end
  
  def test_should_find_monitorships_from_topics
    assert_equal [monitorships(:aaron_pdi), monitorships(:sam_pdi)], topics(:pdi).monitorships
  end
  
  def test_should_find_active_watchers
    assert_equal [users(:aaron)], topics(:pdi).monitors
  end

  def test_should_find_monitored_topics_for_user
    assert_equal [topics(:pdi)], users(:aaron).monitored_topics
  end
  
  def test_should_not_find_inactive_monitored_topics
    assert_equal [], users(:sam).monitored_topics
  end
  
  def test_should_not_find_any_monitored_topics
    assert_equal [], users(:joe).monitored_topics
  end
  
  def test_should_be_deleted_when_user_destroyed
    m = monitorships(:aaron_pdi)
    id = m.id
    m.user.destroy
    assert !Monitorship.exists?(id)
  end  
  
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
community_engine-3.2.0 test/unit/monitorships_test.rb
community_engine-3.0.0 test/unit/monitorships_test.rb
community_engine-2.3.2 test/unit/monitorships_test.rb
community_engine-2.3.1 test/unit/monitorships_test.rb
community_engine-2.3.0 test/unit/monitorships_test.rb
community_engine-2.1.0 test/unit/monitorships_test.rb
community_engine-2.0.0 test/unit/monitorships_test.rb
community_engine-2.0.0.beta3 test/unit/monitorships_test.rb
community_engine-2.0.0.beta2 test/unit/monitorships_test.rb
community_engine-2.0.0.beta1 test/unit/monitorships_test.rb