Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Merge branch 'release/0.4.13'

  • Loading branch information...
commit c4febe649cfa7be23c66ba8bb6ee63b5fcd5c682 2 parents f692462 + 9ae2e43
Jeff Kreeftmeijer jeffkreeftmeijer authored
6 Gemfile
@@ -21,7 +21,7 @@ gem 'mongoid_slug', :require => 'mongoid/slug'
21 21
22 22 gem 'omniauth'
23 23
24   -gem 'gravtastic', :git => 'git://github.com/jeffkreeftmeijer/gravtastic.git'
  24 +gem 'gravtastic', :git => 'https://github.com/jeffkreeftmeijer/gravtastic.git'
25 25
26 26 gem 'wufoo'
27 27 gem 'gust'
@@ -30,12 +30,12 @@ gem 'rpm_contrib'
30 30 gem 'hoptoad_notifier'
31 31
32 32 gem 'hashr'
33   -gem 'arnold', :git => 'git://github.com/codebrawl/arnold.git', :branch => 'develop'
  33 +gem 'arnold', :git => 'https://github.com/codebrawl/arnold.git', :branch => 'develop'
34 34
35 35 group :test do
36 36 gem 'rspec-rails'
37 37 gem 'shoulda-matchers'
38   - gem 'capybara', :git => 'git://github.com/jnicklas/capybara.git', :ref => '549e6733'
  38 + gem 'capybara', :git => 'https://github.com/jnicklas/capybara.git', :ref => '549e6733'
39 39 gem 'launchy'
40 40
41 41 gem 'mocha'
16 Gemfile.lock
... ... @@ -1,18 +1,18 @@
1 1 GIT
2   - remote: git://github.com/codebrawl/arnold.git
3   - revision: 66c5dae2dd51183816114e9e7b584657c222f022
  2 + remote: https://github.com/codebrawl/arnold.git
  3 + revision: e8cb6737b810454b0092d7410643ab3f5ea5f4ac
4 4 branch: develop
5 5 specs:
6 6 arnold (0.0)
7 7
8 8 GIT
9   - remote: git://github.com/jeffkreeftmeijer/gravtastic.git
  9 + remote: https://github.com/jeffkreeftmeijer/gravtastic.git
10 10 revision: 7b1a678698a0a35aeef3abd1fb8f26501e4e8b68
11 11 specs:
12 12 gravtastic (2.1.3)
13 13
14 14 GIT
15   - remote: git://github.com/jnicklas/capybara.git
  15 + remote: https://github.com/jnicklas/capybara.git
16 16 revision: 549e67336c712a1ef2119ce5ff64dbbc7542480f
17 17 ref: 549e6733
18 18 specs:
@@ -64,7 +64,7 @@ GEM
64 64 bson (1.3.1)
65 65 bson_ext (1.3.1)
66 66 builder (3.0.0)
67   - childprocess (0.1.9)
  67 + childprocess (0.2.2)
68 68 ffi (~> 1.0.6)
69 69 chunky_png (1.2.4)
70 70 coffee-script (2.2.0)
@@ -114,7 +114,7 @@ GEM
114 114 railties (~> 3.0)
115 115 thor (~> 0.14)
116 116 json (1.5.1)
117   - json_pure (1.5.1)
  117 + json_pure (1.6.1)
118 118 kramdown (0.13.3)
119 119 launchy (0.4.0)
120 120 configuration (>= 0.0.5)
@@ -248,8 +248,8 @@ GEM
248 248 sass (>= 3.1.4)
249 249 sprockets (~> 2.0.0)
250 250 tilt (~> 1.3.2)
251   - selenium-webdriver (0.2.0)
252   - childprocess (>= 0.1.7)
  251 + selenium-webdriver (2.8.0)
  252 + childprocess (>= 0.2.1)
253 253 ffi (>= 1.0.7)
254 254 json_pure
255 255 rubyzip
4 app/helpers/application_helper.rb
@@ -8,8 +8,8 @@ def avatar_url
8 8
9 9 def link_to_profile(user)
10 10 link_text = image_tag(user.gravatar_url(:size => 20, :default => avatar_url), :class => 'gravatar')
11   - link_text << " " << user.login
12   - link_to link_text, user_path(user), :name => user.login
  11 + link_text << " " << user.name
  12 + link_to link_text, user_path(user), :name => user.name
13 13 end
14 14
15 15 def clean_url(url)
1  app/validators/gist_validator.rb
@@ -6,6 +6,7 @@ def validate(document)
6 6 gist = Gist.fetch(document.gist_id)
7 7 return document.errors[:gist_id] << "does not exist" unless gist.code == 200
8 8 return document.errors[:gist_id] << "can't be anonymous" unless gist['user']
  9 + return document.errors[:gist_id] << "can't be public" if gist['public']
9 10 document.errors[:gist_id] << "is not yours" unless document.user.github_id == gist['user']['id']
10 11 end
11 12
2  app/views/contests/show.haml
@@ -5,7 +5,7 @@
5 5 %h1= @contest.name
6 6 %footer#submitter
7 7 Submitted by
8   - =link_to @contest.user.login, @contest.user
  8 + =link_to_profile @contest.user
9 9
10 10 = raw Kramdown::Document.new(@contest.description).to_html
11 11
6 spec/acceptance/contests_spec.rb
@@ -77,7 +77,7 @@
77 77 :description => 'Write an [RSpec](http://relishapp.com/rspec) extension that solves a problem you are having.',
78 78 :starting_on => Date.yesterday.to_time,
79 79 :entries => [ Fabricate(:entry_with_files), @entry ],
80   - :user => Fabricate(:user, :login => 'bob')
  80 + :user => Fabricate(:user, :login => 'bob', :name => 'Bob')
81 81 )
82 82 end
83 83 end
@@ -88,9 +88,9 @@
88 88 end
89 89
90 90 scenario 'see the contest submitter' do
91   - page.should have_content 'Submitted by bob'
92   - page.should have_link 'bob'
  91 + page.should have_link 'Bob'
93 92 body.should include 'href="/users/bob"'
  93 + body.should include 'avatar/1dae832a3c5ae2702f34ed50a40010e8.png'
94 94 end
95 95
96 96 scenario 'read the markdown contest description' do
2  spec/acceptance/login_spec.rb
@@ -5,7 +5,7 @@
5 5 scenario 'log in via Github' do
6 6 visit '/'
7 7 click_link 'log in via Github'
8   - page.should have_content 'charlie'
  8 + page.should have_content 'Charlie'
9 9 end
10 10
11 11 scenario 'fail to log in using invalid credentials' do
6 spec/fixtures/vcr_cassettes/anonymous_gist.yml
@@ -3,8 +3,8 @@
3 3 request: !ruby/struct:VCR::Request
4 4 method: :get
5 5 uri: https://api.github.com:443/gists/1193213
6   - body: !!null
7   - headers: !!null
  6 + body: !!null
  7 + headers: !!null
8 8 response: !ruby/struct:VCR::Response
9 9 status: !ruby/struct:VCR::ResponseStatus
10 10 code: 200
@@ -24,5 +24,5 @@
24 24 - '4993'
25 25 content-length:
26 26 - '788'
27   - 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"}'
  27 + 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"}'
28 28 http_version: '1.1'
62 spec/fixtures/vcr_cassettes/existing_gist.yml
... ... @@ -1,55 +1,55 @@
1   ----
2   -- !ruby/struct:VCR::HTTPInteraction
3   - request: !ruby/struct:VCR::Request
  1 +---
  2 +- !ruby/struct:VCR::HTTPInteraction
  3 + request: !ruby/struct:VCR::Request
4 4 method: :get
5 5 uri: https://api.github.com:443/gists/866948
6   - body:
7   - headers:
8   - response: !ruby/struct:VCR::Response
9   - status: !ruby/struct:VCR::ResponseStatus
  6 + body:
  7 + headers:
  8 + response: !ruby/struct:VCR::Response
  9 + status: !ruby/struct:VCR::ResponseStatus
10 10 code: 200
11 11 message: OK
12   - headers:
13   - x-ratelimit-limit:
  12 + headers:
  13 + x-ratelimit-limit:
14 14 - "5000"
15   - content-type:
  15 + content-type:
16 16 - application/json
17   - date:
  17 + date:
18 18 - Sat, 18 Jun 2011 09:39:43 GMT
19   - server:
  19 + server:
20 20 - nginx/0.7.67
21   - content-length:
  21 + content-length:
22 22 - "3106"
23   - x-ratelimit-remaining:
  23 + x-ratelimit-remaining:
24 24 - "4999"
25   - status:
  25 + status:
26 26 - 200 OK
27   - 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\"}"
  27 + 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\"}"
28 28 http_version: "1.1"
29   -- !ruby/struct:VCR::HTTPInteraction
30   - request: !ruby/struct:VCR::Request
  29 +- !ruby/struct:VCR::HTTPInteraction
  30 + request: !ruby/struct:VCR::Request
31 31 method: :get
32 32 uri: https://api.github.com:443/gists/866948
33   - body:
34   - headers:
35   - response: !ruby/struct:VCR::Response
36   - status: !ruby/struct:VCR::ResponseStatus
  33 + body:
  34 + headers:
  35 + response: !ruby/struct:VCR::Response
  36 + status: !ruby/struct:VCR::ResponseStatus
37 37 code: 200
38 38 message: OK
39   - headers:
40   - x-ratelimit-limit:
  39 + headers:
  40 + x-ratelimit-limit:
41 41 - "5000"
42   - content-type:
  42 + content-type:
43 43 - application/json
44   - date:
  44 + date:
45 45 - Sat, 18 Jun 2011 09:39:44 GMT
46   - server:
  46 + server:
47 47 - nginx/0.7.67
48   - content-length:
  48 + content-length:
49 49 - "3106"
50   - x-ratelimit-remaining:
  50 + x-ratelimit-remaining:
51 51 - "4998"
52   - status:
  52 + status:
53 53 - 200 OK
54   - 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\"}"
  54 + 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\"}"
55 55 http_version: "1.1"
6 spec/fixtures/vcr_cassettes/random_gist.yml
@@ -3,8 +3,8 @@
3 3 request: !ruby/struct:VCR::Request
4 4 method: :get
5 5 uri: https://api.github.com:443/gists/12345
6   - body: !!null
7   - headers: !!null
  6 + body: !!null
  7 + headers: !!null
8 8 response: !ruby/struct:VCR::Response
9 9 status: !ruby/struct:VCR::ResponseStatus
10 10 code: 200
@@ -32,5 +32,5 @@
32 32 block.\r\n ~ No database.yml file found in /Users/jdempsey/testbed/dm_test/config,
33 33 assuming database connection(s) established in the environment file in /Users/jdempsey/testbed/dm_test/config/environments\r\n
34 34 ~ Checking if we need to use DataMapper sessions\r\n ~ Merb::Orms::DataMapper::Connect
35   - 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"}'
  35 + 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"}'
36 36 http_version: '1.1'
8 spec/helpers/application_helper_spec.rb
@@ -3,7 +3,11 @@
3 3 describe ApplicationHelper do
4 4 describe "link_to_profile" do
5 5 before :each do
6   - @user = stub(:login => 'charlie', :to_param => 'charlie', :gravatar_url => 'http://gravatar.org/profile.png')
  6 + @user = stub(
  7 + :name => 'Charlie',
  8 + :to_param => 'charlie',
  9 + :gravatar_url => 'http://gravatar.org/profile.png'
  10 + )
7 11 end
8 12
9 13 let(:output) { helper.link_to_profile(@user) }
@@ -14,7 +18,7 @@
14 18 end
15 19
16 20 it "should include the username" do
17   - output.should include("charlie")
  21 + output.should include("Charlie")
18 22 end
19 23
20 24 it "should html escape the username" do
2  spec/lib/gist_spec.rb
@@ -53,7 +53,7 @@
53 53 subject{ VCR.use_cassette('random_gist') { Gist.fetch('12345').body } }
54 54
55 55 it 'should contain the raw response body' do
56   - 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\"}"
  56 + 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\"}"
57 57 end
58 58
59 59 end
19 spec/validators/gist_validator_spec.rb
@@ -13,7 +13,7 @@ class ObjectWithGist
13 13
14 14 before do
15 15 Gist.stubs(:fetch).returns(
16   - Gist.new(200, '{"user": {"id": 12345}}')
  16 + Gist.new(200, '{"public":false, "user": {"id": 12345}}')
17 17 )
18 18 end
19 19
@@ -70,11 +70,26 @@ class ObjectWithGist
70 70
71 71 end
72 72
  73 + context 'with a public gist' do
  74 + before do
  75 + Gist.stubs(:fetch).returns(Gist.new(200, '{"public":true, "user": {"id": 54321}}'))
  76 + object.valid?
  77 + end
  78 +
  79 + it { should have(1).error_on(:gist_id) }
  80 +
  81 + context 'the error' do
  82 + subject { object.errors[:gist_id].first }
  83 +
  84 + it { should == "can't be public" }
  85 + end
  86 + end
  87 +
73 88
74 89 context 'with a gist that does not belong to the user' do
75 90
76 91 before do
77   - Gist.stubs(:fetch).returns(Gist.new(200, '{"user": {"id": 54321}}'))
  92 + Gist.stubs(:fetch).returns(Gist.new(200, '{"public":false, "user": {"id": 54321}}'))
78 93 object.valid?
79 94 end
80 95

0 comments on commit c4febe6

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