post :create, :issue_id => 1,
:relation => {:issue_to_id => '2', :relation_type => 'relates', :delay => ''}
end
+ relation = IssueRelation.first(:order => 'id DESC')
+ assert_equal 1, relation.issue_from_id
+ assert_equal 2, relation.issue_to_id
+ assert_equal 'relates', relation.relation_type
end
def test_create_xhr
assert_select 'tr', 2 # relations
end
end
+ relation = IssueRelation.first(:order => 'id DESC')
+ assert_equal 3, relation.issue_from_id
+ assert_equal 1, relation.issue_to_id
end
def test_create_should_accept_id_with_hash
post :create, :issue_id => 1,
:relation => {:issue_to_id => '#2', :relation_type => 'relates', :delay => ''}
end
+ relation = IssueRelation.first(:order => 'id DESC')
+ assert_equal 2, relation.issue_to_id
+ end
+
+ def test_create_should_strip_id
+ assert_difference 'IssueRelation.count' do
+ @request.session[:user_id] = 3
+ post :create, :issue_id => 1,
+ :relation => {:issue_to_id => ' 2 ', :relation_type => 'relates', :delay => ''}
+ end
+ relation = IssueRelation.first(:order => 'id DESC')
+ assert_equal 2, relation.issue_to_id
end
def test_create_should_not_break_with_non_numerical_id