-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #128 from datacite/feature_remove_providerid
Feature remove provider_id references
- Loading branch information
Showing
15 changed files
with
122 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
class RemoveProviderIdFromReports < ActiveRecord::Migration[5.2] | ||
def change | ||
remove_column :reports, :provider_id, :string | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
class ChangeClientIdFromReports < ActiveRecord::Migration[5.2] | ||
def change | ||
rename_column :reports, :client_id, :user_id | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
require "rails_helper" | ||
require "cancan/matchers" | ||
|
||
describe User, type: :model do | ||
let(:token) { User.generate_token } | ||
let(:user) { User.new(token) } | ||
let(:report) { create(:report, user_id: "datacite.datacite") } | ||
let(:report_subset) { create(:report_subset, report_id: report.uid) } | ||
|
||
let(:report_cdl) { create(:report, user_id: "cdl.dash") } | ||
let(:report_subset_cdl) { create(:report_subset, report_id: report_cdl.uid) } | ||
|
||
describe "User attributes", order: :defined do | ||
it "is valid with valid attributes" do | ||
expect(user.name).to eq("staff") | ||
end | ||
end | ||
|
||
describe "abilities", vcr: true do | ||
subject { Ability.new(user) } | ||
|
||
context "when is a staff_admin" do | ||
let(:token){ User.generate_token(role_id: "staff_admin") } | ||
|
||
it { is_expected.to be_able_to(:read, user) } | ||
it { is_expected.to be_able_to(:read, report) } | ||
it { is_expected.to be_able_to(:create, report) } | ||
it { is_expected.to be_able_to(:update, report) } | ||
it { is_expected.to be_able_to(:destroy, report) } | ||
end | ||
|
||
context "when is a client admin" do | ||
let(:token){ User.generate_token(role_id: "client_admin", uid: "datacite.datacite") } | ||
|
||
it { is_expected.not_to be_able_to(:read, user) } | ||
|
||
it { is_expected.to be_able_to(:read, report) } | ||
it { is_expected.to be_able_to(:create, report) } | ||
it { is_expected.to be_able_to(:update, report) } | ||
it { is_expected.not_to be_able_to(:destroy, report) } | ||
|
||
it { is_expected.not_to be_able_to(:read, report_cdl) } | ||
it { is_expected.not_to be_able_to(:create, report_cdl) } | ||
it { is_expected.not_to be_able_to(:update, report_cdl) } | ||
it { is_expected.not_to be_able_to(:destroy, report_cdl) } | ||
|
||
# it { is_expected.to be_able_to(:read, report_subset) } | ||
# it { is_expected.to be_able_to(:create, report_subset) } | ||
# it { is_expected.to be_able_to(:update, report_subset) } | ||
# it { is_expected.not_to be_able_to(:destroy, report_subset) } | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters