Skip to content

Commit

Permalink
Cleanup view spec
Browse files Browse the repository at this point in the history
  • Loading branch information
jcoyne committed Oct 13, 2015
1 parent 58a6fe2 commit a05f4e6
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions spec/views/curation_concerns/base/show.html.erb_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,18 @@
let(:object_profile) { ["{\"id\":\"999\"}"] }
let(:contributor) { 'Frodo' }
let(:creator) { 'Bilbo' }
let(:solr_document) { SolrDocument.new(id: '999',
object_profile_ssm: object_profile,
has_model_ssim: ['GenericWork'],
human_readable_type_tesim: ['Generic Work'],
contributor_tesim: contributor,
creator_tesim: creator) }
let(:solr_document) {
SolrDocument.new(
id: '999',
object_profile_ssm: object_profile,
has_model_ssim: ['GenericWork'],
human_readable_type_tesim: ['Generic Work'],
contributor_tesim: contributor,
creator_tesim: creator,
rights_tesim: ['http://creativecommons.org/licenses/by/3.0/us/']
)
}

let(:ability) { nil }
let(:presenter) do
CurationConcerns::WorkShowPresenter.new(solr_document, ability)
Expand All @@ -23,10 +29,9 @@
render
end

it 'has links to edit' do # and add to collections' do
expect(rendered).to have_link('Edit This Generic Work', href: edit_polymorphic_path([:curation_concerns, presenter]))
# expect(rendered).to have_selector "a[data-toggle='modal'][data-target='##{curation_concern.to_param}-modal']", text: "Add to a Collection"
# expect(rendered).to have_selector("div.modal##{curation_concern.to_param}-modal form[action='#{collections.collections_path}'] input[value='Add to collection']")
it 'draws the page' do
expect(rendered).to have_link 'Attribution 3.0 United States', href: 'http://creativecommons.org/licenses/by/3.0/us/'
expect(rendered).to have_link 'Edit This Generic Work', href: edit_polymorphic_path([:curation_concerns, presenter])
end
end

Expand All @@ -37,11 +42,8 @@
allow(view).to receive(:can?).with(:collect, String).and_return(false)
render
end
it 'does not have links to edit' do # , but has add to collection' do
it 'does not have links to edit' do
expect(rendered).not_to have_content('Edit this Generic Work')

# expect(rendered).to have_selector "a[data-toggle='modal'][data-target='##{curation_concern.to_param}-modal']", text: "Add to a Collection"
# expect(rendered).to have_selector("div.modal##{curation_concern.to_param}-modal form[action='#{collections.collections_path}'] input[value='Add to collection']")
end
end
end

0 comments on commit a05f4e6

Please sign in to comment.