summaryrefslogtreecommitdiff
path: root/spec/models
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-01-04 08:43:25 +0200
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-01-04 08:43:25 +0200
commitdccd8b6eaa8b2e98b0245262a8e39df8fb8ae634 (patch)
tree541a40fb2e84b24ab0c4ae39fa18b1b720e5d7c2 /spec/models
parent39ba934c0a65f571214998e056e925b61f389360 (diff)
downloadgitlab-ce-dccd8b6eaa8b2e98b0245262a8e39df8fb8ae634.tar.gz
Continue refactoring. Use repostory and team
Diffstat (limited to 'spec/models')
-rw-r--r--spec/models/project_spec.rb16
-rw-r--r--spec/models/repository_spec.rb14
-rw-r--r--spec/models/system_hook_spec.rb4
-rw-r--r--spec/models/team_spec.rb12
-rw-r--r--spec/models/users_project_spec.rb10
5 files changed, 33 insertions, 23 deletions
diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb
index e09797acddc..8016c67ced0 100644
--- a/spec/models/project_spec.rb
+++ b/spec/models/project_spec.rb
@@ -75,35 +75,19 @@ describe Project do
end
describe "Respond to" do
- it { should respond_to(:public?) }
- it { should respond_to(:private?) }
it { should respond_to(:url_to_repo) }
it { should respond_to(:path_to_repo) }
it { should respond_to(:valid_repo?) }
it { should respond_to(:repo_exists?) }
# Repository Role
- it { should respond_to(:tree) }
- it { should respond_to(:root_ref) }
- it { should respond_to(:repo) }
- it { should respond_to(:tags) }
- it { should respond_to(:commit) }
- it { should respond_to(:commits) }
- it { should respond_to(:commits_between) }
- it { should respond_to(:commits_with_refs) }
- it { should respond_to(:commits_since) }
- it { should respond_to(:commits_between) }
it { should respond_to(:satellite) }
it { should respond_to(:update_repository) }
it { should respond_to(:destroy_repository) }
it { should respond_to(:archive_repo) }
# Authority Role
- it { should respond_to(:add_access) }
it { should respond_to(:reset_access) }
- it { should respond_to(:repository_writers) }
- it { should respond_to(:repository_masters) }
- it { should respond_to(:repository_readers) }
it { should respond_to(:allow_read_for?) }
it { should respond_to(:guest_access_for?) }
it { should respond_to(:report_access_for?) }
diff --git a/spec/models/repository_spec.rb b/spec/models/repository_spec.rb
new file mode 100644
index 00000000000..160fed17ecc
--- /dev/null
+++ b/spec/models/repository_spec.rb
@@ -0,0 +1,14 @@
+describe Repository do
+ describe "Respond to" do
+ it { should respond_to(:repo) }
+ it { should respond_to(:tree) }
+ it { should respond_to(:root_ref) }
+ it { should respond_to(:tags) }
+ it { should respond_to(:commit) }
+ it { should respond_to(:commits) }
+ it { should respond_to(:commits_between) }
+ it { should respond_to(:commits_with_refs) }
+ it { should respond_to(:commits_since) }
+ it { should respond_to(:commits_between) }
+ end
+end
diff --git a/spec/models/system_hook_spec.rb b/spec/models/system_hook_spec.rb
index 7ae483a4003..cc358a2ed3b 100644
--- a/spec/models/system_hook_spec.rb
+++ b/spec/models/system_hook_spec.rb
@@ -56,7 +56,7 @@ describe SystemHook do
user = create(:user)
project = create(:project)
with_resque do
- project.add_access(user, :admin)
+ project.team << [user, :master]
end
WebMock.should have_requested(:post, @system_hook.url).with(body: /user_add_to_team/).once
end
@@ -64,7 +64,7 @@ describe SystemHook do
it "project_destroy hook" do
user = create(:user)
project = create(:project)
- project.add_access(user, :admin)
+ project.team << [user, :master]
with_resque do
project.users_projects.clear
end
diff --git a/spec/models/team_spec.rb b/spec/models/team_spec.rb
new file mode 100644
index 00000000000..1e3c7f07c0a
--- /dev/null
+++ b/spec/models/team_spec.rb
@@ -0,0 +1,12 @@
+describe Team do
+ describe "Respond to" do
+ it { should respond_to(:developers) }
+ it { should respond_to(:masters) }
+ it { should respond_to(:reporters) }
+ it { should respond_to(:guests) }
+ it { should respond_to(:repository_writers) }
+ it { should respond_to(:repository_masters) }
+ it { should respond_to(:repository_readers) }
+ end
+end
+
diff --git a/spec/models/users_project_spec.rb b/spec/models/users_project_spec.rb
index f85e21ff3f1..e8f5b647ce0 100644
--- a/spec/models/users_project_spec.rb
+++ b/spec/models/users_project_spec.rb
@@ -48,10 +48,10 @@ describe UsersProject do
@user_1 = create :user
@user_2 = create :user
- @project_1.add_access @user_1, :write
- @project_2.add_access @user_2, :read
+ @project_1.team << [ @user_1, :developer ]
+ @project_2.team << [ @user_2, :reporter ]
- @status = UsersProject.import_team(@project_1, @project_2)
+ @status = @project_2.team.import(@project_1)
end
it { @status.should be_true }
@@ -101,8 +101,8 @@ describe UsersProject do
@user_1 = create :user
@user_2 = create :user
- @project_1.add_access @user_1, :write
- @project_2.add_access @user_2, :read
+ @project_1.team << [ @user_1, :developer]
+ @project_2.team << [ @user_2, :reporter]
UsersProject.truncate_teams([@project_1.id, @project_2.id])
end