* Add temporary Rake task for creating profile fields * Fix problems after splitting branch * Add profile migration Rake task * Add unique index to profiles * Add migration code to users * Be smarter about updating profiles * Update spec * Update Bullet config * Fix typo * Change temporary rake task to data update script * Re-add profile factory and update spec * Change private declaration to make CodeClimate happy * Update comment * Drop validation in favor of DB default * Update spec
16 lines
563 B
Ruby
16 lines
563 B
Ruby
require "rails_helper"
|
|
require Rails.root.join("lib/data_update_scripts/20200819025131_migrate_profile_data.rb")
|
|
|
|
describe DataUpdateScripts::MigrateProfileData do
|
|
it "creates a profile for users who don't have one" do
|
|
user = create(:user, :without_profile)
|
|
expect do
|
|
described_class.new.run
|
|
end.to change { user.reload.profile }.from(nil).to(an_instance_of(Profile))
|
|
end
|
|
|
|
it "does nothing for users with existing profiles" do
|
|
user = create(:user)
|
|
expect { described_class.new.run }.not_to change { user.reload.profile }
|
|
end
|
|
end
|