Commit e92b563a authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Fix model tests

parent 9304d049
...@@ -29,14 +29,17 @@ FactoryGirl.define do ...@@ -29,14 +29,17 @@ FactoryGirl.define do
owner owner
end end
factory :namespace do factory :group do
sequence(:name) { |n| "group#{n}" } sequence(:name) { |n| "group#{n}" }
path { name.downcase.gsub(/\s/, '_') } path { name.downcase.gsub(/\s/, '_') }
owner owner
type 'Group'
end
factory :group do factory :namespace do
type 'Group' sequence(:name) { |n| "group#{n}" }
end path { name.downcase.gsub(/\s/, '_') }
owner
end end
factory :users_project do factory :users_project do
......
...@@ -18,7 +18,7 @@ describe Group do ...@@ -18,7 +18,7 @@ describe Group do
it { should have_many :projects } it { should have_many :projects }
it { should validate_presence_of :name } it { should validate_presence_of :name }
it { should validate_uniqueness_of(:name) } it { should validate_uniqueness_of(:name) }
it { should validate_presence_of :code } it { should validate_presence_of :path }
it { should validate_uniqueness_of(:code) } it { should validate_uniqueness_of(:path) }
it { should validate_presence_of :owner } it { should validate_presence_of :owner }
end end
...@@ -6,7 +6,7 @@ describe Namespace do ...@@ -6,7 +6,7 @@ describe Namespace do
it { should have_many :projects } it { should have_many :projects }
it { should validate_presence_of :name } it { should validate_presence_of :name }
it { should validate_uniqueness_of(:name) } it { should validate_uniqueness_of(:name) }
it { should validate_presence_of :code } it { should validate_presence_of :path }
it { should validate_uniqueness_of(:code) } it { should validate_uniqueness_of(:path) }
it { should validate_presence_of :owner } it { should validate_presence_of :owner }
end end
...@@ -59,9 +59,6 @@ describe Project do ...@@ -59,9 +59,6 @@ describe Project do
it { should ensure_length_of(:description).is_within(0..2000) } it { should ensure_length_of(:description).is_within(0..2000) }
it { should validate_presence_of(:code) }
it { should validate_uniqueness_of(:code) }
it { should ensure_length_of(:code).is_within(1..255) }
# TODO: Formats # TODO: Formats
it { should validate_presence_of(:owner) } it { should validate_presence_of(:owner) }
...@@ -152,7 +149,7 @@ describe Project do ...@@ -152,7 +149,7 @@ describe Project do
end end
it "returns the full web URL for this repo" do it "returns the full web URL for this repo" do
project = Project.new(code: "somewhere") project = Project.new(path: "somewhere")
project.web_url.should == "#{Gitlab.config.url}/somewhere" project.web_url.should == "#{Gitlab.config.url}/somewhere"
end end
...@@ -163,7 +160,7 @@ describe Project do ...@@ -163,7 +160,7 @@ describe Project do
end end
it "should be invalid repo" do it "should be invalid repo" do
project = Project.new(name: "ok_name", path: "/INVALID_PATH/", code: "NEOK") project = Project.new(name: "ok_name", path: "/INVALID_PATH/", path: "NEOK")
project.valid_repo?.should be_false project.valid_repo?.should be_false
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment