master
 1Given(/^the user is on the registration page$/) do
 2  @subject = NewRegistrationPage.new
 3  @subject.visit_page
 4end
 5
 6When(/^they enter a (.*), (.*) and (.*)$/) do |username, email, password|
 7  @username = username
 8  @subject.register_with(
 9    username: username,
10    email: email,
11    password: password
12  )
13end
14
15When(/^the username (.*) is already registered$/) do |username|
16  FactoryGirl.create(:user, username: username)
17end
18
19When(/^the email (.*) is already registered$/) do |email|
20  FactoryGirl.create(:user, email: email)
21end
22
23Then(/^it redirects them to edit their profile$/) do
24  expect(@subject.current_path).to eql(edit_profile_path(id: @username))
25end
26
27Then(/^it displays the following (.*)$/) do |text|
28  expect(@subject).to have_content(text.gsub(/["'<>]/, ""))
29end