summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--db/migrate/20130217094251_remove_issues_default_fk_values.rb19
-rw-r--r--test/unit/issue_test.rb13
2 files changed, 32 insertions, 0 deletions
diff --git a/db/migrate/20130217094251_remove_issues_default_fk_values.rb b/db/migrate/20130217094251_remove_issues_default_fk_values.rb
new file mode 100644
index 000000000..9345cf0b8
--- /dev/null
+++ b/db/migrate/20130217094251_remove_issues_default_fk_values.rb
@@ -0,0 +1,19 @@
+class RemoveIssuesDefaultFkValues < ActiveRecord::Migration
+ def up
+ change_column_default :issues, :tracker_id, nil
+ change_column_default :issues, :project_id, nil
+ change_column_default :issues, :status_id, nil
+ change_column_default :issues, :assigned_to_id, nil
+ change_column_default :issues, :priority_id, nil
+ change_column_default :issues, :author_id, nil
+ end
+
+ def down
+ change_column_default :issues, :tracker_id, 0
+ change_column_default :issues, :project_id, 0
+ change_column_default :issues, :status_id, 0
+ change_column_default :issues, :assigned_to_id, 0
+ change_column_default :issues, :priority_id, 0
+ change_column_default :issues, :author_id, 0
+ end
+end
diff --git a/test/unit/issue_test.rb b/test/unit/issue_test.rb
index 8e3f8bfba..8f77140d3 100644
--- a/test/unit/issue_test.rb
+++ b/test/unit/issue_test.rb
@@ -35,6 +35,19 @@ class IssueTest < ActiveSupport::TestCase
User.current = nil
end
+ def test_initialize
+ issue = Issue.new
+
+ assert_nil issue.project_id
+ assert_nil issue.tracker_id
+ assert_nil issue.author_id
+ assert_nil issue.assigned_to_id
+ assert_nil issue.category_id
+
+ assert_equal IssueStatus.default, issue.status
+ assert_equal IssuePriority.default, issue.priority
+ end
+
def test_create
issue = Issue.new(:project_id => 1, :tracker_id => 1, :author_id => 3,
:status_id => 1, :priority => IssuePriority.all.first,