|
|
|
@ -19,22 +19,22 @@ class TimelogHelperTest < HelperTestCase |
|
|
|
|
include ActionView::Helpers::DateHelper |
|
|
|
|
|
|
|
|
|
def test_activities_collection_for_select_options_should_return_array_of_activity_names_and_ids |
|
|
|
|
design = FactoryGirl.create :activity, :name => "Design" |
|
|
|
|
development = FactoryGirl.create :activity, :name => "Development" |
|
|
|
|
design = TimeEntryActivity.find_by_name("Design") || FactoryGirl.create(:activity, :name => "Design") |
|
|
|
|
development = TimeEntryActivity.find_by_name("Development") || FactoryGirl.create(:activity, :name => "Development") |
|
|
|
|
activities = activity_collection_for_select_options |
|
|
|
|
assert activities.include?(["Design", design.id]) |
|
|
|
|
assert activities.include?(["Development", development.id]) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
def test_activities_collection_for_select_options_should_not_include_inactive_activities |
|
|
|
|
inactive = FactoryGirl.create :inactive_activity, :name => "Inactive Activity" |
|
|
|
|
inactive = TimeEntryActivity.find_by_name("Inactive Activity") || FactoryGirl.create(:inactive_activity, :name => "Inactive Activity") |
|
|
|
|
activities = activity_collection_for_select_options |
|
|
|
|
assert !activities.include?(["Inactive Activity", inactive.id]) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
def test_activities_collection_for_select_options_should_use_the_projects_override |
|
|
|
|
project = FactoryGirl.create :valid_project |
|
|
|
|
design = FactoryGirl.create :activity, :name => "Design" |
|
|
|
|
design = TimeEntryActivity.find_by_name("Design") || FactoryGirl.create(:activity, :name => "Design") |
|
|
|
|
override_activity = TimeEntryActivity.create!({:name => "Design override", :parent => TimeEntryActivity.find_by_name("Design"), :project => project}) |
|
|
|
|
|
|
|
|
|
activities = activity_collection_for_select_options(nil, project) |
|
|
|
|