Skip to content
Browse files

Ready to add profile

  • Loading branch information...
1 parent a96bd3d commit 3e688b923230f5750c89896e60c221d5e139c3d6 @Mirthis committed Apr 8, 2012
View
9 Gemfile
@@ -20,11 +20,12 @@ gem 'jquery-rails'
gem 'devise'
gem 'haml'
gem 'recaptcha', :require => 'recaptcha/rails'
-gem 'omniauth'
+gem 'omniauth', '>= 0.2.6'
gem 'omniauth-twitter'
gem 'omniauth-facebook'
-gem 'omniauth-google_oauth2'
-gem 'omniauth-openid'
+#gem 'omniauth-google_oauth2'
+#gem 'omniauth-openid'
+gem 'therubyracer'
group :development do
gem 'rspec-rails'
@@ -36,7 +37,7 @@ group :test do
gem 'factory_girl_rails'
gem 'rspec-rails'
gem 'email_spec'
- gem 'cucumber-rails'
+ gem 'cucumber-rails', require: false
gem 'capybara'
gem 'database_cleaner'
gem 'spork', '~> 0.9.0.rc'
View
130 Gemfile.lock
@@ -28,8 +28,8 @@ GEM
activesupport (3.2.0)
i18n (~> 0.6)
multi_json (~> 1.0)
- addressable (2.2.6)
- arel (3.0.0)
+ addressable (2.2.7)
+ arel (3.0.2)
bcrypt-ruby (3.0.1)
builder (3.0.0)
capybara (1.1.2)
@@ -39,27 +39,27 @@ GEM
rack-test (>= 0.5.4)
selenium-webdriver (~> 2.0)
xpath (~> 0.1.4)
- childprocess (0.3.0)
+ childprocess (0.3.1)
ffi (~> 1.0.6)
coderay (1.0.5)
- coffee-rails (3.2.1)
+ coffee-rails (3.2.2)
coffee-script (>= 2.2.0)
- railties (~> 3.2.0.beta)
+ railties (~> 3.2.0)
coffee-script (2.2.0)
coffee-script-source
execjs
coffee-script-source (1.2.0)
- cucumber (1.1.4)
+ cucumber (1.1.9)
builder (>= 2.1.2)
diff-lcs (>= 1.1.2)
- gherkin (~> 2.7.1)
+ gherkin (~> 2.9.0)
json (>= 1.4.6)
term-ansicolor (>= 1.0.6)
- cucumber-rails (1.2.1)
+ cucumber-rails (1.3.0)
capybara (>= 1.1.2)
- cucumber (>= 1.1.3)
+ cucumber (>= 1.1.8)
nokogiri (>= 1.5.0)
- database_cleaner (0.7.1)
+ database_cleaner (0.7.2)
devise (2.0.4)
bcrypt-ruby (~> 3.0)
orm_adapter (~> 0.0.3)
@@ -76,89 +76,81 @@ GEM
eventmachine (0.12.10)
execjs (1.3.0)
multi_json (~> 1.0)
- factory_girl (2.5.0)
- activesupport
- factory_girl_rails (1.6.0)
- factory_girl (~> 2.5.0)
+ factory_girl (3.0.0)
+ activesupport (>= 3.0.0)
+ factory_girl_rails (3.0.0)
+ factory_girl (~> 3.0.0)
railties (>= 3.0.0)
faraday (0.7.6)
addressable (~> 2.2)
multipart-post (~> 1.1)
rack (~> 1.1)
ffi (1.0.11)
- gherkin (2.7.6)
+ gherkin (2.9.1)
json (>= 1.4.6)
- guard (1.0.0)
+ guard (1.0.1)
ffi (>= 0.5.0)
thor (~> 0.14.6)
guard-cucumber (0.7.5)
cucumber (>= 0.10)
guard (>= 0.8.3)
- guard-livereload (0.4.0)
+ guard-livereload (0.4.2)
em-websocket (>= 0.2.0)
guard (>= 0.10.0)
- multi_json (~> 1.0.3)
+ multi_json (~> 1.0)
guard-rspec (0.6.0)
guard (>= 0.10.0)
- guard-spork (0.5.1)
+ guard-spork (0.5.2)
guard (>= 0.10.0)
spork (>= 0.8.4)
haml (3.1.4)
hashie (1.2.0)
hike (1.2.1)
i18n (0.6.0)
- journey (1.0.0)
- jquery-rails (2.0.0)
- railties (>= 3.2.0.beta, < 5.0)
+ journey (1.0.3)
+ jquery-rails (2.0.1)
+ railties (>= 3.2.0, < 5.0)
thor (~> 0.14)
json (1.6.5)
- mail (2.4.1)
+ libv8 (3.3.10.4)
+ mail (2.4.4)
i18n (>= 0.4.0)
mime-types (~> 1.16)
treetop (~> 1.4.8)
metaclass (0.0.1)
- method_source (0.7.0)
- mime-types (1.17.2)
- mocha (0.10.3)
+ method_source (0.7.1)
+ mime-types (1.18)
+ mocha (0.10.5)
metaclass (~> 0.0.1)
- multi_json (1.0.4)
- multipart-post (1.1.4)
- nokogiri (1.5.0)
+ multi_json (1.1.0)
+ multipart-post (1.1.5)
+ nokogiri (1.5.2)
oauth (0.4.5)
oauth2 (0.5.2)
faraday (~> 0.7)
multi_json (~> 1.0)
- omniauth (1.0.2)
+ omniauth (1.0.3)
hashie (~> 1.2)
rack
omniauth-facebook (1.2.0)
omniauth-oauth2 (~> 1.0.0)
- omniauth-google_oauth2 (0.1.5)
- omniauth (~> 1.0)
- omniauth-oauth2
- omniauth-oauth (1.0.0)
+ omniauth-oauth (1.0.1)
oauth
omniauth (~> 1.0)
omniauth-oauth2 (1.0.0)
oauth2 (~> 0.5.0)
omniauth (~> 1.0)
- omniauth-openid (1.0.1)
- omniauth (~> 1.0)
- rack-openid (~> 1.3.1)
- omniauth-twitter (0.0.7)
+ omniauth-twitter (0.0.8)
omniauth-oauth (~> 1.0)
orm_adapter (0.0.6)
polyglot (0.3.3)
- pry (0.9.8)
+ pry (0.9.8.4)
coderay (~> 1.0.5)
- method_source (~> 0.7)
- slop (>= 2.4.3, < 3)
+ method_source (~> 0.7.1)
+ slop (>= 2.4.4, < 3)
rack (1.4.1)
- rack-cache (1.1)
+ rack-cache (1.2)
rack (>= 0.4)
- rack-openid (1.3.1)
- rack (>= 1.1.0)
- ruby-openid (>= 2.1.8)
rack-ssl (1.3.2)
rack
rack-test (0.6.1)
@@ -184,46 +176,47 @@ GEM
rdoc (3.12)
json (~> 1.4)
recaptcha (0.3.4)
- rspec (2.8.0)
- rspec-core (~> 2.8.0)
- rspec-expectations (~> 2.8.0)
- rspec-mocks (~> 2.8.0)
- rspec-core (2.8.0)
- rspec-expectations (2.8.0)
- diff-lcs (~> 1.1.2)
- rspec-mocks (2.8.0)
- rspec-rails (2.8.1)
+ rspec (2.9.0)
+ rspec-core (~> 2.9.0)
+ rspec-expectations (~> 2.9.0)
+ rspec-mocks (~> 2.9.0)
+ rspec-core (2.9.0)
+ rspec-expectations (2.9.0)
+ diff-lcs (~> 1.1.3)
+ rspec-mocks (2.9.0)
+ rspec-rails (2.9.0)
actionpack (>= 3.0)
activesupport (>= 3.0)
railties (>= 3.0)
- rspec (~> 2.8.0)
- ruby-openid (2.1.8)
- rubyzip (0.9.5)
- sass (3.1.12)
- sass-rails (3.2.3)
- railties (~> 3.2.0.beta)
+ rspec (~> 2.9.0)
+ rubyzip (0.9.6.1)
+ sass (3.1.15)
+ sass-rails (3.2.5)
+ railties (~> 3.2.0)
sass (>= 3.1.10)
tilt (~> 1.3)
- selenium-webdriver (2.17.0)
+ selenium-webdriver (2.20.0)
childprocess (>= 0.2.5)
- ffi (~> 1.0.9)
- multi_json (~> 1.0.4)
+ ffi (~> 1.0)
+ multi_json (~> 1.0)
rubyzip
- slop (2.4.3)
+ slop (2.4.4)
spork (0.9.0)
sprockets (2.1.2)
hike (~> 1.2)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
sqlite3 (1.3.5)
term-ansicolor (1.0.7)
+ therubyracer (0.9.10)
+ libv8 (~> 3.3.10)
thor (0.14.6)
tilt (1.3.3)
treetop (1.4.10)
polyglot
polyglot (>= 0.3.1)
- tzinfo (0.3.31)
- uglifier (1.2.2)
+ tzinfo (0.3.32)
+ uglifier (1.2.3)
execjs (>= 0.3.0)
multi_json (>= 1.0.2)
warden (1.1.1)
@@ -249,10 +242,8 @@ DEPENDENCIES
haml
jquery-rails
mocha
- omniauth
+ omniauth (>= 0.2.6)
omniauth-facebook
- omniauth-google_oauth2
- omniauth-openid
omniauth-twitter
pry
rails (= 3.2)
@@ -262,4 +253,5 @@ DEPENDENCIES
sass-rails (~> 3.2.3)
spork (~> 0.9.0.rc)
sqlite3
+ therubyracer
uglifier (>= 1.0.3)
View
2 config/initializers/omniauth.rb
@@ -1,4 +1,4 @@
-require 'openid/store/filesystem'
+#require 'openid/store/filesystem'
Rails.application.config.middleware.use OmniAuth::Builder do
provider :twitter, 'd9Bw8RnYjKpzuPOfLiHw', 'K5C8MPIWajNzXzx5JAzo9g0mK1GRT2KPKCaEd8bZBqo'
View
9 features/profile/profile_edit.feature
@@ -0,0 +1,9 @@
+Feature: Edit Profile
+ In order to give details about myself
+ As a user
+ I want to be able to edit my profile
+
+ Scenario: Adding my name
+ Given I an logged in
+ When I enter my name in my profile
+ Then I should see my name in my profile
View
15 features/step_definitions/user_steps.rb
@@ -181,8 +181,9 @@ def get_message_for description
visit 'users/view'
end
-When /^I submit account informations not provided by facebook$/ do
- pending # express the regexp above with the code you wish you had
+When /^I submit a new username for the registration$/ do
+ fill_in 'Username', :with => "new_username"
+ click_button "Sign up"
end
### THEN ###
@@ -241,7 +242,17 @@ def get_message_for description
end
Then /^I should see my account details$/ do
+ pending
page.should have_content "Account details"
page.should have_content(valid_user.username)
page.should have_content(valid_user.email)
end
+
+When /^I edit my account details$/ do
+ pending # express the regexp above with the code you wish you had
+end
+
+Then /^I should see my twitter account$/ do
+ pending # express the regexp above with the code you wish you had
+end
+end
View
1 features/users/user_edit.feature
@@ -3,6 +3,7 @@ Feature: Edit User
As a user
I want to edit my account details
+ @wip
Scenario: I sign in and edit my account
Given I am logged in
When I edit my account details
View
2 features/users/user_show.feature
@@ -3,11 +3,13 @@ Feature: View account information
As a user
I wan to view my account information
+ @wip
Scenario: Display basic account information
Given I am logged in
When I visit my account page
Then I should see my account details
+ @wip
Scenario: Display linked account information
Given I have aigned in with twitter
When I visit my account page
View
14 spec/controllers/authentications_controller_spec.rb
@@ -15,9 +15,9 @@
login_user
before(:each) do
- Factory(:authentication, :user => @user)
- Factory(:authentication, :user => @user, :provider => 'facebook')
- Factory(:authentication)
+ FactoryGirl.create(:authentication, :user => @user)
+ FactoryGirl.create(:authentication, :user => @user, :provider => 'facebook')
+ FactoryGirl.create(:authentication)
end
it "should be successful" do
@@ -38,8 +38,8 @@
describe 'authentication exist' do
before(:each) do
- @user = Factory(:user)
- Factory(:authentication, :uid => @oauth[:uid],
+ @user = FactoryGirl.create(:user)
+ FactoryGirl.create(:authentication, :uid => @oauth[:uid],
:provider => @oauth[:provider],
:user => @user)
end
@@ -93,7 +93,7 @@
describe 'for an unauthorized user' do
before(:each) do
- @auth = Factory(:authentication, :user => Factory(:user))
+ @auth = FactoryGirl.create(:authentication, :user => FactoryGirl.create(:user))
end
it 'should deny access' do
@@ -105,7 +105,7 @@
describe 'for an authorized user' do
before(:each) do
- @auth = Factory(:authentication, :user => @current_user)
+ @auth = FactoryGirl.create(:authentication, :user => @current_user)
end
it "should destroy the authentication" do
View
38 spec/controllers/registrations_controller_spec.rb
@@ -30,7 +30,7 @@
describe "success" do
before(:each) do
- @attr = Factory.attributes_for :user
+ @attr = FactoryGirl.attributes_for :user
end
it "should create a user" do
@@ -77,7 +77,7 @@
context "user provides additional data" do
before(:each) do
- @attr = Factory.attributes_for :user
+ @attr = FactoryGirl.attributes_for :user
@attr[:username] = "changed_username"
end
@@ -102,21 +102,21 @@
end
end
- describe "GET 'show'" do
- context 'not signed-in' do
- it 'should redirect to the sign-in page' do
- get :show
- response.should redirect_to(new_user_session_path)
- end
- end
-
- context 'signed-in' do
- login_user
-
- it 'should be succesfull' do
- get :show
- response.should render_template('show')
- end
- end
- end
+ #describe "GET 'show'" do
+ #context 'not signed-in' do
+ #it 'should redirect to the sign-in page' do
+ #get :show
+ #response.should redirect_to(new_user_session_path)
+ #end
+ #end
+
+ #context 'signed-in' do
+ #login_user
+
+ #it 'should be succesfull' do
+ #get :show
+ #response.should render_template('show')
+ #end
+ #end
+ #end
end
View
19 spec/factories.rb
@@ -1,25 +1,26 @@
# Factories definitions
FactoryGirl.define do
factory :user do
- username { Factory.next :username }
+ username { FactoryGirl.generate :username }
email { |u| "#{u.username}@example.com" }
password "foobar"
password_confirmation { |u| u.password }
end
factory :authentication do
provider "twitter"
- uid { Factory.next :uid }
+ uid { FactoryGirl.generate :uid }
association :user
end
-end
-# Sequences definitions
-Factory.sequence :username do |n|
- "User_#{n}"
-end
+ sequence :username do |n|
+ "User_#{n}"
+ end
-Factory.sequence :uid do |n|
- 1000 + n
+ sequence :uid do |n|
+ 1000 + n
+ end
end
+# Sequences definitions
+
View
2 spec/models/authentication_spec.rb
@@ -40,7 +40,7 @@
describe "user associations" do
before(:each) do
- @user = Factory(:user)
+ @user = FactoryGirl.create(:user)
@auth = @user.authentications.create(@attr)
end
View
4 spec/models/user_spec.rb
@@ -159,8 +159,8 @@
before(:each) do
@user = User.create(@attr)
- @auth1 = Factory(:authentication, :user => @user, :provider => 'twitter')
- @auth2 = Factory(:authentication, :user => @user, :provider => 'facebook')
+ @auth1 = FactoryGirl.create(:authentication, :user => @user, :provider => 'twitter')
+ @auth2 = FactoryGirl.create(:authentication, :user => @user, :provider => 'facebook')
end
it "should have an authentication attribute" do
View
2 spec/support/controller_macros.rb
@@ -2,7 +2,7 @@ module ControllerMacros
def login_user
before(:each) do
@request.env["devise.mapping"] = Devise.mappings[:user]
- @current_user = Factory.create(:user)
+ @current_user = FactoryGirl.create(:user)
@current_user.confirm! # or set a confirmed_at inside the factory. Only necessary if you are using the confirmable module
sign_in @current_user
end

0 comments on commit 3e688b9

Please sign in to comment.
Something went wrong with that request. Please try again.