diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-09-15 10:57:02 +0300 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-09-15 10:57:02 +0300 |
commit | bdbadebe3e6e25180d8c1465dde4573fa0ecc389 (patch) | |
tree | 64530175e13127cbc68cc9d6c24adfb6c7e56912 /spec | |
parent | 1aa48174db63871bb10b53e49c86222a4d9b7c6d (diff) | |
download | gitlab-ce-bdbadebe3e6e25180d8c1465dde4573fa0ecc389.tar.gz |
Fix adminarea and emails for new membership logic
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'spec')
-rw-r--r-- | spec/factories.rb | 4 | ||||
-rw-r--r-- | spec/factories/users_groups.rb | 4 | ||||
-rw-r--r-- | spec/mailers/notify_spec.rb | 6 | ||||
-rw-r--r-- | spec/requests/api/branches_spec.rb | 4 | ||||
-rw-r--r-- | spec/requests/api/commits_spec.rb | 4 | ||||
-rw-r--r-- | spec/requests/api/project_members_spec.rb | 16 | ||||
-rw-r--r-- | spec/requests/api/projects_spec.rb | 8 | ||||
-rw-r--r-- | spec/requests/api/repositories_spec.rb | 4 | ||||
-rw-r--r-- | spec/services/system_hooks_service_spec.rb | 10 |
9 files changed, 30 insertions, 30 deletions
diff --git a/spec/factories.rb b/spec/factories.rb index 0bf56fe84d6..a960571206c 100644 --- a/spec/factories.rb +++ b/spec/factories.rb @@ -39,10 +39,10 @@ FactoryGirl.define do owner end - factory :users_project do + factory :project_member do user project - project_access { ProjectMember::MASTER } + access_level { ProjectMember::MASTER } end factory :issue do diff --git a/spec/factories/users_groups.rb b/spec/factories/users_groups.rb index 450a0d88b76..debb86d997f 100644 --- a/spec/factories/users_groups.rb +++ b/spec/factories/users_groups.rb @@ -12,8 +12,8 @@ # FactoryGirl.define do - factory :users_group do - group_access { GroupMember::OWNER } + factory :group_member do + access_level { GroupMember::OWNER } group user end diff --git a/spec/mailers/notify_spec.rb b/spec/mailers/notify_spec.rb index 702431e0712..4b64cefa852 100644 --- a/spec/mailers/notify_spec.rb +++ b/spec/mailers/notify_spec.rb @@ -402,10 +402,10 @@ describe Notify do describe 'project access changed' do let(:project) { create(:project) } let(:user) { create(:user) } - let(:users_project) { create(:users_project, + let(:project_member) { create(:project_member, project: project, user: user) } - subject { Notify.project_access_granted_email(users_project.id) } + subject { Notify.project_access_granted_email(project_member.id) } it_behaves_like 'an email sent from GitLab' @@ -416,7 +416,7 @@ describe Notify do should have_body_text /#{project.name}/ end it 'contains new user role' do - should have_body_text /#{users_project.human_access}/ + should have_body_text /#{project_member.human_access}/ end end diff --git a/spec/requests/api/branches_spec.rb b/spec/requests/api/branches_spec.rb index 1690146aea7..5f6258488a4 100644 --- a/spec/requests/api/branches_spec.rb +++ b/spec/requests/api/branches_spec.rb @@ -7,8 +7,8 @@ describe API::API, api: true do let(:user) { create(:user) } let(:user2) { create(:user) } let!(:project) { create(:project, creator_id: user.id) } - let!(:master) { create(:users_project, user: user, project: project, project_access: ProjectMember::MASTER) } - let!(:guest) { create(:users_project, user: user2, project: project, project_access: ProjectMember::GUEST) } + let!(:master) { create(:project_member, user: user, project: project, project_access: ProjectMember::MASTER) } + let!(:guest) { create(:project_member, user: user2, project: project, project_access: ProjectMember::GUEST) } let!(:branch_name) { 'feature' } let!(:branch_sha) { '0b4bc9a49b562e85de7cc9e834518ea6828729b9' } diff --git a/spec/requests/api/commits_spec.rb b/spec/requests/api/commits_spec.rb index 21c0329e60f..3a5a2efdb0f 100644 --- a/spec/requests/api/commits_spec.rb +++ b/spec/requests/api/commits_spec.rb @@ -6,8 +6,8 @@ describe API::API, api: true do let(:user) { create(:user) } let(:user2) { create(:user) } let!(:project) { create(:project, creator_id: user.id) } - let!(:master) { create(:users_project, user: user, project: project, project_access: ProjectMember::MASTER) } - let!(:guest) { create(:users_project, user: user2, project: project, project_access: ProjectMember::GUEST) } + let!(:master) { create(:project_member, user: user, project: project, project_access: ProjectMember::MASTER) } + let!(:guest) { create(:project_member, user: user2, project: project, project_access: ProjectMember::GUEST) } before { project.team << [user, :reporter] } diff --git a/spec/requests/api/project_members_spec.rb b/spec/requests/api/project_members_spec.rb index e101f871ff0..626da6196d5 100644 --- a/spec/requests/api/project_members_spec.rb +++ b/spec/requests/api/project_members_spec.rb @@ -6,12 +6,12 @@ describe API::API, api: true do let(:user2) { create(:user) } let(:user3) { create(:user) } let(:project) { create(:project, creator_id: user.id, namespace: user.namespace) } - let(:users_project) { create(:users_project, user: user, project: project, project_access: ProjectMember::MASTER) } - let(:users_project2) { create(:users_project, user: user3, project: project, project_access: ProjectMember::DEVELOPER) } + let(:project_member) { create(:project_member, user: user, project: project, project_access: ProjectMember::MASTER) } + let(:project_member2) { create(:project_member, user: user3, project: project, project_access: ProjectMember::DEVELOPER) } describe "GET /projects/:id/members" do - before { users_project } - before { users_project2 } + before { project_member } + before { project_member2 } it "should return project team members" do get api("/projects/#{project.id}/members", user) @@ -36,7 +36,7 @@ describe API::API, api: true do end describe "GET /projects/:id/members/:user_id" do - before { users_project } + before { project_member } it "should return project team member" do get api("/projects/#{project.id}/members/#{user.id}", user) @@ -93,7 +93,7 @@ describe API::API, api: true do end describe "PUT /projects/:id/members/:user_id" do - before { users_project2 } + before { project_member2 } it "should update project team member" do put api("/projects/#{project.id}/members/#{user3.id}", user), access_level: ProjectMember::MASTER @@ -119,8 +119,8 @@ describe API::API, api: true do end describe "DELETE /projects/:id/members/:user_id" do - before { users_project } - before { users_project2 } + before { project_member } + before { project_member2 } it "should remove user from project team" do expect { diff --git a/spec/requests/api/projects_spec.rb b/spec/requests/api/projects_spec.rb index 7d36043e3d8..59a20c37489 100644 --- a/spec/requests/api/projects_spec.rb +++ b/spec/requests/api/projects_spec.rb @@ -8,8 +8,8 @@ describe API::API, api: true do let(:admin) { create(:admin) } let(:project) { create(:project, creator_id: user.id, namespace: user.namespace) } let(:snippet) { create(:project_snippet, author: user, project: project, title: 'example') } - let(:users_project) { create(:users_project, user: user, project: project, project_access: ProjectMember::MASTER) } - let(:users_project2) { create(:users_project, user: user3, project: project, project_access: ProjectMember::DEVELOPER) } + let(:project_member) { create(:project_member, user: user, project: project, project_access: ProjectMember::MASTER) } + let(:project_member2) { create(:project_member, user: user3, project: project, project_access: ProjectMember::DEVELOPER) } describe "GET /projects" do before { project } @@ -254,7 +254,7 @@ describe API::API, api: true do describe "GET /projects/:id" do before { project } - before { users_project } + before { project_member } it "should return a project by id" do get api("/projects/#{project.id}", user) @@ -305,7 +305,7 @@ describe API::API, api: true do end describe "GET /projects/:id/events" do - before { users_project } + before { project_member } it "should return a project events" do get api("/projects/#{project.id}/events", user) diff --git a/spec/requests/api/repositories_spec.rb b/spec/requests/api/repositories_spec.rb index ba404901a49..6618ce0e378 100644 --- a/spec/requests/api/repositories_spec.rb +++ b/spec/requests/api/repositories_spec.rb @@ -8,8 +8,8 @@ describe API::API, api: true do let(:user) { create(:user) } let(:user2) { create(:user) } let!(:project) { create(:project, creator_id: user.id) } - let!(:master) { create(:users_project, user: user, project: project, project_access: ProjectMember::MASTER) } - let!(:guest) { create(:users_project, user: user2, project: project, project_access: ProjectMember::GUEST) } + let!(:master) { create(:project_member, user: user, project: project, project_access: ProjectMember::MASTER) } + let!(:guest) { create(:project_member, user: user2, project: project, project_access: ProjectMember::GUEST) } before { project.team << [user, :reporter] } diff --git a/spec/services/system_hooks_service_spec.rb b/spec/services/system_hooks_service_spec.rb index 7497bdb0b3c..573446d3a19 100644 --- a/spec/services/system_hooks_service_spec.rb +++ b/spec/services/system_hooks_service_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' describe SystemHooksService do let (:user) { create :user } let (:project) { create :project } - let (:users_project) { create :users_project } + let (:project_member) { create :project_member } let (:key) { create(:key, user: user) } context 'event data' do @@ -11,8 +11,8 @@ describe SystemHooksService do it { event_data(user, :destroy).should include(:event_name, :name, :created_at, :email, :user_id) } it { event_data(project, :create).should include(:event_name, :name, :created_at, :path, :project_id, :owner_name, :owner_email, :project_visibility) } it { event_data(project, :destroy).should include(:event_name, :name, :created_at, :path, :project_id, :owner_name, :owner_email, :project_visibility) } - it { event_data(users_project, :create).should include(:event_name, :created_at, :project_name, :project_path, :project_id, :user_name, :user_email, :project_access, :project_visibility) } - it { event_data(users_project, :destroy).should include(:event_name, :created_at, :project_name, :project_path, :project_id, :user_name, :user_email, :project_access, :project_visibility) } + it { event_data(project_member, :create).should include(:event_name, :created_at, :project_name, :project_path, :project_id, :user_name, :user_email, :access_level, :project_visibility) } + it { event_data(project_member, :destroy).should include(:event_name, :created_at, :project_name, :project_path, :project_id, :user_name, :user_email, :access_level, :project_visibility) } it { event_data(key, :create).should include(:username, :key, :id) } it { event_data(key, :destroy).should include(:username, :key, :id) } end @@ -22,8 +22,8 @@ describe SystemHooksService do it { event_name(user, :destroy).should eq "user_destroy" } it { event_name(project, :create).should eq "project_create" } it { event_name(project, :destroy).should eq "project_destroy" } - it { event_name(users_project, :create).should eq "user_add_to_team" } - it { event_name(users_project, :destroy).should eq "user_remove_from_team" } + it { event_name(project_member, :create).should eq "user_add_to_team" } + it { event_name(project_member, :destroy).should eq "user_remove_from_team" } it { event_name(key, :create).should eq 'key_create' } it { event_name(key, :destroy).should eq 'key_destroy' } end |