From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1QOo8C-0002ki-RS for garchives@archives.gentoo.org; Tue, 24 May 2011 09:42:29 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 10B231C412; Tue, 24 May 2011 09:41:56 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 75B921C412 for ; Tue, 24 May 2011 09:41:56 +0000 (UTC) Received: from pelican.gentoo.org (unknown [66.219.59.40]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id CCEA42AC00D for ; Tue, 24 May 2011 09:41:55 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id 41ACF8050F for ; Tue, 24 May 2011 09:41:55 +0000 (UTC) From: "Petteri Räty" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Petteri Räty" Message-ID: <971d1d4a91fdb569f1f0c70bc85f8b613df58521.betelgeuse@gentoo> Subject: [gentoo-commits] proj/council-webapp:master commit in: site/db/, site/features/support/, site/features/, site/app/models/, ... X-VCS-Repository: proj/council-webapp X-VCS-Files: site/app/models/user.rb site/db/schema.rb site/features/irc_nick.feature site/features/step_definitions/irc_nick_steps.rb site/features/step_definitions/login_steps.rb site/features/step_definitions/within_steps.rb site/features/support/paths.rb X-VCS-Directories: site/db/ site/features/support/ site/features/ site/app/models/ site/features/step_definitions/ X-VCS-Committer: betelgeuse X-VCS-Committer-Name: Petteri Räty X-VCS-Revision: 971d1d4a91fdb569f1f0c70bc85f8b613df58521 Date: Tue, 24 May 2011 09:41:55 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: X-Archives-Hash: 60e86bdaf7f280c99b693eec31537c6d commit: 971d1d4a91fdb569f1f0c70bc85f8b613df58521 Author: Joachim Filip Ignacy Bartosik gmail com= > AuthorDate: Mon May 9 11:42:46 2011 +0000 Commit: Petteri R=C3=A4ty gentoo org> CommitDate: Fri May 20 15:03:03 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/council-webap= p.git;a=3Dcommit;h=3D971d1d4a Add irc_nick field to User model --- site/app/models/user.rb | 3 +- site/db/schema.rb | 3 +- site/features/irc_nick.feature | 20 ++++++++++++++++ site/features/step_definitions/irc_nick_steps.rb | 26 ++++++++++++++++= ++++++ site/features/step_definitions/login_steps.rb | 2 +- site/features/step_definitions/within_steps.rb | 10 ++++++++ site/features/support/paths.rb | 3 ++ 7 files changed, 64 insertions(+), 3 deletions(-) diff --git a/site/app/models/user.rb b/site/app/models/user.rb index fc9bc9f..20b2c4c 100644 --- a/site/app/models/user.rb +++ b/site/app/models/user.rb @@ -4,6 +4,7 @@ class User < ActiveRecord::Base =20 fields do name :string, :required, :unique + irc_nick :string, :required, :unique email_address :email_address, :login =3D> true administrator :boolean, :default =3D> false timestamps @@ -16,7 +17,7 @@ class User < ActiveRecord::Base state :active, :default =3D> true =20 create :signup, :available_to =3D> "Guest", - :params =3D> [:name, :email_address, :password, :password_con= firmation], + :params =3D> [:name, :email_address, :irc_nick, :password, :p= assword_confirmation], :become =3D> :active =20 transition :request_password_reset, { :active =3D> :active }, :new_k= ey =3D> true do diff --git a/site/db/schema.rb b/site/db/schema.rb index e4c4626..d01de42 100644 --- a/site/db/schema.rb +++ b/site/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended to check this file into your version control= system. =20 -ActiveRecord::Schema.define(:version =3D> 20110510091749) do +ActiveRecord::Schema.define(:version =3D> 20110510092019) do =20 create_table "users", :force =3D> true do |t| t.string "crypted_password", :limit =3D> 40 @@ -24,6 +24,7 @@ ActiveRecord::Schema.define(:version =3D> 2011051009174= 9) do t.datetime "updated_at" t.string "state", :default =3D> = "active" t.datetime "key_timestamp" + t.string "irc_nick" end =20 add_index "users", ["state"], :name =3D> "index_users_on_state" diff --git a/site/features/irc_nick.feature b/site/features/irc_nick.feat= ure 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/feat= ures/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/feature= s/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 =3D User.new :name =3D> "Example", :email_address =3D> "example@e= xample.com", - :password =3D> "Example" + :password =3D> "Example", :irc_nick =3D> "example" user.save! end =20 diff --git a/site/features/step_definitions/within_steps.rb b/site/featur= es/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' =3D> '.flash.notice', + 'in the errors' =3D> '.error-messages', + 'as the user nick' =3D> '.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 =20 + when /the signup page/ + user_signup_path + # Add more mappings here. # Here is an example that pulls values out of the Regexp: #