Skip to content
This repository has been archived by the owner on May 14, 2022. It is now read-only.

Commit

Permalink
Set coverage as single-valued in GeoWork forms
Browse files Browse the repository at this point in the history
  • Loading branch information
eliotjordan committed May 25, 2017
1 parent ccbd962 commit bd5b36d
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
7 changes: 7 additions & 0 deletions app/forms/hyrax/geo_work_form.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,12 @@ def multiple?(field)
return false if ['rights_statement'].include?(field.to_s)
super
end

def self.multiple?(field)
# Necessary to permit coverage param. Coverage is declared as
# single-valued in GeoWorks. We'll keep it that for now.
return false if field.to_sym == :coverage
super
end
end
end
14 changes: 14 additions & 0 deletions spec/controllers/hyrax/map_sets_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
let(:user) { FactoryGirl.create(:user) }
let(:coverage) { GeoWorks::Coverage.new(43.039, -69.856, 42.943, -71.032).to_s }
let(:map_set) { FactoryGirl.create(:map_set, user: user, title: ['Dummy Title'], coverage: coverage) }
let(:reloaded) { map_set.reload }

describe 'create' do
let(:user) { FactoryGirl.create(:admin) }
Expand All @@ -26,6 +27,19 @@
end
end

describe 'update' do
let(:map_set) { FactoryGirl.create(:map_set, user: user, title: ['Dummy Title']) }

before do
sign_in user
end

it 'can update the coverage' do
post :update, params: { id: map_set, map_set: { coverage: coverage } }
expect(reloaded.coverage).to eq coverage
end
end

describe '#file_manager' do
context "when not signed in" do
it "does not allow them to view it" do
Expand Down

0 comments on commit bd5b36d

Please sign in to comment.