Commit e92b563acf93a1d123ae9f3b599f7d4b1ba56f8e
1 parent
9304d049
Exists in
master
and in
4 other branches
Fix model tests
Showing
4 changed files
with
13 additions
and
13 deletions
Show diff stats
spec/factories.rb
... | ... | @@ -29,14 +29,17 @@ FactoryGirl.define do |
29 | 29 | owner |
30 | 30 | end |
31 | 31 | |
32 | - factory :namespace do | |
32 | + factory :group do | |
33 | 33 | sequence(:name) { |n| "group#{n}" } |
34 | 34 | path { name.downcase.gsub(/\s/, '_') } |
35 | 35 | owner |
36 | + type 'Group' | |
37 | + end | |
36 | 38 | |
37 | - factory :group do | |
38 | - type 'Group' | |
39 | - end | |
39 | + factory :namespace do | |
40 | + sequence(:name) { |n| "group#{n}" } | |
41 | + path { name.downcase.gsub(/\s/, '_') } | |
42 | + owner | |
40 | 43 | end |
41 | 44 | |
42 | 45 | factory :users_project do | ... | ... |
spec/models/group_spec.rb
... | ... | @@ -18,7 +18,7 @@ describe Group do |
18 | 18 | it { should have_many :projects } |
19 | 19 | it { should validate_presence_of :name } |
20 | 20 | it { should validate_uniqueness_of(:name) } |
21 | - it { should validate_presence_of :code } | |
22 | - it { should validate_uniqueness_of(:code) } | |
21 | + it { should validate_presence_of :path } | |
22 | + it { should validate_uniqueness_of(:path) } | |
23 | 23 | it { should validate_presence_of :owner } |
24 | 24 | end | ... | ... |
spec/models/namespace_spec.rb
... | ... | @@ -6,7 +6,7 @@ describe Namespace do |
6 | 6 | it { should have_many :projects } |
7 | 7 | it { should validate_presence_of :name } |
8 | 8 | it { should validate_uniqueness_of(:name) } |
9 | - it { should validate_presence_of :code } | |
10 | - it { should validate_uniqueness_of(:code) } | |
9 | + it { should validate_presence_of :path } | |
10 | + it { should validate_uniqueness_of(:path) } | |
11 | 11 | it { should validate_presence_of :owner } |
12 | 12 | end | ... | ... |
spec/models/project_spec.rb
... | ... | @@ -59,9 +59,6 @@ describe Project do |
59 | 59 | |
60 | 60 | it { should ensure_length_of(:description).is_within(0..2000) } |
61 | 61 | |
62 | - it { should validate_presence_of(:code) } | |
63 | - it { should validate_uniqueness_of(:code) } | |
64 | - it { should ensure_length_of(:code).is_within(1..255) } | |
65 | 62 | # TODO: Formats |
66 | 63 | |
67 | 64 | it { should validate_presence_of(:owner) } |
... | ... | @@ -152,7 +149,7 @@ describe Project do |
152 | 149 | end |
153 | 150 | |
154 | 151 | it "returns the full web URL for this repo" do |
155 | - project = Project.new(code: "somewhere") | |
152 | + project = Project.new(path: "somewhere") | |
156 | 153 | project.web_url.should == "#{Gitlab.config.url}/somewhere" |
157 | 154 | end |
158 | 155 | |
... | ... | @@ -163,7 +160,7 @@ describe Project do |
163 | 160 | end |
164 | 161 | |
165 | 162 | it "should be invalid repo" do |
166 | - project = Project.new(name: "ok_name", path: "/INVALID_PATH/", code: "NEOK") | |
163 | + project = Project.new(name: "ok_name", path: "/INVALID_PATH/", path: "NEOK") | |
167 | 164 | project.valid_repo?.should be_false |
168 | 165 | end |
169 | 166 | end | ... | ... |