aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoachim Filip Ignacy Bartosik <jbartosik@gmail.com>2011-05-09 13:42:46 +0200
committerJoachim Filip Ignacy Bartosik <jbartosik@gmail.com>2011-05-20 17:03:03 +0200
commit971d1d4a91fdb569f1f0c70bc85f8b613df58521 (patch)
treeeee330030281b7bf4560d2d61d6e6caeb675ab8b /site/features
parentCookie steps (diff)
downloadcouncil-webapp-971d1d4a91fdb569f1f0c70bc85f8b613df58521.tar.gz
council-webapp-971d1d4a91fdb569f1f0c70bc85f8b613df58521.tar.bz2
council-webapp-971d1d4a91fdb569f1f0c70bc85f8b613df58521.zip
Add irc_nick field to User model
Diffstat (limited to 'site/features')
-rw-r--r--site/features/irc_nick.feature20
-rw-r--r--site/features/step_definitions/irc_nick_steps.rb26
-rw-r--r--site/features/step_definitions/login_steps.rb2
-rw-r--r--site/features/step_definitions/within_steps.rb10
-rw-r--r--site/features/support/paths.rb3
5 files changed, 60 insertions, 1 deletions
diff --git a/site/features/irc_nick.feature b/site/features/irc_nick.feature
new file mode 100644
index 0000000..cb1d73a
--- /dev/null
+++ b/site/features/irc_nick.feature
@@ -0,0 +1,20 @@
+Feature: IRC nick
+ In order to make IRC bot integration possible
+ I want all users to provide their freenode IRC nicks
+
+ Scenario: User registration with nick
+ When I am on the homepage
+ And I follow "Signup"
+ And I signup as example user with IRC nick
+ Then I should see "Thanks for signing up!" in the notices
+
+ Scenario: Fail user registration without nick
+ When I am on the signup page
+ And I signup as example user without IRC nick
+ Then I should see "Irc nick can't be blank" in the errors
+ And I should be on the signup page
+
+ Scenario: View your own IRC nick
+ Given I am logged in as example user
+ When I follow "Logged in as Example"
+ Then I should see "example" as the user nick
diff --git a/site/features/step_definitions/irc_nick_steps.rb b/site/features/step_definitions/irc_nick_steps.rb
new file mode 100644
index 0000000..acaa4f8
--- /dev/null
+++ b/site/features/step_definitions/irc_nick_steps.rb
@@ -0,0 +1,26 @@
+When /^I fill in example user registration data$/ do
+ When "I fill in the following:", table(%{
+ |user_name|examle|
+ |user_email_address|example@example.com|
+ |user_irc_nick|example|
+ |user_password|Example|
+ |user_password_confirmation|Example|
+ })
+end
+
+When /^I signup as example user without IRC nick$/ do
+ When 'I fill in example user registration data'
+ When 'I fill in "user_irc_nick" with ""'
+ When 'I press "Signup"'
+end
+
+When /^I signup as example user with IRC nick$/ do
+ When 'I fill in example user registration data'
+ When 'I press "Signup"'
+end
+
+Given /^I am logged in as example user$/ do
+ Given 'example user'
+ When 'I am on the login page'
+ When 'I login as example user'
+end
diff --git a/site/features/step_definitions/login_steps.rb b/site/features/step_definitions/login_steps.rb
index 52fbcd3..5eaa5cc 100644
--- a/site/features/step_definitions/login_steps.rb
+++ b/site/features/step_definitions/login_steps.rb
@@ -1,6 +1,6 @@
Given /^example user$/ do
user = User.new :name => "Example", :email_address => "example@example.com",
- :password => "Example"
+ :password => "Example", :irc_nick => "example"
user.save!
end
diff --git a/site/features/step_definitions/within_steps.rb b/site/features/step_definitions/within_steps.rb
new file mode 100644
index 0000000..76b0ad6
--- /dev/null
+++ b/site/features/step_definitions/within_steps.rb
@@ -0,0 +1,10 @@
+{
+ 'in the notices' => '.flash.notice',
+ 'in the errors' => '.error-messages',
+ 'as the user nick' => '.user-irc-nick'
+}.
+each do |within, selector|
+ Then /^I should( not)? see "([^"]*)" #{within}$/ do |negation, text|
+ Then %Q{I should#{negation} see "#{text}" within "#{selector}"}
+ end
+end
diff --git a/site/features/support/paths.rb b/site/features/support/paths.rb
index 6ea5ce1..90b611b 100644
--- a/site/features/support/paths.rb
+++ b/site/features/support/paths.rb
@@ -14,6 +14,9 @@ module NavigationHelpers
when /the login page/
user_login_path
+ when /the signup page/
+ user_signup_path
+
# Add more mappings here.
# Here is an example that pulls values out of the Regexp:
#