Commit e92b563a authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Fix model tests

parent 9304d049
......@@ -29,14 +29,17 @@ FactoryGirl.define do
owner
end
factory :namespace do
factory :group do
sequence(:name) { |n| "group#{n}" }
path { name.downcase.gsub(/\s/, '_') }
owner
type 'Group'
end
factory :group do
type 'Group'
end
factory :namespace do
sequence(:name) { |n| "group#{n}" }
path { name.downcase.gsub(/\s/, '_') }
owner
end
factory :users_project do
......
......@@ -18,7 +18,7 @@ describe Group do
it { should have_many :projects }
it { should validate_presence_of :name }
it { should validate_uniqueness_of(:name) }
it { should validate_presence_of :code }
it { should validate_uniqueness_of(:code) }
it { should validate_presence_of :path }
it { should validate_uniqueness_of(:path) }
it { should validate_presence_of :owner }
end
......@@ -6,7 +6,7 @@ describe Namespace do
it { should have_many :projects }
it { should validate_presence_of :name }
it { should validate_uniqueness_of(:name) }
it { should validate_presence_of :code }
it { should validate_uniqueness_of(:code) }
it { should validate_presence_of :path }
it { should validate_uniqueness_of(:path) }
it { should validate_presence_of :owner }
end
......@@ -59,9 +59,6 @@ describe Project do
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
it { should validate_presence_of(:owner) }
......@@ -152,7 +149,7 @@ describe Project do
end
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"
end
......@@ -163,7 +160,7 @@ describe Project do
end
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
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