OSDN Git Service

Make changes to tests
[wvm/gitlab.git] / spec / models / service_spec.rb
1 # == Schema Information
2 #
3 # Table name: services
4 #
5 #  id          :integer          not null, primary key
6 #  type        :string(255)
7 #  title       :string(255)
8 #  token       :string(255)
9 #  project_id  :integer          not null
10 #  created_at  :datetime         not null
11 #  updated_at  :datetime         not null
12 #  active      :boolean          default(FALSE), not null
13 #  project_url :string(255)
14 #  subdomain   :string(255)
15 #  room        :string(255)
16 #
17
18 require 'spec_helper'
19
20 describe Service do
21
22   describe "Associations" do
23     it { should belong_to :project }
24     it { should have_one :service_hook }
25   end
26
27   describe "Mass assignment" do
28     it { should_not allow_mass_assignment_of(:project_id) }
29   end
30
31   describe "Test Button" do
32     before do
33       @service = Service.new
34     end
35
36     describe "Testable" do
37       let (:project) { create :project }
38
39       before do
40         @service.stub(
41           project: project
42         )
43         @testable = @service.can_test?
44       end
45
46       describe :can_test do
47         it { @testable.should == false }
48       end
49     end
50
51     describe "With commits" do
52       let (:project) { create :project }
53
54       before do
55         @service.stub(
56           project: project
57         )
58         @testable = @service.can_test?
59       end
60
61       describe :can_test do
62         it { @testable.should == true }
63       end
64     end
65   end
66 end