Commit 837685d56b4b94df7b2157f4cef8701d3de1059d
1 parent
bfb0bdbe
Exists in
master
and in
4 other branches
merge request model specs
Showing
1 changed file
with
24 additions
and
1 deletions
Show diff stats
spec/models/merge_request_spec.rb
1 | require 'spec_helper' | 1 | require 'spec_helper' |
2 | 2 | ||
3 | describe MergeRequest do | 3 | describe MergeRequest do |
4 | - pending "add some examples to (or delete) #{__FILE__}" | 4 | + describe "Associations" do |
5 | + it { should belong_to(:project) } | ||
6 | + it { should belong_to(:author) } | ||
7 | + it { should belong_to(:assignee) } | ||
8 | + end | ||
9 | + | ||
10 | + describe "Validation" do | ||
11 | + it { should validate_presence_of(:target_branch) } | ||
12 | + it { should validate_presence_of(:source_branch) } | ||
13 | + it { should validate_presence_of(:title) } | ||
14 | + it { should validate_presence_of(:author_id) } | ||
15 | + it { should validate_presence_of(:project_id) } | ||
16 | + it { should validate_presence_of(:assignee_id) } | ||
17 | + end | ||
18 | + | ||
19 | + describe "Scope" do | ||
20 | + it { MergeRequest.should respond_to :closed } | ||
21 | + it { MergeRequest.should respond_to :opened } | ||
22 | + end | ||
23 | + | ||
24 | + it { Factory.create(:merge_request, | ||
25 | + :author => Factory(:user), | ||
26 | + :assignee => Factory(:user), | ||
27 | + :project => Factory.create(:project)).should be_valid } | ||
5 | end | 28 | end |