Continue refactoring. Use repostory and team

This commit is contained in:
Dmitriy Zaporozhets 2013-01-04 08:43:25 +02:00
parent 39ba934c0a
commit dccd8b6eaa
42 changed files with 219 additions and 179 deletions

View file

@ -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?) }

View file

@ -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

View file

@ -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

12
spec/models/team_spec.rb Normal file
View file

@ -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

View file

@ -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