Skip to content

Commit

Permalink
Merge pull request #2363 from tulibraries/MAN-1179-add-helper-text-to…
Browse files Browse the repository at this point in the history
…-finding-aid-form

MAN-1179 Require description in Finding Aids
  • Loading branch information
nomadicoder authored May 23, 2022
2 parents fbc5922 + 9abbdba commit 1ab27b6
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 1 deletion.
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,5 @@ group :test do
gem "simplecov-lcov"
gem "webmock"
gem "launchy"
gem "shoulda-matchers", "~> 5.1"
end
3 changes: 3 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,8 @@ GEM
rubyzip (>= 1.2.2)
semantic_range (3.0.0)
shellany (0.0.1)
shoulda-matchers (5.1.0)
activesupport (>= 5.2.0)
signet (0.16.1)
addressable (~> 2.8)
faraday (>= 0.17.5, < 3.0)
Expand Down Expand Up @@ -660,6 +662,7 @@ DEPENDENCIES
rubocop-rspec
sass-rails (~> 6.0)
selenium-webdriver
shoulda-matchers (~> 5.1)
simple_form
simplecov
simplecov-lcov
Expand Down
1 change: 1 addition & 0 deletions app/models/finding_aid.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class FindingAid < ApplicationRecord
has_rich_text :draft_description
has_rich_text :covid_alert
validates :collection_id, collection_or_subject: true
validates :description, presence: true

scope :has_subjects, -> { where.not(subject: []) }
scope :has_collections, -> { where.not(collections: []) }
Expand Down
5 changes: 4 additions & 1 deletion spec/models/finding_aid_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

RSpec.describe FindingAid, type: :model do

describe "validations" do
it { should validate_presence_of(:description) }
end

describe "version all fields", :skip do
# [TODO] create factory with default collection
fields = {
Expand Down Expand Up @@ -44,7 +48,6 @@
end
end


describe "Scope" do
describe ":with_subject" do
before do
Expand Down
7 changes: 7 additions & 0 deletions spec/rails_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -93,4 +93,11 @@
end

config.include ActionText::SystemTestHelper, type: :system

Shoulda::Matchers.configure do |config|
config.integrate do |with|
with.test_framework :rspec
with.library :rails
end
end
end

0 comments on commit 1ab27b6

Please sign in to comment.