* Bump rubocop from 1.15.0 to 1.16.0 Bumps [rubocop](https://github.com/rubocop/rubocop) from 1.15.0 to 1.16.0. - [Release notes](https://github.com/rubocop/rubocop/releases) - [Changelog](https://github.com/rubocop/rubocop/blob/master/CHANGELOG.md) - [Commits](https://github.com/rubocop/rubocop/compare/v1.15.0...v1.16.0) --- updated-dependencies: - dependency-name: rubocop dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> * Enable new cops and fix violations Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: rhymes <github@rhymes.dev>
35 lines
1 KiB
Ruby
35 lines
1 KiB
Ruby
require "rails_helper"
|
|
require Rails.root.join("lib/data_update_scripts/20200901040521_create_profile_fields.rb")
|
|
|
|
describe DataUpdateScripts::CreateProfileFields do
|
|
def profile_field_and_group_count
|
|
[ProfileField.count, ProfileFieldGroup.count]
|
|
end
|
|
|
|
before do
|
|
ProfileFieldGroup.destroy_all
|
|
ProfileField.destroy_all
|
|
end
|
|
|
|
context "when no profile fields or groups exist" do
|
|
it "creates all profile fields and groups" do
|
|
expect do
|
|
described_class.new.run
|
|
end.to change { profile_field_and_group_count }.from([0, 0]).to([14, 4])
|
|
end
|
|
end
|
|
|
|
context "when profile fields and/or groups already exist" do
|
|
before do
|
|
csv = Rails.root.join("lib/data/dev_profile_fields.csv")
|
|
ProfileFields::ImportFromCsv.call(csv)
|
|
end
|
|
|
|
it "works when profile fields or groups already exist", :aggregate_failures do
|
|
expect do
|
|
described_class.new.run
|
|
end.not_to change { profile_field_and_group_count }
|
|
expect(profile_field_and_group_count).to eq [14, 4]
|
|
end
|
|
end
|
|
end
|