To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.

Statistics Download as Zip
| Branch: | Tag: | Revision:

root / test / functional / .svn / text-base / auto_completes_controller_test.rb.svn-base @ 442:753f1380d6bc

History | View | Annotate | Download (1.19 KB)

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

    
3
class AutoCompletesControllerTest < ActionController::TestCase
4
  fixtures :all
5

    
6
  def test_issues_should_not_be_case_sensitive
7
    get :issues, :project_id => 'ecookbook', :q => 'ReCiPe'
8
    assert_response :success
9
    assert_not_nil assigns(:issues)
10
    assert assigns(:issues).detect {|issue| issue.subject.match /recipe/}
11
  end
12
  
13
  def test_issues_should_return_issue_with_given_id
14
    get :issues, :project_id => 'subproject1', :q => '13'
15
    assert_response :success
16
    assert_not_nil assigns(:issues)
17
    assert assigns(:issues).include?(Issue.find(13))
18
  end
19
  
20
  def test_auto_complete_with_scope_all_and_cross_project_relations
21
    Setting.cross_project_issue_relations = '1'
22
    get :issues, :project_id => 'ecookbook', :q => '13', :scope => 'all'
23
    assert_response :success
24
    assert_not_nil assigns(:issues)
25
    assert assigns(:issues).include?(Issue.find(13))
26
  end
27
     
28
  def test_auto_complete_with_scope_all_without_cross_project_relations
29
    Setting.cross_project_issue_relations = '0'
30
    get :issues, :project_id => 'ecookbook', :q => '13', :scope => 'all'
31
    assert_response :success
32
    assert_equal [], assigns(:issues)
33
  end
34
end