Commit 75004e1b authored by Sanad Liaquat's avatar Sanad Liaquat

Merge branch '261793-set-feature-flag-well-before-testing' into 'master'

Set flag well before testing its effect

See merge request gitlab-org/gitlab!45727
parents 4b25abb4 2a57edac
...@@ -3,8 +3,15 @@ ...@@ -3,8 +3,15 @@
module QA module QA
RSpec.describe 'Create', :requires_admin do RSpec.describe 'Create', :requires_admin do
describe 'View merge request merge-ref diff' do describe 'View merge request merge-ref diff' do
let(:project) do
Resource::Project.fabricate_via_api! do |project|
project.name = 'merge-ref-diff'
end
end
let(:merge_request) do let(:merge_request) do
Resource::MergeRequest.fabricate_via_api! do |merge_request| Resource::MergeRequest.fabricate_via_api! do |merge_request|
merge_request.project = project
merge_request.title = 'This is a merge request' merge_request.title = 'This is a merge request'
merge_request.description = '... for viewing merge-ref and merge-base diffs' merge_request.description = '... for viewing merge-ref and merge-base diffs'
merge_request.file_content = 'This exists on the source branch only' merge_request.file_content = 'This exists on the source branch only'
...@@ -13,16 +20,14 @@ module QA ...@@ -13,16 +20,14 @@ module QA
let(:new_file_name) { "added_file-#{SecureRandom.hex(8)}.txt" } let(:new_file_name) { "added_file-#{SecureRandom.hex(8)}.txt" }
before do
commit_to_branch(merge_request.target_branch, new_file_name)
commit_to_branch(merge_request.source_branch, new_file_name)
Flow::Login.sign_in
end
context 'when the feature flag default_merge_ref_for_diffs is enabled' do context 'when the feature flag default_merge_ref_for_diffs is enabled' do
before do before do
Runtime::Feature.enable('default_merge_ref_for_diffs', project: merge_request.project) Runtime::Feature.enable('default_merge_ref_for_diffs', project: project)
commit_to_branch(merge_request.target_branch, new_file_name)
commit_to_branch(merge_request.source_branch, new_file_name)
Flow::Login.sign_in
merge_request.visit! merge_request.visit!
end end
...@@ -42,7 +47,12 @@ module QA ...@@ -42,7 +47,12 @@ module QA
context 'when the feature flag default_merge_ref_for_diffs is disabled' do context 'when the feature flag default_merge_ref_for_diffs is disabled' do
before do before do
Runtime::Feature.disable('default_merge_ref_for_diffs', project: merge_request.project) Runtime::Feature.disable('default_merge_ref_for_diffs', project: project)
commit_to_branch(merge_request.target_branch, new_file_name)
commit_to_branch(merge_request.source_branch, new_file_name)
Flow::Login.sign_in
merge_request.visit! merge_request.visit!
end end
......
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