Skip to content

Commit

Permalink
Test controlled vocab lockdown
Browse files Browse the repository at this point in the history
  • Loading branch information
jechols committed Jan 24, 2014
1 parent edb0002 commit 1959a9e
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions spec/features/ingest_form_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -145,4 +145,36 @@ def mark_as_reviewed
expect(page.status_code).to eq(200)
pending "Need to verify that the show view has the data we ingested"
end

it "locks down controlled vocabulary ingest fields on select" do
# Hack the map to add a subject
INGEST_MAP[:subject][:subj2] = "descMetadata.subject"

visit_ingest_url

subject_div = ingest_group_nodes("subject").first

# We should have no trouble finding the "subj2" option
subj2_selector = "option[value=subj2]"
expect(subject_div).to have_selector(subj2_selector)

# We should have no trouble typing into the value field
value_field = subject_div.find("input.value-field")
value_field.native.send_key("blargh")
expect(value_field.value).to eq("blargh")

vocab_subject = "Canned foods industry--Accidents"
vocab_uri = "http://id.loc.gov/authorities/subjects/sh2007009834"
choose_controlled_vocabulary_item("subject", "subject", "food", vocab_subject, vocab_uri)

# "subj2" should now be missing, which is how we fake readonly for the select
expect(subject_div).not_to have_selector(subj2_selector)

# Value field should be completely read-only
value_field = subject_div.find("input.value-field")
value_field.native.send_key("blargh")
expect(value_field.value).to eq(vocab_subject)

INGEST_MAP[:subject].delete(:subj2)
end
end

0 comments on commit 1959a9e

Please sign in to comment.