Commit 0c8dba90 authored by Walmyr Lima's avatar Walmyr Lima

Shorten test code

When we are fabricating a resource that is returned, and the only
thing we want to do with such a resource is visiting it after its
fabrication, we can call the visit! method directly after its fa-
brication without the need for a variable definition.
parent 70fe2ff1
......@@ -6,12 +6,11 @@ module QA
it 'user pushes code to the repository' do
Flow::Login.sign_in
project_push = Resource::Repository::ProjectPush.fabricate! do |push|
Resource::Repository::ProjectPush.fabricate! do |push|
push.file_name = 'README.md'
push.file_content = '# This is a test project'
push.commit_message = 'Add README.md'
end
project_push.project.visit!
end.project.visit!
expect(page).to have_content('README.md')
expect(page).to have_content('This is a test project')
......
......@@ -15,14 +15,12 @@ module QA
resource.title = key_title
end
project_push = Resource::Repository::ProjectPush.fabricate! do |push|
Resource::Repository::ProjectPush.fabricate! do |push|
push.ssh_key = key
push.file_name = 'README.md'
push.file_content = '# Test Use SSH Key'
push.commit_message = 'Add README.md'
end
project_push.project.visit!
end.project.visit!
expect(page).to have_content('README.md')
expect(page).to have_content('Test Use SSH Key')
......
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