Skip to content

Instantly share code, notes, and snippets.

@imhilla
Created January 25, 2021 10:52
Show Gist options
  • Select an option

  • Save imhilla/daddfbcefe9eb12efa81a08aeabe9937 to your computer and use it in GitHub Desktop.

Select an option

Save imhilla/daddfbcefe9eb12efa81a08aeabe9937 to your computer and use it in GitHub Desktop.
def do_signup(_name, _username, _email, _password)
visit root_path
click_button('SIGN UP')
attach_file('user[image]', "#{Rails.root}/spec/files/attachment.jpeg", visible: false)
find("input[placeholder='Name']").set 'hillary'
find("input[placeholder='Username']").set 'hillary'
find("input[placeholder='Email']").set '[email protected]'
find("input[placeholder='Password']").set '123456'
find("input[placeholder='Password confirmation']").set '123456'
click_button('sign_up')
end
def do_login(_username, _password)
visit root_path
click_button('LOG IN')
find("input[placeholder='Username']").set 'hillary'
find("input[placeholder='Password']").set '123456'
click_button('sign_in')
end
def create_article
fill_in('Title', with: 'What is a capstone project')
fill_in('Title', with: 'What is a capstone project?')
fill_in('Body', with: 'Capstone projects are projects to test your mastery of a particular section')
click_button('submitc')
end
def create_group
fill_in('Name', with: 'Amazon')
attach_file('group[icon]', "#{Rails.root}/spec/files/attachment.jpeg", visible: false)
click_button('Create Group')
end
def create_article_group
select 'Amazon', from: 'group_id'
fill_in('Title', with: 'What is a capstone project')
fill_in('Title', with: 'What is a capstone project?')
fill_in('Body', with: 'Capstone projects')
click_button('submitc')
end
def create_comment
click_button('comment')
fill_in('Body', with: 'I am working on my capstone right now')
click_button('commit')
end
def create_like
click_button('like')
end
def splash_page
visit root_path
end
end
@imhilla
Copy link
Author

imhilla commented Jan 25, 2021

This is meant to show integration tests with Rspec.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment