Commit 05ce22b8 authored by Michael Kozono's avatar Michael Kozono

Merge branch '281709-move-user-ee-spec-to-correct-directory' into 'master'

Move user ee spec to correct directory

See merge request gitlab-org/gitlab!47558
parents 02bbb50f 7f5599af
......@@ -113,7 +113,6 @@ Rails/SaveBang:
- 'ee/spec/models/scim_oauth_access_token_spec.rb'
- 'ee/spec/models/upload_spec.rb'
- 'ee/spec/models/user_preference_spec.rb'
- 'ee/spec/models/user_spec.rb'
- 'ee/spec/models/visible_approvable_spec.rb'
- 'ee/spec/models/vulnerabilities/feedback_spec.rb'
- 'ee/spec/models/vulnerabilities/issue_link_spec.rb'
......
......@@ -122,10 +122,10 @@ This is also not just applied to models. Here's a list of other examples:
To test an `EE` namespaced module that extends a CE class with EE features,
create the spec file as you normally would in the `ee/spec` directory, including the second `ee/` subdirectory.
For example, an extension `ee/app/models/ee/user.rb` would have its tests in `ee/app/models/ee/user_spec.rb`.
For example, an extension `ee/app/models/ee/user.rb` would have its tests in `ee/spec/models/ee/user_spec.rb`.
In the `RSpec.describe` call, use the CE class name where the EE module would be used.
For example, in `ee/app/models/ee/user_spec.rb`, the test would start with:
For example, in `ee/spec/models/ee/user_spec.rb`, the test would start with:
```ruby
RSpec.describe User do
......
......@@ -684,7 +684,7 @@ RSpec.describe User do
let(:group) { create :group_with_managed_accounts }
before do
member1.update(managing_group: group)
member1.update!(managing_group: group)
end
it 'returns true with group managed account owner' do
......@@ -1157,7 +1157,7 @@ RSpec.describe User do
with_them do
before do
user.update(user_type: user_type)
user.update!(user_type: user_type)
end
it { is_expected.to be expected_result }
......@@ -1456,7 +1456,7 @@ RSpec.describe User do
with_them do
it 'returns the correct result for each plan on a personal namespace' do
plan = create(hosted_plan)
plan = create(hosted_plan) # rubocop:disable Rails/SaveBang
create(:gitlab_subscription, namespace: user.namespace, hosted_plan: plan)
expect(subject).to be result
......
......@@ -28,9 +28,9 @@ tests = [
},
{
explanation: 'Some EE extensions also map to its EE class spec, but this is not recommended: https://docs.gitlab.com/ee/development/ee_features.html#testing-ee-features-based-on-ce-features',
source: 'ee/app/models/ee/user.rb',
expected: ['ee/spec/models/user_spec.rb', 'spec/models/user_spec.rb']
explanation: 'Some EE extensions have specs placement that do not follow the recommendation: https://docs.gitlab.com/ee/development/ee_features.html#testing-ee-features-based-on-ce-features. `tff` should still find these misplaced specs.',
source: 'ee/app/models/ee/project.rb',
expected: ['ee/spec/models/project_spec.rb', 'spec/models/project_spec.rb']
},
{
......@@ -53,8 +53,8 @@ tests = [
{
explanation: 'EE spec code should map to itself',
source: 'ee/spec/models/user_spec.rb',
expected: ['ee/spec/models/user_spec.rb']
source: 'ee/spec/models/ee/user_spec.rb',
expected: ['ee/spec/models/ee/user_spec.rb', 'spec/models/user_spec.rb']
},
{
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment