diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2012-11-23 22:53:24 +0400 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2012-11-23 22:53:24 +0400 |
commit | e92b563acf93a1d123ae9f3b599f7d4b1ba56f8e (patch) | |
tree | 7bfc93784a7eb5df53a047aa7fcfdf1cdb6f13aa /spec | |
parent | 9304d049de0493de457fdec02114d5a23d116f9b (diff) |
Fix model tests
Diffstat (limited to 'spec')
-rw-r--r-- | spec/factories.rb | 11 | ||||
-rw-r--r-- | spec/models/group_spec.rb | 4 | ||||
-rw-r--r-- | spec/models/namespace_spec.rb | 4 | ||||
-rw-r--r-- | spec/models/project_spec.rb | 7 |
4 files changed, 13 insertions, 13 deletions
diff --git a/spec/factories.rb b/spec/factories.rb index 9c6396018e2..7a496fcbe26 100644 --- a/spec/factories.rb +++ b/spec/factories.rb @@ -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 diff --git a/spec/models/group_spec.rb b/spec/models/group_spec.rb index 6ae2cb20169..3a748b88d18 100644 --- a/spec/models/group_spec.rb +++ b/spec/models/group_spec.rb @@ -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 diff --git a/spec/models/namespace_spec.rb b/spec/models/namespace_spec.rb index ce97d01a116..f481363f90d 100644 --- a/spec/models/namespace_spec.rb +++ b/spec/models/namespace_spec.rb @@ -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 diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb index dda9eefaa45..74c0aed6634 100644 --- a/spec/models/project_spec.rb +++ b/spec/models/project_spec.rb @@ -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 |