User.current = nil
@project = Project.find(PRJ_ID)
- @repository = Repository::Cvs.create(:project => Project.find(PRJ_ID),
- :root_url => REPOSITORY_PATH,
- :url => MODULE_NAME,
+ @repository = Repository::Cvs.create(:project => Project.find(PRJ_ID),
+ :root_url => REPOSITORY_PATH,
+ :url => MODULE_NAME,
:log_encoding => 'UTF-8')
assert @repository
end
-
+
if File.directory?(REPOSITORY_PATH)
def test_show
@repository.fetch_changesets
assert_not_nil assigns(:entries)
assert_not_nil assigns(:changesets)
end
-
+
def test_browse_root
@repository.fetch_changesets
@repository.reload
assert_template 'show'
assert_not_nil assigns(:entries)
assert_equal 3, assigns(:entries).size
-
+
entry = assigns(:entries).detect {|e| e.name == 'images'}
assert_equal 'dir', entry.kind
entry = assigns(:entries).detect {|e| e.name == 'README'}
assert_equal 'file', entry.kind
end
-
+
def test_browse_directory
@repository.fetch_changesets
@repository.reload
assert_equal 'file', entry.kind
assert_equal 'images/edit.png', entry.path
end
-
+
def test_browse_at_given_revision
@repository.fetch_changesets
@repository.reload
assert_not_nil assigns(:entries)
assert_equal ['delete.png', 'edit.png'], assigns(:entries).collect(&:name)
end
-
+
def test_entry
@repository.fetch_changesets
@repository.reload
assert_no_tag :tag => 'td', :attributes => { :class => /line-code/},
:content => /before_filter/
end
-
+
def test_entry_at_given_revision
# changesets must be loaded
@repository.fetch_changesets
assert_tag :tag => 'td', :attributes => { :class => /line-code/},
:content => /before_filter/
end
-
+
def test_entry_not_found
@repository.fetch_changesets
@repository.reload
assert_tag :tag => 'p', :attributes => { :id => /errorExplanation/ },
:content => /The entry or revision was not found in the repository/
end
-
+
def test_entry_download
@repository.fetch_changesets
@repository.reload
assert_not_nil assigns(:entry)
assert_equal 'sources', assigns(:entry).name
end
-
+
def test_diff
@repository.fetch_changesets
@repository.reload
assert_tag :tag => 'td', :attributes => { :class => 'line-code diff_in' },
:content => /watched.remove_all_watcher/
end
-
+
def test_diff_new_files
@repository.fetch_changesets
@repository.reload
assert_tag :tag => 'th', :attributes => { :class => 'filename' },
:content => /test\/images\/edit.png/
assert_tag :tag => 'th', :attributes => { :class => 'filename' },
- :content => /test\/sources\/watchers_controller.rb/
+ :content => /test\/sources\/watchers_controller.rb/
end
def test_annotate