@@ -57,6 +57,35 class RepositoriesGitControllerTest < ActionController::TestCase | |||||
57 | Setting.default_language = 'en' |
|
57 | Setting.default_language = 'en' | |
58 | end |
|
58 | end | |
59 |
|
59 | |||
|
60 | def test_create_and_update | |||
|
61 | @request.session[:user_id] = 1 | |||
|
62 | assert_difference 'Repository.count' do | |||
|
63 | post :create, :project_id => 'subproject1', | |||
|
64 | :repository_scm => 'Git', | |||
|
65 | :repository => { | |||
|
66 | :url => '/test', | |||
|
67 | :is_default => '0', | |||
|
68 | :identifier => 'test-create', | |||
|
69 | :extra_report_last_commit => '1', | |||
|
70 | } | |||
|
71 | end | |||
|
72 | assert_response 302 | |||
|
73 | repository = Repository.first(:order => 'id DESC') | |||
|
74 | assert_kind_of Repository::Git, repository | |||
|
75 | assert_equal '/test', repository.url | |||
|
76 | assert_equal true, repository.extra_report_last_commit | |||
|
77 | ||||
|
78 | put :update, :id => repository.id, | |||
|
79 | :repository => { | |||
|
80 | :extra_report_last_commit => '0', | |||
|
81 | :identifier => 'test-update', | |||
|
82 | } | |||
|
83 | assert_response 302 | |||
|
84 | repo2 = Repository.find(repository.id) | |||
|
85 | assert_equal 'test-update', repo2.identifier | |||
|
86 | assert_equal false, repo2.extra_report_last_commit | |||
|
87 | end | |||
|
88 | ||||
60 | if File.directory?(REPOSITORY_PATH) |
|
89 | if File.directory?(REPOSITORY_PATH) | |
61 | def test_get_new |
|
90 | def test_get_new | |
62 | @request.session[:user_id] = 1 |
|
91 | @request.session[:user_id] = 1 |
General Comments 0
You need to be logged in to leave comments.
Login now