Skip to content

IUS-2613 DataCORE - unit tests for monkeypatch files #162

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
require 'rails_helper'

class EscapeMock
include ::Extensions::Hydra::AccessControls::Permission::EscapingObsoletions

end

describe Extensions::Hydra::AccessControls::Permission::EscapingObsoletions do

subject { EscapeMock.new }

pending "#agent_name"

describe "#build_agent_resource" do
before {
allow(::CGI).to receive(:escape).with("name").and_return " de plume"
allow(::RDF::URI).to receive(:new).with("nom# de plume").and_return "alias"
allow(::Hydra::AccessControls::Agent).to receive(:new).with("alias")
}
it "calls Agent.new" do
expect(::Hydra::AccessControls::Agent).to receive(:new).with("alias")
subject.build_agent_resource "nom", "name"
end
end

end
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
require 'rails_helper'

class BookmarkMock
include ::Extensions::Hyrax::CollectionsController::RenderBookmarksControl

def render_bookmarks_control_check?
render_bookmarks_control?
end
end


describe Extensions::Hyrax::CollectionsController::RenderBookmarksControl do

subject { BookmarkMock.new }

describe "#render_bookmarks_control?" do
it "returns false" do
expect(BookmarkMock.new.render_bookmarks_control_check?).to eq false
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
require 'rails_helper'

class SearchMock
include ::Extensions::Qa::Authorities::Collections::CollectionsSearch

end



describe Extensions::Qa::Authorities::Collections::CollectionsSearch do

subject { SearchMock.new }

describe "#search" do
context "when controller.current_user has no value" do
it "returns empty array" do
expect(subject.search "q", OpenStruct.new(current_user: nil)).to be_empty
end
end

context "when controller.current_user has a value" do

it "returns mapped documents" do
skip "Add a test"
end
end
end
end