Skip to content

gems update #42

Merged
merged 4 commits into from Jan 19, 2012
View
2 .rvmrc
@@ -1 +1 @@
-rvm use 1.9.2@codebrawl --create
+rvm use 1.9.3@codebrawl --create
View
7 Gemfile
@@ -1,6 +1,8 @@
source 'http://rubygems.org'
-gem 'rails'
+gem 'rails', '3.2.0.rc2'
+
+gem 'rack', :git => 'https://github.com/rack/rack.git'
gem 'thin'
@@ -20,6 +22,7 @@ gem 'kramdown'
gem 'mongoid_slug', :require => 'mongoid/slug'
gem 'omniauth'
+gem 'omniauth-github'
gem 'gravtastic', :git => 'https://github.com/jeffkreeftmeijer/gravtastic.git'
@@ -35,7 +38,7 @@ gem 'arnold', :git => 'https://github.com/codebrawl/arnold.git', :branch => 'dev
group :test do
gem 'rspec-rails'
gem 'shoulda-matchers'
- gem 'capybara', :git => 'https://github.com/jnicklas/capybara.git', :ref => '549e6733'
+ gem 'capybara'
gem 'launchy'
gem 'mocha'
View
237 Gemfile.lock
@@ -12,59 +12,56 @@ GIT
gravtastic (2.1.3)
GIT
- remote: https://github.com/jnicklas/capybara.git
- revision: 549e67336c712a1ef2119ce5ff64dbbc7542480f
- ref: 549e6733
+ remote: https://github.com/rack/rack.git
+ revision: 247331ef1437267cdabc11d4d756a55d253b4eb7
specs:
- capybara (0.4.1.1)
- mime-types (>= 1.16)
- nokogiri (>= 1.3.3)
- rack (>= 1.0.0)
- rack-test (>= 0.5.4)
- selenium-webdriver (>= 0.0.27)
- xpath (~> 0.1.3)
+ rack (1.4.0)
GEM
remote: http://rubygems.org/
specs:
RedCloth (4.2.8)
- actionmailer (3.1.0)
- actionpack (= 3.1.0)
+ actionmailer (3.2.0.rc2)
+ actionpack (= 3.2.0.rc2)
mail (~> 2.3.0)
- actionpack (3.1.0)
- activemodel (= 3.1.0)
- activesupport (= 3.1.0)
+ actionpack (3.2.0.rc2)
+ activemodel (= 3.2.0.rc2)
+ activesupport (= 3.2.0.rc2)
builder (~> 3.0.0)
erubis (~> 2.7.0)
- i18n (~> 0.6)
- rack (~> 1.3.2)
- rack-cache (~> 1.0.3)
- rack-mount (~> 0.8.2)
+ journey (~> 1.0.0.rc1)
+ rack (~> 1.4.0)
+ rack-cache (~> 1.1)
rack-test (~> 0.6.1)
- sprockets (~> 2.0.0)
- activemodel (3.1.0)
- activesupport (= 3.1.0)
- bcrypt-ruby (~> 3.0.0)
+ sprockets (~> 2.1.2)
+ activemodel (3.2.0.rc2)
+ activesupport (= 3.2.0.rc2)
builder (~> 3.0.0)
- i18n (~> 0.6)
- activerecord (3.1.0)
- activemodel (= 3.1.0)
- activesupport (= 3.1.0)
- arel (~> 2.2.1)
+ activerecord (3.2.0.rc2)
+ activemodel (= 3.2.0.rc2)
+ activesupport (= 3.2.0.rc2)
+ arel (~> 3.0.0.rc1)
tzinfo (~> 0.3.29)
- activeresource (3.1.0)
- activemodel (= 3.1.0)
- activesupport (= 3.1.0)
- activesupport (3.1.0)
+ activeresource (3.2.0.rc2)
+ activemodel (= 3.2.0.rc2)
+ activesupport (= 3.2.0.rc2)
+ activesupport (3.2.0.rc2)
+ i18n (~> 0.6)
multi_json (~> 1.0)
- addressable (2.2.4)
- arel (2.2.1)
- bcrypt-ruby (3.0.1)
+ addressable (2.2.6)
+ arel (3.0.0)
blankslate (2.1.2.4)
bson (1.5.2)
bson_ext (1.3.1)
builder (3.0.0)
- childprocess (0.2.2)
+ capybara (1.1.2)
+ mime-types (>= 1.16)
+ nokogiri (>= 1.3.3)
+ rack (>= 1.0.0)
+ rack-test (>= 0.5.4)
+ selenium-webdriver (~> 2.0)
+ xpath (~> 0.1.4)
+ childprocess (0.3.0)
ffi (~> 1.0.6)
chunky_png (1.2.4)
coffee-script (2.2.0)
@@ -78,17 +75,17 @@ GEM
configuration (1.3.1)
daemons (1.1.3)
database_cleaner (0.6.4)
- diff-lcs (1.1.2)
+ diff-lcs (1.1.3)
erubis (2.7.0)
eventmachine (0.12.10)
execjs (1.0.0)
multi_json (~> 1.0)
fabrication (1.0.0)
faker (0.3.1)
fakeweb (1.3.0)
- faraday (0.6.1)
- addressable (~> 2.2.4)
- multipart-post (~> 1.1.0)
+ faraday (0.7.5)
+ addressable (~> 2.2.6)
+ multipart-post (~> 1.1.3)
rack (>= 1.1.0, < 2)
ffi (1.0.9)
fssm (0.2.7)
@@ -101,7 +98,8 @@ GEM
nokogiri (~> 1.0)
pygments.rb (~> 0.1)
redcarpet (~> 1.17)
- haml (3.1.2)
+ haml (3.1.4)
+ hashie (1.2.0)
hashr (0.0.11)
hike (1.2.1)
hoptoad_notifier (2.4.11)
@@ -110,11 +108,11 @@ GEM
httparty (0.2.2)
json (~> 1.1)
i18n (0.6.0)
+ journey (1.0.0)
jquery-rails (1.0.7)
railties (~> 3.0)
thor (~> 0.14)
- json (1.5.1)
- json_pure (1.6.1)
+ json (1.6.5)
kramdown (0.13.3)
launchy (0.4.0)
configuration (>= 0.0.5)
@@ -124,7 +122,7 @@ GEM
i18n (>= 0.4.0)
mime-types (~> 1.16)
treetop (~> 1.4.8)
- mime-types (1.16)
+ mime-types (1.17.2)
mocha (0.9.12)
mongo (1.5.2)
bson (= 1.5.2)
@@ -136,127 +134,86 @@ GEM
mongoid (~> 2.0.0)
stringex (~> 1.2.0)
multi_json (1.0.4)
- multi_xml (0.2.2)
- multipart-post (1.1.2)
- net-ldap (0.2.2)
+ multipart-post (1.1.4)
newrelic_rpm (2.14.1)
- nokogiri (1.4.7)
- oa-basic (0.2.6)
- oa-core (= 0.2.6)
- rest-client (~> 1.6.0)
- oa-core (0.2.6)
- oa-enterprise (0.2.6)
- addressable (= 2.2.4)
- net-ldap (~> 0.2.2)
- nokogiri (~> 1.4.2)
- oa-core (= 0.2.6)
- pyu-ruby-sasl (~> 0.0.3.1)
- rubyntlm (~> 0.1.1)
- oa-more (0.2.6)
- multi_json (~> 1.0.0)
- oa-core (= 0.2.6)
- rest-client (~> 1.6.0)
- oa-oauth (0.2.6)
- faraday (~> 0.6.1)
- multi_json (~> 1.0.0)
- multi_xml (~> 0.2.2)
- oa-core (= 0.2.6)
- oauth (~> 0.4.0)
- oauth2 (~> 0.4.1)
- oa-openid (0.2.6)
- oa-core (= 0.2.6)
- rack-openid (~> 1.3.1)
- ruby-openid-apps-discovery (~> 1.2.0)
- oauth (0.4.4)
- oauth2 (0.4.1)
- faraday (~> 0.6.1)
- multi_json (>= 0.0.5)
- omniauth (0.2.6)
- oa-basic (= 0.2.6)
- oa-core (= 0.2.6)
- oa-enterprise (= 0.2.6)
- oa-more (= 0.2.6)
- oa-oauth (= 0.2.6)
- oa-openid (= 0.2.6)
- polyglot (0.3.2)
+ nokogiri (1.5.0)
+ oauth2 (0.5.2)
+ faraday (~> 0.7)
+ multi_json (~> 1.0)
+ omniauth (1.0.2)
+ hashie (~> 1.2)
+ rack
+ omniauth-github (1.0.1)
+ omniauth (~> 1.0)
+ omniauth-oauth2 (~> 1.0)
+ omniauth-oauth2 (1.0.0)
+ oauth2 (~> 0.5.0)
+ omniauth (~> 1.0)
+ polyglot (0.3.3)
pygments.rb (0.1.2)
rubypython (>= 0.5.1)
- pyu-ruby-sasl (0.0.3.3)
- rack (1.3.3)
- rack-cache (1.0.3)
+ rack-cache (1.1)
rack (>= 0.4)
- rack-mount (0.8.3)
- rack (>= 1.0.0)
- 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)
rack (>= 1.0)
rack-webconsole (0.1.2)
json
rack
- rails (3.1.0)
- actionmailer (= 3.1.0)
- actionpack (= 3.1.0)
- activerecord (= 3.1.0)
- activeresource (= 3.1.0)
- activesupport (= 3.1.0)
+ rails (3.2.0.rc2)
+ actionmailer (= 3.2.0.rc2)
+ actionpack (= 3.2.0.rc2)
+ activerecord (= 3.2.0.rc2)
+ activeresource (= 3.2.0.rc2)
+ activesupport (= 3.2.0.rc2)
bundler (~> 1.0)
- railties (= 3.1.0)
- railties (3.1.0)
- actionpack (= 3.1.0)
- activesupport (= 3.1.0)
+ railties (= 3.2.0.rc2)
+ railties (3.2.0.rc2)
+ actionpack (= 3.2.0.rc2)
+ activesupport (= 3.2.0.rc2)
rack-ssl (~> 1.3.2)
rake (>= 0.8.7)
rdoc (~> 3.4)
thor (~> 0.14.6)
- rake (0.9.2)
- rdoc (3.9.4)
+ rake (0.9.2.2)
+ rdoc (3.12)
+ json (~> 1.4)
redcarpet (1.17.2)
- rest-client (1.6.1)
- mime-types (>= 1.16)
rpm_contrib (1.0.13)
newrelic_rpm (>= 2.13.1)
- rspec (2.6.0)
- rspec-core (~> 2.6.0)
- rspec-expectations (~> 2.6.0)
- rspec-mocks (~> 2.6.0)
- rspec-core (2.6.4)
- rspec-expectations (2.6.0)
+ 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-instafail (0.1.7)
- rspec-mocks (2.6.0)
- rspec-rails (2.6.0)
- actionpack (~> 3.0)
- activesupport (~> 3.0)
- railties (~> 3.0)
- rspec (~> 2.6.0)
- ruby-openid (2.1.8)
- ruby-openid-apps-discovery (1.2.0)
- ruby-openid (>= 2.1.7)
+ rspec-mocks (2.8.0)
+ rspec-rails (2.8.1)
+ actionpack (>= 3.0)
+ activesupport (>= 3.0)
+ railties (>= 3.0)
+ rspec (~> 2.8.0)
ruby-progressbar (0.0.10)
- rubyntlm (0.1.1)
rubypython (0.5.1)
blankslate (>= 2.1.2.3)
ffi (~> 1.0.7)
- rubyzip (0.9.4)
- sass (3.1.7)
- sass-rails (3.1.2)
- actionpack (~> 3.1.0)
- railties (~> 3.1.0)
- sass (>= 3.1.4)
- sprockets (~> 2.0.0)
- tilt (~> 1.3.2)
- selenium-webdriver (2.8.0)
- childprocess (>= 0.2.1)
- ffi (>= 1.0.7)
- json_pure
+ rubyzip (0.9.5)
+ sass (3.1.12)
+ sass-rails (3.2.3)
+ railties (~> 3.2.0.beta)
+ sass (>= 3.1.10)
+ tilt (~> 1.3)
+ selenium-webdriver (2.17.0)
+ childprocess (>= 0.2.5)
+ ffi (~> 1.0.9)
+ multi_json (~> 1.0.4)
rubyzip
shoulda-matchers (1.0.0.beta3)
spork (0.9.0.rc7)
- sprockets (2.0.0)
+ sprockets (2.1.2)
hike (~> 1.2)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
@@ -290,7 +247,7 @@ PLATFORMS
DEPENDENCIES
arnold!
bson_ext (~> 1.3)
- capybara!
+ capybara
coffee-script
compass (~> 0.12.alpha)
database_cleaner
@@ -311,8 +268,10 @@ DEPENDENCIES
mongoid (~> 2.0)
mongoid_slug
omniauth
+ omniauth-github
+ rack!
rack-webconsole
- rails
+ rails (= 3.2.0.rc2)
rpm_contrib
rspec-rails
sass-rails
View
6 Rakefile
@@ -4,6 +4,7 @@
require File.expand_path('../config/application', __FILE__)
require 'rake'
+require 'rspec/core/rake_task'
Codebrawl::Application.load_tasks
@@ -46,6 +47,11 @@ namespace :codebrawl do
end
end
+desc 'Run all specs in spec directory'
+RSpec::Core::RakeTask.new
+
+task :default => :spec
+
def table(title, content)
output = line
output += content title
View
7 app/controllers/sessions_controller.rb
@@ -2,18 +2,17 @@ class SessionsController < ApplicationController
def create
auth = request.env['omniauth.auth']
-
- parameters = { :login => auth['user_info']['nickname'], :github_id => auth['uid'] }
+ parameters = { :login => auth['info']['nickname'], :github_id => auth['uid'] }
if user = User.first(:conditions => parameters)
user.update_attributes(:token => auth['credentials']['token']) unless user.token?
else
user = User.create(
parameters.
- merge(auth['user_info']).
+ merge(auth['info']).
merge({
:token => auth['credentials']['token'],
- :gravatar_id => auth['extra']['user_hash']['gravatar_id']
+ :gravatar_id => auth['extra']['raw_info']['gravatar_id']
})
)
end
View
1 config/initializers/omniauth.rb
@@ -1,4 +1,5 @@
require 'omniauth'
+require 'omniauth-github'
Rails.application.config.middleware.use OmniAuth::Builder do
provider :github,
View
5 spec/acceptance/acceptance_helper.rb
@@ -1,15 +1,14 @@
require 'spec_helper'
require 'capybara/rspec'
-Capybara.default_host = 'example.org'
OmniAuth.config.test_mode = true
RSpec.configure do |config|
config.before(:each) do
OmniAuth.config.mock_auth[:github] = {
'provider' => 'github',
'uid' => '1763',
- 'user_info' => {
+ 'info' => {
'nickname' => 'charlie',
'email' => 'charlie@email.com',
'name' => 'Charlie Chaplin'
@@ -18,7 +17,7 @@
'token' => 't0k3n'
},
'extra' => {
- 'user_hash' => {
+ 'raw_info' => {
'gravatar_id' => '12345'
}
}
View
28 spec/acceptance/comments_spec.rb
@@ -11,58 +11,58 @@
feature 'Comments' do
context 'when on a contest page which is in the voting period' do
-
+
background do
# TODO: stub `Contest#state` instead setting the voting date
@contest = Fabricate(
:contest,
:entries => [Fabricate.build(:entry_with_files)],
:voting_on => Date.yesterday.to_time
)
-
- visit "contests/#{@contest.slug}"
+
+ visit "/contests/#{@contest.slug}"
login_via_github
end
-
+
scenario 'add a comment via the voting box' do
Gist.expects(:comment).with('866948', 't0k3n', 'Comment!')
fill_in 'Comment', :with => 'Comment!'
click_button 'Vote'
end
-
+
scenario 'do not post a comment when the message is empty' do
Gist.expects(:comment).never
click_button 'Vote'
end
-
+
context 'after voting' do
background do
within("#entry_#{@contest.entries.first.id}"){ choose '3' }
click_button 'Vote'
end
-
+
it_should_behave_like 'an entry with a voting box'
end
end
-
+
context 'when on a finished contest page' do
-
+
background do
# TODO: stub `Contest#state` instead setting the voting date
@contest = Fabricate(
:contest,
:entries => [Fabricate.build(:entry_with_files)],
:closing_on => Date.yesterday.to_time
)
-
- visit "contests/#{@contest.slug}"
+
+ visit "/contests/#{@contest.slug}"
login_via_github
end
-
+
it_should_behave_like 'an entry with a voting box'
-
+
end
-
+
end
View
5 spec/acceptance/contest_index_spec.rb
@@ -17,11 +17,10 @@
]
)
end
-
- visit '/contests'
-
end
+ background { visit '/contests' }
+
scenario 'see links to the contests' do
page.should have_link 'Fun with ChunkyPNG'
end
View
8 spec/acceptance/entries_spec.rb
@@ -26,9 +26,10 @@
background :all do
login_via_github
- visit "/contests/#{@contest.slug}/entries/new"
end
+ background { visit "/contests/#{@contest.slug}/entries/new" }
+
scenario 'fail to add an entry when forgetting the Gist id' do
click_button 'Submit your entry'
page.should have_content 'Gist can\'t be blank'
@@ -53,16 +54,17 @@
:user => @user
)
end
- visit "/contests/#{@contest.slug}"
end
+ background { visit "/contests/#{@contest.slug}" }
+
scenario 'fail to add another entry' do
expect { click_link 'Enter' }.to raise_error Mongoid::Errors::DocumentNotFound
end
context 'when logged in' do
- background(:all) do
+ background do
login_via_github
visit "/contests/#{@contest.slug}"
end
View
4 spec/acceptance/homepage_spec.rb
@@ -26,10 +26,10 @@
:tagline => 'Giving back to RSpec by building the funniest or most useful RSpec formatter',
:starting_on => Date.tomorrow.to_time
)
-
- visit '/'
end
+ background { visit '/' }
+
scenario 'see the "no open contests"-message' do
within('.tip') do
# page.should have_content "Get ready for next week's contest"
View
4 spec/acceptance/login_spec.rb
@@ -47,14 +47,14 @@
OmniAuth.config.mock_auth[:github] = {
'provider' => 'github',
'uid' => '1763',
- 'user_info' => {
+ 'info' => {
'nickname' => 'charlie'
},
'credentials' => {
'token' => 't0k3n'
},
'extra' => {
- 'user_hash' => {
+ 'raw_info' => {
'gravatar_id' => '12345'
}
}
View
5 spec/acceptance/users_spec.rb
@@ -192,11 +192,10 @@
}
]
)
-
- visit '/users/eric'
-
end
+ background { visit '/users/eric' }
+
scenario 'view a user profile' do
page.should have_content 'eric'
end
View
8 spec/acceptance/voting_spec.rb
@@ -11,14 +11,14 @@
:voting_on => Date.yesterday.to_time
)
- visit "contests/#{@contest.slug}"
+ visit "/contests/#{@contest.slug}"
end
scenario 'do not see the voting controls' do
(1..5).to_a.each { |i| page.should have_no_field i.to_s }
page.should have_no_button 'Vote'
end
-
+
scenario 'do not see the entry gist urls' do
page.should have_no_link 'Gist'
body.should_not include 'href="https://gist.github.com/866948"'
@@ -45,7 +45,7 @@
end
end
-
+
scenario 'do not see the entry gist urls' do
page.should have_no_link 'Gist'
body.should_not include 'href="https://gist.github.com/866948"'
@@ -66,7 +66,7 @@
scenario 'see the contestant names' do
page.should have_content 'bob'
end
-
+
scenario 'see the entry gist urls' do
page.should have_link 'Gist'
body.should include 'href="https://gist.github.com/866948"'
Something went wrong with that request. Please try again.