summaryrefslogtreecommitdiff
path: root/features/step_definitions/registration_steps.rb
blob: 794b9ad382deafd6d3026e5545a127a6e8a0b0ee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
Given(/^the user is on the registration page$/) do
  @subject = NewRegistrationPage.new
  @subject.visit_page
end

When(/^they enter a (.*), (.*) and (.*)$/) do |username, email, password|
  @username = username
  @subject.register_with(
    username: username,
    email: email,
    password: password
  )
end

When(/^the username (.*) is already registered$/) do |username|
  FactoryGirl.create(:user, username: username)
end

When(/^the email (.*) is already registered$/) do |email|
  FactoryGirl.create(:user, email: email)
end

Then(/^it redirects them to edit their profile$/) do
  expect(@subject.current_path).to eql(edit_profile_path(id: @username))
end

Then(/^it displays the following (.*)$/) do |text|
  expect(@subject).to have_content(text.gsub(/["'<>]/, ""))
end