-
Notifications
You must be signed in to change notification settings - Fork 8
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 #835 from datacite/add_fields_to_pagination
Add fields to pagination
- Loading branch information
Showing
8 changed files
with
85 additions
and
0 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,25 @@ | ||
# frozen_string_literal: true | ||
|
||
require "rails_helper" | ||
|
||
describe "Dois", type: :controller do | ||
subject { DataciteDoisController.new } | ||
|
||
it "no params" do | ||
params = ActionController::Parameters.new | ||
expect(subject.fields_from_params(params)).to be_nil | ||
expect(subject.fields_hash_from_params(params)).to be_nil | ||
end | ||
|
||
it "single value" do | ||
params = ActionController::Parameters.new(fields: { dois: "id" }) | ||
expect(subject.fields_from_params(params)).to eq({ dois: ["id"] }.with_indifferent_access) | ||
expect(subject.fields_hash_from_params(params)).to eq({ dois: "id" }.with_indifferent_access) | ||
end | ||
|
||
it "multiple values" do | ||
params = ActionController::Parameters.new(fields: { dois: "id,subjects" }) | ||
expect(subject.fields_from_params(params)).to eq({ dois: ["id", "subjects"] }.with_indifferent_access) | ||
expect(subject.fields_hash_from_params(params)).to eq({ dois: "id,subjects" }.with_indifferent_access) | ||
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