Sha256: 2b7917dd970e070ae12153d112722681090977ec5457bd54b6e9d88153b45bfb

Contents?: true

Size: 781 Bytes

Versions: 11

Compression:

Stored size: 781 Bytes

Contents

require File.dirname(__FILE__) + '/test_helper'

class ViewedTest < ActiveSupport::TestCase
  
  def user
    user = users(:jonathan)
  end

  def issue
    issue = issues(:first_issue)
  end
    
  
  def test_zero_of_view_count
    assert_equal issue.view_count, 0
  end
    
  def test_can_view
    issue.view '127.0.0.1', user
    assert_equal issue.view_count, 1
  end

  def test_viewed_by
    assert !issue.viewed_by?('127.0.0.1', user)
    issue.view '127.0.0.1', user
    assert issue.viewed_by?('127.0.0.1', user)
  end

  def test_twice_view
    issue.view '127.0.0.1', user
    issue.view '127.0.0.1', user
    assert_equal issue.view_count, 1
  end
    
  def test_viewed?
    assert !issue.viewed?
    issue.view '127.0.0.1', user
    assert issue.viewed?
  end


end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
redmine_crm-0.0.21 test/viewed_test.rb
redmine_crm-0.0.20 test/viewed_test.rb
redmine_crm-0.0.19 test/viewed_test.rb
redmine_crm-0.0.18 test/viewed_test.rb
redmine_crm-0.0.17 test/viewed_test.rb
redmine_crm-0.0.16 test/viewed_test.rb
redmine_crm-0.0.14 test/viewed_test.rb
redmine_crm-0.0.13 test/viewed_test.rb
redmine_crm-0.0.12 test/viewed_test.rb
redmine_crm-0.0.11 test/viewed_test.rb
redmine_crm-0.0.10 test/viewed_test.rb