diff --git a/spec/helpers/projects_helper_spec.rb b/spec/helpers/projects_helper_spec.rb
new file mode 100644
index 0000000000..5875127256
--- /dev/null
+++ b/spec/helpers/projects_helper_spec.rb
@@ -0,0 +1,74 @@
+require 'spec_helper'
+
+describe ProjectsHelper do
+ include ApplicationHelper
+ include ProjectsHelper
+
+ before do
+ User.delete_all
+ Version.delete_all
+ Project.delete_all
+
+ set_language_if_valid('en')
+ User.current = nil
+ end
+
+ let(:test_project) { FactoryGirl.create :valid_project }
+
+ describe 'a version' do
+ let(:version) { FactoryGirl.create :version, :project => test_project }
+
+ it 'can be formatted' do
+ format_version_name(version).should == "#{test_project.name} - #{version.name}"
+ end
+
+ it 'can be formatted within a project' do
+ @project = test_project
+ format_version_name(version).should == version.name
+ end
+
+ it 'does not create a link, without permission' do
+ link_to_version(version).should == "#{test_project.name} - #{version.name}"
+ end
+
+ describe 'with a valid user' do
+ let(:user) { FactoryGirl.create :user, :member_in_project => test_project }
+ before { User.current = user}
+
+ it 'generates a link' do
+ link_to_version(version).should == "#{test_project.name} - #{version.name}"
+ end
+
+ it 'generates a link within a project' do
+ @project = test_project
+ link_to_version(version).should == "#{version.name}"
+ end
+ end
+
+ describe 'when generating options-tags' do
+ it 'generates nothing without a version' do
+ version_options_for_select([]).should be_empty
+ end
+
+ it 'generates an option tag' do
+ version_options_for_select([], version).should == ""
+ end
+ end
+ end
+
+ describe 'a system version' do
+ let(:version) { FactoryGirl.create :version, :project => test_project, :sharing => 'system' }
+
+ it 'can be formatted' do
+ format_version_name(version).should == "#{test_project.name} - #{version.name}"
+ end
+ end
+
+ describe 'an invalid version' do
+ let(:version) { Object }
+
+ it 'does not generate a link' do
+ link_to_version(Object).should be_empty
+ end
+ end
+end
diff --git a/test/unit/helpers/projects_helper_test.rb b/test/unit/helpers/projects_helper_test.rb
deleted file mode 100644
index 68c43b1d3b..0000000000
--- a/test/unit/helpers/projects_helper_test.rb
+++ /dev/null
@@ -1,66 +0,0 @@
-#-- encoding: UTF-8
-#-- copyright
-# ChiliProject is a project management system.
-#
-# Copyright (C) 2010-2011 the ChiliProject Team
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# See doc/COPYRIGHT.rdoc for more details.
-#++
-require File.expand_path('../../../test_helper', __FILE__)
-
-class ProjectsHelperTest < HelperTestCase
- include ApplicationHelper
- include ProjectsHelper
-
- def setup
- super
- set_language_if_valid('en')
- User.current = nil
- @test_project = FactoryGirl.create :valid_project
- @user = FactoryGirl.create :user, :member_in_project => @test_project
- @version = FactoryGirl.create :version, :project => @test_project
- end
-
- def test_link_to_version_within_project
- User.current = @user
- @project = @test_project
- assert_equal "#{@version.name}", link_to_version(@version)
- end
-
- def test_link_to_version
- User.current = @user
- assert_equal "#{@test_project.name} - #{@version.name}", link_to_version(@version)
- end
-
- def test_link_to_private_version
- assert_equal "#{@test_project.name} - #{@version.name}", link_to_version(@version)
- end
-
- def test_link_to_version_invalid_version
- assert_equal '', link_to_version(Object)
- end
-
- def test_format_version_name_within_project
- @project = @test_project
- assert_equal @version.name, format_version_name(@version)
- end
-
- def test_format_version_name
- assert_equal "#{@test_project.name} - #{@version.name}", format_version_name(@version)
- end
-
- def test_format_version_name_for_system_version
- version = FactoryGirl.create :version, :project => @test_project, :sharing => 'system'
- assert_equal "#{@test_project.name} - #{version.name}", format_version_name(version)
- end
-
- def test_version_options_for_select_with_no_versions
- assert_equal '', version_options_for_select([])
- assert_equal "", version_options_for_select([], @version)
- end
-end