diff options
Diffstat (limited to 'spec/lib/gitlab/background_migration/fix_user_namespace_names_spec.rb')
-rw-r--r-- | spec/lib/gitlab/background_migration/fix_user_namespace_names_spec.rb | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/spec/lib/gitlab/background_migration/fix_user_namespace_names_spec.rb b/spec/lib/gitlab/background_migration/fix_user_namespace_names_spec.rb index 7768411828c..0d0ad2cc39e 100644 --- a/spec/lib/gitlab/background_migration/fix_user_namespace_names_spec.rb +++ b/spec/lib/gitlab/background_migration/fix_user_namespace_names_spec.rb @@ -5,18 +5,18 @@ require 'spec_helper' RSpec.describe Gitlab::BackgroundMigration::FixUserNamespaceNames, schema: 20190620112608 do let(:namespaces) { table(:namespaces) } let(:users) { table(:users) } - let(:user) { users.create(name: "The user's full name", projects_limit: 10, username: 'not-null', email: '1') } + let(:user) { users.create!(name: "The user's full name", projects_limit: 10, username: 'not-null', email: '1') } context 'updating the namespace names' do it 'updates a user namespace within range' do - user2 = users.create(name: "Other user's full name", projects_limit: 10, username: 'also-not-null', email: '2') - user_namespace1 = namespaces.create( + user2 = users.create!(name: "Other user's full name", projects_limit: 10, username: 'also-not-null', email: '2') + user_namespace1 = namespaces.create!( id: 2, owner_id: user.id, name: "Should be the user's name", path: user.username ) - user_namespace2 = namespaces.create( + user_namespace2 = namespaces.create!( id: 3, owner_id: user2.id, name: "Should also be the user's name", @@ -30,7 +30,7 @@ RSpec.describe Gitlab::BackgroundMigration::FixUserNamespaceNames, schema: 20190 end it 'does not update namespaces out of range' do - user_namespace = namespaces.create( + user_namespace = namespaces.create!( id: 6, owner_id: user.id, name: "Should be the user's name", @@ -42,7 +42,7 @@ RSpec.describe Gitlab::BackgroundMigration::FixUserNamespaceNames, schema: 20190 end it 'does not update groups owned by the users' do - user_group = namespaces.create( + user_group = namespaces.create!( id: 2, owner_id: user.id, name: 'A group name', @@ -58,7 +58,7 @@ RSpec.describe Gitlab::BackgroundMigration::FixUserNamespaceNames, schema: 20190 context 'namespace route names' do let(:routes) { table(:routes) } let(:namespace) do - namespaces.create( + namespaces.create!( id: 2, owner_id: user.id, name: "Will be updated to the user's name", @@ -67,7 +67,7 @@ RSpec.describe Gitlab::BackgroundMigration::FixUserNamespaceNames, schema: 20190 end it "updates the route name if it didn't match the namespace" do - route = routes.create(path: namespace.path, name: 'Incorrect name', source_type: 'Namespace', source_id: namespace.id) + route = routes.create!(path: namespace.path, name: 'Incorrect name', source_type: 'Namespace', source_id: namespace.id) described_class.new.perform(1, 5) @@ -75,7 +75,7 @@ RSpec.describe Gitlab::BackgroundMigration::FixUserNamespaceNames, schema: 20190 end it 'updates the route name if it was nil match the namespace' do - route = routes.create(path: namespace.path, name: nil, source_type: 'Namespace', source_id: namespace.id) + route = routes.create!(path: namespace.path, name: nil, source_type: 'Namespace', source_id: namespace.id) described_class.new.perform(1, 5) @@ -83,14 +83,14 @@ RSpec.describe Gitlab::BackgroundMigration::FixUserNamespaceNames, schema: 20190 end it "doesn't update group routes" do - route = routes.create(path: 'group-path', name: 'Group name', source_type: 'Group', source_id: namespace.id) + route = routes.create!(path: 'group-path', name: 'Group name', source_type: 'Group', source_id: namespace.id) expect { described_class.new.perform(1, 5) } .not_to change { route.reload.name } end it "doesn't touch routes for namespaces out of range" do - user_namespace = namespaces.create( + user_namespace = namespaces.create!( id: 6, owner_id: user.id, name: "Should be the user's name", |