Skip to content

Commit

Permalink
Don't put objects in the repository when they aren't required for the…
Browse files Browse the repository at this point in the history
… test
  • Loading branch information
jcoyne committed May 19, 2017
1 parent bd49d1f commit 245d8c9
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 19 deletions.
1 change: 1 addition & 0 deletions app/controllers/concerns/hyrax/my_controller_behavior.rb
Expand Up @@ -25,6 +25,7 @@ module MyControllerBehavior

def index
# The user's collections for the "add to collection" form
# TODO: could this be only on the My::WorksController?
@user_collections = collections_service.search_results(:edit)

@user = current_user
Expand Down
46 changes: 27 additions & 19 deletions spec/features/collection_spec.rb
Expand Up @@ -133,6 +133,33 @@
end
end

# TODO: this is just like the block above. Merge them.
describe 'show pages of a collection' do
before do
docs = (0..12).map do |n|
{ "has_model_ssim" => ["GenericWork"], :id => "zs25x871q#{n}",
"depositor_ssim" => [user.user_key],
"suppressed_bsi" => false,
"member_of_collection_ids_ssim" => [collection.id],
"edit_access_person_ssim" => [user.user_key] }
end
ActiveFedora::SolrService.add(docs, commit: true)

sign_in user
end
let(:collection) { create(:named_collection, user: user) }

it "shows a collection with a listing of Descriptive Metadata and catalog-style search results" do
visit '/dashboard/my/collections'
expect(page).to have_content(collection.title.first)
within('#document_' + collection.id) do
# Now go to the collection show page
click_link("Display all details of collection title")
end
expect(page).to have_css(".pager")
end
end

describe 'add works to collection' do
before do
collection1 # create collections by referencing them
Expand Down Expand Up @@ -229,23 +256,4 @@
expect(page).not_to have_content(work2.title.first)
end
end

describe 'show pages of a collection' do
before do
(0..12).map do
create(:work, member_of_collections: [collection], user: user)
end
sign_in user
end
let(:collection) { create(:named_collection, user: user) }

it "shows a collection with a listing of Descriptive Metadata and catalog-style search results" do
visit '/dashboard/my/collections'
expect(page).to have_content(collection.title.first)
within('#document_' + collection.id) do
click_link("Display all details of collection title")
end
expect(page).to have_css(".pager")
end
end
end

0 comments on commit 245d8c9

Please sign in to comment.