Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'release/0.4.13'

  • Loading branch information...
commit c4febe649cfa7be23c66ba8bb6ee63b5fcd5c682 2 parents f692462 + 9ae2e43
@jeffkreeftmeijer jeffkreeftmeijer authored
View
6 Gemfile
@@ -21,7 +21,7 @@ gem 'mongoid_slug', :require => 'mongoid/slug'
gem 'omniauth'
-gem 'gravtastic', :git => 'git://github.com/jeffkreeftmeijer/gravtastic.git'
+gem 'gravtastic', :git => 'https://github.com/jeffkreeftmeijer/gravtastic.git'
gem 'wufoo'
gem 'gust'
@@ -30,12 +30,12 @@ gem 'rpm_contrib'
gem 'hoptoad_notifier'
gem 'hashr'
-gem 'arnold', :git => 'git://github.com/codebrawl/arnold.git', :branch => 'develop'
+gem 'arnold', :git => 'https://github.com/codebrawl/arnold.git', :branch => 'develop'
group :test do
gem 'rspec-rails'
gem 'shoulda-matchers'
- gem 'capybara', :git => 'git://github.com/jnicklas/capybara.git', :ref => '549e6733'
+ gem 'capybara', :git => 'https://github.com/jnicklas/capybara.git', :ref => '549e6733'
gem 'launchy'
gem 'mocha'
View
16 Gemfile.lock
@@ -1,18 +1,18 @@
GIT
- remote: git://github.com/codebrawl/arnold.git
- revision: 66c5dae2dd51183816114e9e7b584657c222f022
+ remote: https://github.com/codebrawl/arnold.git
+ revision: e8cb6737b810454b0092d7410643ab3f5ea5f4ac
branch: develop
specs:
arnold (0.0)
GIT
- remote: git://github.com/jeffkreeftmeijer/gravtastic.git
+ remote: https://github.com/jeffkreeftmeijer/gravtastic.git
revision: 7b1a678698a0a35aeef3abd1fb8f26501e4e8b68
specs:
gravtastic (2.1.3)
GIT
- remote: git://github.com/jnicklas/capybara.git
+ remote: https://github.com/jnicklas/capybara.git
revision: 549e67336c712a1ef2119ce5ff64dbbc7542480f
ref: 549e6733
specs:
@@ -64,7 +64,7 @@ GEM
bson (1.3.1)
bson_ext (1.3.1)
builder (3.0.0)
- childprocess (0.1.9)
+ childprocess (0.2.2)
ffi (~> 1.0.6)
chunky_png (1.2.4)
coffee-script (2.2.0)
@@ -114,7 +114,7 @@ GEM
railties (~> 3.0)
thor (~> 0.14)
json (1.5.1)
- json_pure (1.5.1)
+ json_pure (1.6.1)
kramdown (0.13.3)
launchy (0.4.0)
configuration (>= 0.0.5)
@@ -248,8 +248,8 @@ GEM
sass (>= 3.1.4)
sprockets (~> 2.0.0)
tilt (~> 1.3.2)
- selenium-webdriver (0.2.0)
- childprocess (>= 0.1.7)
+ selenium-webdriver (2.8.0)
+ childprocess (>= 0.2.1)
ffi (>= 1.0.7)
json_pure
rubyzip
View
4 app/helpers/application_helper.rb
@@ -8,8 +8,8 @@ def avatar_url
def link_to_profile(user)
link_text = image_tag(user.gravatar_url(:size => 20, :default => avatar_url), :class => 'gravatar')
- link_text << " " << user.login
- link_to link_text, user_path(user), :name => user.login
+ link_text << " " << user.name
+ link_to link_text, user_path(user), :name => user.name
end
def clean_url(url)
View
1  app/validators/gist_validator.rb
@@ -6,6 +6,7 @@ def validate(document)
gist = Gist.fetch(document.gist_id)
return document.errors[:gist_id] << "does not exist" unless gist.code == 200
return document.errors[:gist_id] << "can't be anonymous" unless gist['user']
+ return document.errors[:gist_id] << "can't be public" if gist['public']
document.errors[:gist_id] << "is not yours" unless document.user.github_id == gist['user']['id']
end
View
2  app/views/contests/show.haml
@@ -5,7 +5,7 @@
%h1= @contest.name
%footer#submitter
Submitted by
- =link_to @contest.user.login, @contest.user
+ =link_to_profile @contest.user
= raw Kramdown::Document.new(@contest.description).to_html
View
6 spec/acceptance/contests_spec.rb
@@ -77,7 +77,7 @@
:description => 'Write an [RSpec](http://relishapp.com/rspec) extension that solves a problem you are having.',
:starting_on => Date.yesterday.to_time,
:entries => [ Fabricate(:entry_with_files), @entry ],
- :user => Fabricate(:user, :login => 'bob')
+ :user => Fabricate(:user, :login => 'bob', :name => 'Bob')
)
end
end
@@ -88,9 +88,9 @@
end
scenario 'see the contest submitter' do
- page.should have_content 'Submitted by bob'
- page.should have_link 'bob'
+ page.should have_link 'Bob'
body.should include 'href="/users/bob"'
+ body.should include 'avatar/1dae832a3c5ae2702f34ed50a40010e8.png'
end
scenario 'read the markdown contest description' do
View
2  spec/acceptance/login_spec.rb
@@ -5,7 +5,7 @@
scenario 'log in via Github' do
visit '/'
click_link 'log in via Github'
- page.should have_content 'charlie'
+ page.should have_content 'Charlie'
end
scenario 'fail to log in using invalid credentials' do
View
6 spec/fixtures/vcr_cassettes/anonymous_gist.yml
@@ -3,8 +3,8 @@
request: !ruby/struct:VCR::Request
method: :get
uri: https://api.github.com:443/gists/1193213
- body: !!null
- headers: !!null
+ body: !!null
+ headers: !!null
response: !ruby/struct:VCR::Response
status: !ruby/struct:VCR::ResponseStatus
code: 200
@@ -24,5 +24,5 @@
- '4993'
content-length:
- '788'
- body: ! '{"description":"","html_url":"https://gist.github.com/1193213","git_pull_url":"git://gist.github.com/1193213.git","forks":[],"user":null,"git_push_url":"git@gist.github.com:1193213.git","updated_at":"2011-09-04T17:48:03Z","public":true,"files":{"gistfile1.txt":{"filename":"gistfile1.txt","raw_url":"https://gist.github.com/raw/1193213/30d74d258442c7c65512eafab474568dd706c430/gistfile1.txt","content":"test","size":4}},"comments":0,"url":"https://api.github.com/gists/1193213","history":[{"version":"29accdac7783c23db83c79ac4439f2fe9d22f2bf","user":null,"url":"https://api.github.com/gists/1193213/29accdac7783c23db83c79ac4439f2fe9d22f2bf","change_status":{"deletions":0,"additions":1,"total":1},"committed_at":"2011-09-04T17:48:03Z"}],"created_at":"2011-09-04T17:48:03Z","id":"1193213"}'
+ body: ! '{"description":"","html_url":"https://gist.github.com/1193213","git_pull_url":"git://gist.github.com/1193213.git","forks":[],"user":null,"git_push_url":"git@gist.github.com:1193213.git","updated_at":"2011-09-04T17:48:03Z","public":false,"files":{"gistfile1.txt":{"filename":"gistfile1.txt","raw_url":"https://gist.github.com/raw/1193213/30d74d258442c7c65512eafab474568dd706c430/gistfile1.txt","content":"test","size":4}},"comments":0,"url":"https://api.github.com/gists/1193213","history":[{"version":"29accdac7783c23db83c79ac4439f2fe9d22f2bf","user":null,"url":"https://api.github.com/gists/1193213/29accdac7783c23db83c79ac4439f2fe9d22f2bf","change_status":{"deletions":0,"additions":1,"total":1},"committed_at":"2011-09-04T17:48:03Z"}],"created_at":"2011-09-04T17:48:03Z","id":"1193213"}'
http_version: '1.1'
View
62 spec/fixtures/vcr_cassettes/existing_gist.yml
@@ -1,55 +1,55 @@
----
-- !ruby/struct:VCR::HTTPInteraction
- request: !ruby/struct:VCR::Request
+---
+- !ruby/struct:VCR::HTTPInteraction
+ request: !ruby/struct:VCR::Request
method: :get
uri: https://api.github.com:443/gists/866948
- body:
- headers:
- response: !ruby/struct:VCR::Response
- status: !ruby/struct:VCR::ResponseStatus
+ body:
+ headers:
+ response: !ruby/struct:VCR::Response
+ status: !ruby/struct:VCR::ResponseStatus
code: 200
message: OK
- headers:
- x-ratelimit-limit:
+ headers:
+ x-ratelimit-limit:
- "5000"
- content-type:
+ content-type:
- application/json
- date:
+ date:
- Sat, 18 Jun 2011 09:39:43 GMT
- server:
+ server:
- nginx/0.7.67
- content-length:
+ content-length:
- "3106"
- x-ratelimit-remaining:
+ x-ratelimit-remaining:
- "4999"
- status:
+ status:
- 200 OK
- body: "{\"description\":\"\",\"html_url\":\"https://gist.github.com/866948\",\"git_push_url\":\"git@gist.github.com:866948.git\",\"comments\":0,\"public\":true,\"history\":[{\"version\":\"f872880cbe1fbc00d2f667a549fc718303ba8e47\",\"url\":\"https://api.github.com/gists/866948/f872880cbe1fbc00d2f667a549fc718303ba8e47\",\"change_status\":{\"deletions\":47,\"additions\":47,\"total\":94},\"committed_at\":\"2011-03-12T01:55:04Z\",\"user\":{\"avatar_url\":\"https://secure.gravatar.com/avatar/a9c5c1b094da12f51a66b43056493222?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png\",\"url\":\"https://api.github.com/users/charlie\",\"login\":\"charlie\",\"id\":1763}},{\"version\":\"cb28fa08d3be86fb95452083bba18e8900c61ff4\",\"url\":\"https://api.github.com/gists/866948/cb28fa08d3be86fb95452083bba18e8900c61ff4\",\"change_status\":{\"deletions\":0,\"additions\":47,\"total\":47},\"committed_at\":\"2011-03-12T01:54:50Z\",\"user\":{\"avatar_url\":\"https://secure.gravatar.com/avatar/a9c5c1b094da12f51a66b43056493222?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png\",\"url\":\"https://api.github.com/users/charlie\",\"login\":\"charlie\",\"id\":1763}}],\"forks\":[],\"url\":\"https://api.github.com/gists/866948\",\"user\":{\"avatar_url\":\"https://secure.gravatar.com/avatar/a9c5c1b094da12f51a66b43056493222?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png\",\"url\":\"https://api.github.com/users/charlie\",\"login\":\"charlie\",\"id\":1763},\"files\":{\"gistfile1.rb\":{\"content\":\"require 'rubygems'\\nrequire \\\"test/unit\\\"\\nrequire \\\"active_record\\\"\\nrequire \\\"sqlite3\\\"\\n\\nmodule Test::Unit\\n class TestCase\\n def setup\\n $VERBOSE = nil\\n ActiveRecord::Base.establish_connection(:adapter => \\\"sqlite3\\\", :database => \\\"./.test.sqlite3\\\")\\n ActiveRecord::Base.logger = Logger.new(File.join(File.dirname(__FILE__), \\\"test.log\\\"))\\n\\n ActiveRecord::Base.silence do\\n ActiveRecord::Migration.verbose = false\\n ActiveRecord::Schema.define :version => 0 do\\n create_table \\\"users\\\", :force => true do |t|\\n t.integer \\\"id\\\"\\n end\\n create_table \\\"toys\\\", :force => true do |t|\\n t.integer \\\"id\\\"\\n t.integer \\\"user_id\\\"\\n t.text \\\"name\\\"\\n t.text \\\"model\\\"\\n end\\n end\\n end\\n end\\n end\\nend\\n\\nclass User < ActiveRecord::Base\\n has_many :toys\\nend\\n\\nclass Toy < ActiveRecord::Base\\n belongs_to :user\\n attr_accessible :name, :model\\nend\\n\\nclass TheTest < Test::Unit::TestCase\\n def test_find_or_create_by_this_and_that\\n u = User.create\\n software_engineer_barbie = u.toys.create(:name => \\\"Barbie\\\", :model => \\\"Software Engineer\\\")\\n result = u.toys.find_or_create_by_name_and_model(\\\"Barbie\\\", \\\"Software Engineer\\\")\\n assert result.id == software_engineer_barbie.id\\n end\\nend\\n\",\"raw_url\":\"https://gist.github.com/raw/866948/c2df47e7228de05a3a2371f28c6bf804603a7ac6/gistfile1.rb\",\"size\":1280,\"filename\":\"gistfile1.rb\"}},\"id\":\"866948\",\"updated_at\":\"2011-03-12T01:55:07Z\",\"created_at\":\"2011-03-12T01:54:50Z\",\"git_pull_url\":\"git://gist.github.com/866948.git\"}"
+ body: "{\"description\":\"\",\"html_url\":\"https://gist.github.com/866948\",\"git_push_url\":\"git@gist.github.com:866948.git\",\"comments\":0,\"public\":false,\"history\":[{\"version\":\"f872880cbe1fbc00d2f667a549fc718303ba8e47\",\"url\":\"https://api.github.com/gists/866948/f872880cbe1fbc00d2f667a549fc718303ba8e47\",\"change_status\":{\"deletions\":47,\"additions\":47,\"total\":94},\"committed_at\":\"2011-03-12T01:55:04Z\",\"user\":{\"avatar_url\":\"https://secure.gravatar.com/avatar/a9c5c1b094da12f51a66b43056493222?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png\",\"url\":\"https://api.github.com/users/charlie\",\"login\":\"charlie\",\"id\":1763}},{\"version\":\"cb28fa08d3be86fb95452083bba18e8900c61ff4\",\"url\":\"https://api.github.com/gists/866948/cb28fa08d3be86fb95452083bba18e8900c61ff4\",\"change_status\":{\"deletions\":0,\"additions\":47,\"total\":47},\"committed_at\":\"2011-03-12T01:54:50Z\",\"user\":{\"avatar_url\":\"https://secure.gravatar.com/avatar/a9c5c1b094da12f51a66b43056493222?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png\",\"url\":\"https://api.github.com/users/charlie\",\"login\":\"charlie\",\"id\":1763}}],\"forks\":[],\"url\":\"https://api.github.com/gists/866948\",\"user\":{\"avatar_url\":\"https://secure.gravatar.com/avatar/a9c5c1b094da12f51a66b43056493222?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png\",\"url\":\"https://api.github.com/users/charlie\",\"login\":\"charlie\",\"id\":1763},\"files\":{\"gistfile1.rb\":{\"content\":\"require 'rubygems'\\nrequire \\\"test/unit\\\"\\nrequire \\\"active_record\\\"\\nrequire \\\"sqlite3\\\"\\n\\nmodule Test::Unit\\n class TestCase\\n def setup\\n $VERBOSE = nil\\n ActiveRecord::Base.establish_connection(:adapter => \\\"sqlite3\\\", :database => \\\"./.test.sqlite3\\\")\\n ActiveRecord::Base.logger = Logger.new(File.join(File.dirname(__FILE__), \\\"test.log\\\"))\\n\\n ActiveRecord::Base.silence do\\n ActiveRecord::Migration.verbose = false\\n ActiveRecord::Schema.define :version => 0 do\\n create_table \\\"users\\\", :force => true do |t|\\n t.integer \\\"id\\\"\\n end\\n create_table \\\"toys\\\", :force => true do |t|\\n t.integer \\\"id\\\"\\n t.integer \\\"user_id\\\"\\n t.text \\\"name\\\"\\n t.text \\\"model\\\"\\n end\\n end\\n end\\n end\\n end\\nend\\n\\nclass User < ActiveRecord::Base\\n has_many :toys\\nend\\n\\nclass Toy < ActiveRecord::Base\\n belongs_to :user\\n attr_accessible :name, :model\\nend\\n\\nclass TheTest < Test::Unit::TestCase\\n def test_find_or_create_by_this_and_that\\n u = User.create\\n software_engineer_barbie = u.toys.create(:name => \\\"Barbie\\\", :model => \\\"Software Engineer\\\")\\n result = u.toys.find_or_create_by_name_and_model(\\\"Barbie\\\", \\\"Software Engineer\\\")\\n assert result.id == software_engineer_barbie.id\\n end\\nend\\n\",\"raw_url\":\"https://gist.github.com/raw/866948/c2df47e7228de05a3a2371f28c6bf804603a7ac6/gistfile1.rb\",\"size\":1280,\"filename\":\"gistfile1.rb\"}},\"id\":\"866948\",\"updated_at\":\"2011-03-12T01:55:07Z\",\"created_at\":\"2011-03-12T01:54:50Z\",\"git_pull_url\":\"git://gist.github.com/866948.git\"}"
http_version: "1.1"
-- !ruby/struct:VCR::HTTPInteraction
- request: !ruby/struct:VCR::Request
+- !ruby/struct:VCR::HTTPInteraction
+ request: !ruby/struct:VCR::Request
method: :get
uri: https://api.github.com:443/gists/866948
- body:
- headers:
- response: !ruby/struct:VCR::Response
- status: !ruby/struct:VCR::ResponseStatus
+ body:
+ headers:
+ response: !ruby/struct:VCR::Response
+ status: !ruby/struct:VCR::ResponseStatus
code: 200
message: OK
- headers:
- x-ratelimit-limit:
+ headers:
+ x-ratelimit-limit:
- "5000"
- content-type:
+ content-type:
- application/json
- date:
+ date:
- Sat, 18 Jun 2011 09:39:44 GMT
- server:
+ server:
- nginx/0.7.67
- content-length:
+ content-length:
- "3106"
- x-ratelimit-remaining:
+ x-ratelimit-remaining:
- "4998"
- status:
+ status:
- 200 OK
- body: "{\"description\":\"\",\"comments\":0,\"public\":true,\"history\":[{\"change_status\":{\"deletions\":47,\"additions\":47,\"total\":94},\"committed_at\":\"2011-03-12T01:55:04Z\",\"version\":\"f872880cbe1fbc00d2f667a549fc718303ba8e47\",\"url\":\"https://api.github.com/gists/866948/f872880cbe1fbc00d2f667a549fc718303ba8e47\",\"user\":{\"url\":\"https://api.github.com/users/charlie\",\"avatar_url\":\"https://secure.gravatar.com/avatar/a9c5c1b094da12f51a66b43056493222?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png\",\"id\":1763,\"login\":\"charlie\"}},{\"change_status\":{\"deletions\":0,\"additions\":47,\"total\":47},\"committed_at\":\"2011-03-12T01:54:50Z\",\"version\":\"cb28fa08d3be86fb95452083bba18e8900c61ff4\",\"url\":\"https://api.github.com/gists/866948/cb28fa08d3be86fb95452083bba18e8900c61ff4\",\"user\":{\"url\":\"https://api.github.com/users/charlie\",\"avatar_url\":\"https://secure.gravatar.com/avatar/a9c5c1b094da12f51a66b43056493222?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png\",\"id\":1763,\"login\":\"charlie\"}}],\"forks\":[],\"html_url\":\"https://gist.github.com/866948\",\"url\":\"https://api.github.com/gists/866948\",\"git_pull_url\":\"git://gist.github.com/866948.git\",\"user\":{\"url\":\"https://api.github.com/users/charlie\",\"avatar_url\":\"https://secure.gravatar.com/avatar/a9c5c1b094da12f51a66b43056493222?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png\",\"id\":1763,\"login\":\"charlie\"},\"files\":{\"gistfile1.rb\":{\"content\":\"require 'rubygems'\\nrequire \\\"test/unit\\\"\\nrequire \\\"active_record\\\"\\nrequire \\\"sqlite3\\\"\\n\\nmodule Test::Unit\\n class TestCase\\n def setup\\n $VERBOSE = nil\\n ActiveRecord::Base.establish_connection(:adapter => \\\"sqlite3\\\", :database => \\\"./.test.sqlite3\\\")\\n ActiveRecord::Base.logger = Logger.new(File.join(File.dirname(__FILE__), \\\"test.log\\\"))\\n\\n ActiveRecord::Base.silence do\\n ActiveRecord::Migration.verbose = false\\n ActiveRecord::Schema.define :version => 0 do\\n create_table \\\"users\\\", :force => true do |t|\\n t.integer \\\"id\\\"\\n end\\n create_table \\\"toys\\\", :force => true do |t|\\n t.integer \\\"id\\\"\\n t.integer \\\"user_id\\\"\\n t.text \\\"name\\\"\\n t.text \\\"model\\\"\\n end\\n end\\n end\\n end\\n end\\nend\\n\\nclass User < ActiveRecord::Base\\n has_many :toys\\nend\\n\\nclass Toy < ActiveRecord::Base\\n belongs_to :user\\n attr_accessible :name, :model\\nend\\n\\nclass TheTest < Test::Unit::TestCase\\n def test_find_or_create_by_this_and_that\\n u = User.create\\n software_engineer_barbie = u.toys.create(:name => \\\"Barbie\\\", :model => \\\"Software Engineer\\\")\\n result = u.toys.find_or_create_by_name_and_model(\\\"Barbie\\\", \\\"Software Engineer\\\")\\n assert result.id == software_engineer_barbie.id\\n end\\nend\\n\",\"raw_url\":\"https://gist.github.com/raw/866948/c2df47e7228de05a3a2371f28c6bf804603a7ac6/gistfile1.rb\",\"size\":1280,\"filename\":\"gistfile1.rb\"}},\"git_push_url\":\"git@gist.github.com:866948.git\",\"id\":\"866948\",\"updated_at\":\"2011-03-12T01:55:07Z\",\"created_at\":\"2011-03-12T01:54:50Z\"}"
+ body: "{\"description\":\"\",\"comments\":0,\"public\":false,\"history\":[{\"change_status\":{\"deletions\":47,\"additions\":47,\"total\":94},\"committed_at\":\"2011-03-12T01:55:04Z\",\"version\":\"f872880cbe1fbc00d2f667a549fc718303ba8e47\",\"url\":\"https://api.github.com/gists/866948/f872880cbe1fbc00d2f667a549fc718303ba8e47\",\"user\":{\"url\":\"https://api.github.com/users/charlie\",\"avatar_url\":\"https://secure.gravatar.com/avatar/a9c5c1b094da12f51a66b43056493222?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png\",\"id\":1763,\"login\":\"charlie\"}},{\"change_status\":{\"deletions\":0,\"additions\":47,\"total\":47},\"committed_at\":\"2011-03-12T01:54:50Z\",\"version\":\"cb28fa08d3be86fb95452083bba18e8900c61ff4\",\"url\":\"https://api.github.com/gists/866948/cb28fa08d3be86fb95452083bba18e8900c61ff4\",\"user\":{\"url\":\"https://api.github.com/users/charlie\",\"avatar_url\":\"https://secure.gravatar.com/avatar/a9c5c1b094da12f51a66b43056493222?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png\",\"id\":1763,\"login\":\"charlie\"}}],\"forks\":[],\"html_url\":\"https://gist.github.com/866948\",\"url\":\"https://api.github.com/gists/866948\",\"git_pull_url\":\"git://gist.github.com/866948.git\",\"user\":{\"url\":\"https://api.github.com/users/charlie\",\"avatar_url\":\"https://secure.gravatar.com/avatar/a9c5c1b094da12f51a66b43056493222?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png\",\"id\":1763,\"login\":\"charlie\"},\"files\":{\"gistfile1.rb\":{\"content\":\"require 'rubygems'\\nrequire \\\"test/unit\\\"\\nrequire \\\"active_record\\\"\\nrequire \\\"sqlite3\\\"\\n\\nmodule Test::Unit\\n class TestCase\\n def setup\\n $VERBOSE = nil\\n ActiveRecord::Base.establish_connection(:adapter => \\\"sqlite3\\\", :database => \\\"./.test.sqlite3\\\")\\n ActiveRecord::Base.logger = Logger.new(File.join(File.dirname(__FILE__), \\\"test.log\\\"))\\n\\n ActiveRecord::Base.silence do\\n ActiveRecord::Migration.verbose = false\\n ActiveRecord::Schema.define :version => 0 do\\n create_table \\\"users\\\", :force => true do |t|\\n t.integer \\\"id\\\"\\n end\\n create_table \\\"toys\\\", :force => true do |t|\\n t.integer \\\"id\\\"\\n t.integer \\\"user_id\\\"\\n t.text \\\"name\\\"\\n t.text \\\"model\\\"\\n end\\n end\\n end\\n end\\n end\\nend\\n\\nclass User < ActiveRecord::Base\\n has_many :toys\\nend\\n\\nclass Toy < ActiveRecord::Base\\n belongs_to :user\\n attr_accessible :name, :model\\nend\\n\\nclass TheTest < Test::Unit::TestCase\\n def test_find_or_create_by_this_and_that\\n u = User.create\\n software_engineer_barbie = u.toys.create(:name => \\\"Barbie\\\", :model => \\\"Software Engineer\\\")\\n result = u.toys.find_or_create_by_name_and_model(\\\"Barbie\\\", \\\"Software Engineer\\\")\\n assert result.id == software_engineer_barbie.id\\n end\\nend\\n\",\"raw_url\":\"https://gist.github.com/raw/866948/c2df47e7228de05a3a2371f28c6bf804603a7ac6/gistfile1.rb\",\"size\":1280,\"filename\":\"gistfile1.rb\"}},\"git_push_url\":\"git@gist.github.com:866948.git\",\"id\":\"866948\",\"updated_at\":\"2011-03-12T01:55:07Z\",\"created_at\":\"2011-03-12T01:54:50Z\"}"
http_version: "1.1"
View
6 spec/fixtures/vcr_cassettes/random_gist.yml
@@ -3,8 +3,8 @@
request: !ruby/struct:VCR::Request
method: :get
uri: https://api.github.com:443/gists/12345
- body: !!null
- headers: !!null
+ body: !!null
+ headers: !!null
response: !ruby/struct:VCR::Response
status: !ruby/struct:VCR::ResponseStatus
code: 200
@@ -32,5 +32,5 @@
block.\r\n ~ No database.yml file found in /Users/jdempsey/testbed/dm_test/config,
assuming database connection(s) established in the environment file in /Users/jdempsey/testbed/dm_test/config/environments\r\n
~ Checking if we need to use DataMapper sessions\r\n ~ Merb::Orms::DataMapper::Connect
- complete\r\n ~ Compiling routes...\r\n ~ Starting Merb server listening at 0.0.0.0:4000\r\n","size":734,"raw_url":"https://gist.github.com/raw/12345/1380168c2b5ea8616f09eeb50e8c3417e24453a8/gistfile1.txt"}},"html_url":"https://gist.github.com/12345","user":{"url":"https://api.github.com/users/jackdempsey","avatar_url":"https://secure.gravatar.com/avatar/1ccb5123d1af92e24b32cec62abcf9a8?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","login":"jackdempsey","id":479},"public":true,"comments":0,"description":null,"history":[{"version":"a714a381787af0f56e86d12be63e0336bf0eea19","url":"https://api.github.com/gists/12345/a714a381787af0f56e86d12be63e0336bf0eea19","user":null,"change_status":{"deletions":0,"additions":13,"total":13},"committed_at":"2008-09-23T17:13:04Z"}],"id":"12345","updated_at":"2009-10-14T11:53:04Z","created_at":"2008-09-23T17:13:04Z"}'
+ complete\r\n ~ Compiling routes...\r\n ~ Starting Merb server listening at 0.0.0.0:4000\r\n","size":734,"raw_url":"https://gist.github.com/raw/12345/1380168c2b5ea8616f09eeb50e8c3417e24453a8/gistfile1.txt"}},"html_url":"https://gist.github.com/12345","user":{"url":"https://api.github.com/users/jackdempsey","avatar_url":"https://secure.gravatar.com/avatar/1ccb5123d1af92e24b32cec62abcf9a8?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","login":"jackdempsey","id":479},"public":false,"comments":0,"description":null,"history":[{"version":"a714a381787af0f56e86d12be63e0336bf0eea19","url":"https://api.github.com/gists/12345/a714a381787af0f56e86d12be63e0336bf0eea19","user":null,"change_status":{"deletions":0,"additions":13,"total":13},"committed_at":"2008-09-23T17:13:04Z"}],"id":"12345","updated_at":"2009-10-14T11:53:04Z","created_at":"2008-09-23T17:13:04Z"}'
http_version: '1.1'
View
8 spec/helpers/application_helper_spec.rb
@@ -3,7 +3,11 @@
describe ApplicationHelper do
describe "link_to_profile" do
before :each do
- @user = stub(:login => 'charlie', :to_param => 'charlie', :gravatar_url => 'http://gravatar.org/profile.png')
+ @user = stub(
+ :name => 'Charlie',
+ :to_param => 'charlie',
+ :gravatar_url => 'http://gravatar.org/profile.png'
+ )
end
let(:output) { helper.link_to_profile(@user) }
@@ -14,7 +18,7 @@
end
it "should include the username" do
- output.should include("charlie")
+ output.should include("Charlie")
end
it "should html escape the username" do
View
2  spec/lib/gist_spec.rb
@@ -53,7 +53,7 @@
subject{ VCR.use_cassette('random_gist') { Gist.fetch('12345').body } }
it 'should contain the raw response body' do
- should == "{\"git_pull_url\":\"git://gist.github.com/12345.git\",\"url\":\"https://api.github.com/gists/12345\",\"forks\":[],\"git_push_url\":\"git@gist.github.com:12345.git\",\"files\":{\"gistfile1.txt\":{\"filename\":\"gistfile1.txt\",\"content\":\"~/testbed/dm_test $ rake dm:db:database_yaml\\r\\n(in /Users/jdempsey/testbed/dm_test)\\r\\n/Users/jdempsey/testbed/dm_test/config/init.rb:1: warning: already initialized constant KCODE\\r\\n ~ Loaded DEVELOPMENT Environment...\\r\\n ~ loading gem 'merb_datamapper' ...\\r\\n ~ loading gem 'dm-core' ...\\r\\n ~ loading gem 'merb_datamapper' ...\\r\\n ~ Merb::Orms::DataMapper::Connect block.\\r\\n ~ No database.yml file found in /Users/jdempsey/testbed/dm_test/config, assuming database connection(s) established in the environment file in /Users/jdempsey/testbed/dm_test/config/environments\\r\\n ~ Checking if we need to use DataMapper sessions\\r\\n ~ Merb::Orms::DataMapper::Connect complete\\r\\n ~ Compiling routes...\\r\\n ~ Starting Merb server listening at 0.0.0.0:4000\\r\\n\",\"size\":734,\"raw_url\":\"https://gist.github.com/raw/12345/1380168c2b5ea8616f09eeb50e8c3417e24453a8/gistfile1.txt\"}},\"html_url\":\"https://gist.github.com/12345\",\"user\":{\"url\":\"https://api.github.com/users/jackdempsey\",\"avatar_url\":\"https://secure.gravatar.com/avatar/1ccb5123d1af92e24b32cec62abcf9a8?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png\",\"login\":\"jackdempsey\",\"id\":479},\"public\":true,\"comments\":0,\"description\":null,\"history\":[{\"version\":\"a714a381787af0f56e86d12be63e0336bf0eea19\",\"url\":\"https://api.github.com/gists/12345/a714a381787af0f56e86d12be63e0336bf0eea19\",\"user\":null,\"change_status\":{\"deletions\":0,\"additions\":13,\"total\":13},\"committed_at\":\"2008-09-23T17:13:04Z\"}],\"id\":\"12345\",\"updated_at\":\"2009-10-14T11:53:04Z\",\"created_at\":\"2008-09-23T17:13:04Z\"}"
+ should == "{\"git_pull_url\":\"git://gist.github.com/12345.git\",\"url\":\"https://api.github.com/gists/12345\",\"forks\":[],\"git_push_url\":\"git@gist.github.com:12345.git\",\"files\":{\"gistfile1.txt\":{\"filename\":\"gistfile1.txt\",\"content\":\"~/testbed/dm_test $ rake dm:db:database_yaml\\r\\n(in /Users/jdempsey/testbed/dm_test)\\r\\n/Users/jdempsey/testbed/dm_test/config/init.rb:1: warning: already initialized constant KCODE\\r\\n ~ Loaded DEVELOPMENT Environment...\\r\\n ~ loading gem 'merb_datamapper' ...\\r\\n ~ loading gem 'dm-core' ...\\r\\n ~ loading gem 'merb_datamapper' ...\\r\\n ~ Merb::Orms::DataMapper::Connect block.\\r\\n ~ No database.yml file found in /Users/jdempsey/testbed/dm_test/config, assuming database connection(s) established in the environment file in /Users/jdempsey/testbed/dm_test/config/environments\\r\\n ~ Checking if we need to use DataMapper sessions\\r\\n ~ Merb::Orms::DataMapper::Connect complete\\r\\n ~ Compiling routes...\\r\\n ~ Starting Merb server listening at 0.0.0.0:4000\\r\\n\",\"size\":734,\"raw_url\":\"https://gist.github.com/raw/12345/1380168c2b5ea8616f09eeb50e8c3417e24453a8/gistfile1.txt\"}},\"html_url\":\"https://gist.github.com/12345\",\"user\":{\"url\":\"https://api.github.com/users/jackdempsey\",\"avatar_url\":\"https://secure.gravatar.com/avatar/1ccb5123d1af92e24b32cec62abcf9a8?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png\",\"login\":\"jackdempsey\",\"id\":479},\"public\":false,\"comments\":0,\"description\":null,\"history\":[{\"version\":\"a714a381787af0f56e86d12be63e0336bf0eea19\",\"url\":\"https://api.github.com/gists/12345/a714a381787af0f56e86d12be63e0336bf0eea19\",\"user\":null,\"change_status\":{\"deletions\":0,\"additions\":13,\"total\":13},\"committed_at\":\"2008-09-23T17:13:04Z\"}],\"id\":\"12345\",\"updated_at\":\"2009-10-14T11:53:04Z\",\"created_at\":\"2008-09-23T17:13:04Z\"}"
end
end
View
19 spec/validators/gist_validator_spec.rb
@@ -13,7 +13,7 @@ class ObjectWithGist
before do
Gist.stubs(:fetch).returns(
- Gist.new(200, '{"user": {"id": 12345}}')
+ Gist.new(200, '{"public":false, "user": {"id": 12345}}')
)
end
@@ -70,11 +70,26 @@ class ObjectWithGist
end
+ context 'with a public gist' do
+ before do
+ Gist.stubs(:fetch).returns(Gist.new(200, '{"public":true, "user": {"id": 54321}}'))
+ object.valid?
+ end
+
+ it { should have(1).error_on(:gist_id) }
+
+ context 'the error' do
+ subject { object.errors[:gist_id].first }
+
+ it { should == "can't be public" }
+ end
+ end
+
context 'with a gist that does not belong to the user' do
before do
- Gist.stubs(:fetch).returns(Gist.new(200, '{"user": {"id": 54321}}'))
+ Gist.stubs(:fetch).returns(Gist.new(200, '{"public":false, "user": {"id": 54321}}'))
object.valid?
end
Please sign in to comment.
Something went wrong with that request. Please try again.