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,14 +29,17 @@ FactoryGirl.define do | ||
29 | owner | 29 | owner |
30 | end | 30 | end |
31 | 31 | ||
32 | - factory :namespace do | 32 | + factory :group do |
33 | sequence(:name) { |n| "group#{n}" } | 33 | sequence(:name) { |n| "group#{n}" } |
34 | path { name.downcase.gsub(/\s/, '_') } | 34 | path { name.downcase.gsub(/\s/, '_') } |
35 | owner | 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 | end | 43 | end |
41 | 44 | ||
42 | factory :users_project do | 45 | factory :users_project do |
spec/models/group_spec.rb
@@ -18,7 +18,7 @@ describe Group do | @@ -18,7 +18,7 @@ describe Group do | ||
18 | it { should have_many :projects } | 18 | it { should have_many :projects } |
19 | it { should validate_presence_of :name } | 19 | it { should validate_presence_of :name } |
20 | it { should validate_uniqueness_of(:name) } | 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 | it { should validate_presence_of :owner } | 23 | it { should validate_presence_of :owner } |
24 | end | 24 | end |
spec/models/namespace_spec.rb
@@ -6,7 +6,7 @@ describe Namespace do | @@ -6,7 +6,7 @@ describe Namespace do | ||
6 | it { should have_many :projects } | 6 | it { should have_many :projects } |
7 | it { should validate_presence_of :name } | 7 | it { should validate_presence_of :name } |
8 | it { should validate_uniqueness_of(:name) } | 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 | it { should validate_presence_of :owner } | 11 | it { should validate_presence_of :owner } |
12 | end | 12 | end |
spec/models/project_spec.rb
@@ -59,9 +59,6 @@ describe Project do | @@ -59,9 +59,6 @@ describe Project do | ||
59 | 59 | ||
60 | it { should ensure_length_of(:description).is_within(0..2000) } | 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 | # TODO: Formats | 62 | # TODO: Formats |
66 | 63 | ||
67 | it { should validate_presence_of(:owner) } | 64 | it { should validate_presence_of(:owner) } |
@@ -152,7 +149,7 @@ describe Project do | @@ -152,7 +149,7 @@ describe Project do | ||
152 | end | 149 | end |
153 | 150 | ||
154 | it "returns the full web URL for this repo" do | 151 | it "returns the full web URL for this repo" do |
155 | - project = Project.new(code: "somewhere") | 152 | + project = Project.new(path: "somewhere") |
156 | project.web_url.should == "#{Gitlab.config.url}/somewhere" | 153 | project.web_url.should == "#{Gitlab.config.url}/somewhere" |
157 | end | 154 | end |
158 | 155 | ||
@@ -163,7 +160,7 @@ describe Project do | @@ -163,7 +160,7 @@ describe Project do | ||
163 | end | 160 | end |
164 | 161 | ||
165 | it "should be invalid repo" do | 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 | project.valid_repo?.should be_false | 164 | project.valid_repo?.should be_false |
168 | end | 165 | end |
169 | end | 166 | end |