-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1466 from theodi/staging
Update master
- Loading branch information
Showing
6 changed files
with
94 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
> Please provide a general summary of the issue in the Issue Title above | ||
> fill out the headings below as applicable to the issue you are reporting, | ||
> deleting as appropriate but offering us as much detail as you can to help us resolve the issue | ||
### Expected Behaviour | ||
> What should happen? | ||
### Desired Behaviour (for enhancement suggestions only) | ||
> if relevant include images or hyperlinks to other resources that clarify the enhancement you're seeking | ||
### Current Behaviour (for problems) | ||
> What currently happens that isn't expected behaviour? | ||
### Steps to Reproduce (for problems) | ||
> Provide a link to a live example, or an unambiguous set of steps to reproduce this bug. Include code to reproduce, if relevant | ||
1. | ||
2. | ||
3. | ||
4. | ||
|
||
### Your Environment | ||
> Include as many relevant details about the environment you experienced the bug in - this will help us resolve the bug more expediently | ||
* Environment name and version (e.g. Chrome 39, node.js 5.4): | ||
* Operating System and version (desktop or mobile): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
Feature: registering a new account | ||
|
||
Background: | ||
Given I visit the home page | ||
And I click "Register" | ||
|
||
Scenario: I can sign up for an account successfully | ||
When I enter my email address | ||
And I enter my password | ||
And I confirm my password | ||
And I agree to the terms | ||
And I click sign up | ||
Then an account should be created | ||
|
||
Scenario: Dumb bots that autotick boxes can't make accounts | ||
When I enter my email address | ||
And I enter my password | ||
And I confirm my password | ||
And I agree to the terms | ||
And I tick the inhuman box | ||
And I click sign up | ||
Then an account should not be created | ||
And there is an error message about being human |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
Given(/^I visit the home page$/) do | ||
visit '/' | ||
end | ||
|
||
Given(/^I visit the edit account page$/) do | ||
visit edit_user_registration_path(@user) | ||
end | ||
|
@@ -15,14 +19,31 @@ | |
first('#user_agreed_to_terms').set(false) | ||
end | ||
|
||
When(/^I enter my email address$/) do | ||
@email = "[email protected]" | ||
first('#user_email').set(@email) | ||
end | ||
|
||
When(/^I confirm my password$/) do | ||
first('#user_password_confirmation').set('password') | ||
end | ||
|
||
When(/^I enter my password$/) do | ||
first('#user_password').set('password') | ||
end | ||
|
||
When(/^I enter my current password$/) do | ||
first('#user_current_password').set('password') | ||
end | ||
|
||
When(/^I click save$/) do | ||
click_on 'Update my profile' | ||
end | ||
|
||
When(/^I click sign up$/) do | ||
first('#register input[type=submit]').click | ||
end | ||
|
||
Then(/^there is an error message about agreeing to terms$/) do | ||
assert_text('Errors occurred') | ||
end | ||
|
@@ -31,10 +52,27 @@ | |
assert_no_text('Errors occurred') | ||
end | ||
|
||
When(/^I tick the inhuman box$/) do | ||
first('#user_inhuman', visible: false).set(true) | ||
end | ||
|
||
Then(/^there is an error message about being human$/) do | ||
assert_text('Errors occurred') | ||
end | ||
|
||
Then(/^my changes are saved$/) do | ||
assert_equal @organization, @user.reload.organization | ||
end | ||
|
||
Then(/^my changes are not saved$/) do | ||
refute_equal @organization, @user.reload.organization | ||
end | ||
|
||
Then(/^an account should be created$/) do | ||
assert_equal 1, User.count | ||
assert_equal @email, User.first.email | ||
end | ||
|
||
Then(/^an account should not be created$/) do | ||
assert_equal 0, User.count | ||
end |