diff --git a/spec/models/merge_request_spec.rb b/spec/models/merge_request_spec.rb index cb260fc5fb11ac14a4916fdc0c762ec33397f579..e6868779f428eff715dc3ca4fd91a94ca9af2bcc 100644 --- a/spec/models/merge_request_spec.rb +++ b/spec/models/merge_request_spec.rb @@ -1,5 +1,28 @@ require 'spec_helper' describe MergeRequest do - pending "add some examples to (or delete) #{__FILE__}" + describe "Associations" do + it { should belong_to(:project) } + it { should belong_to(:author) } + it { should belong_to(:assignee) } + end + + describe "Validation" do + it { should validate_presence_of(:target_branch) } + it { should validate_presence_of(:source_branch) } + it { should validate_presence_of(:title) } + it { should validate_presence_of(:author_id) } + it { should validate_presence_of(:project_id) } + it { should validate_presence_of(:assignee_id) } + end + + describe "Scope" do + it { MergeRequest.should respond_to :closed } + it { MergeRequest.should respond_to :opened } + end + + it { Factory.create(:merge_request, + :author => Factory(:user), + :assignee => Factory(:user), + :project => Factory.create(:project)).should be_valid } end