Skip to content

Instantly share code, notes, and snippets.

@gregspurrier
Created October 5, 2011 16:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gregspurrier/1264972 to your computer and use it in GitHub Desktop.
Save gregspurrier/1264972 to your computer and use it in GitHub Desktop.
Anonymous controller bug?
gspurrie-mn:proj% rvm use ruby-1.8.7@rspec_bug --create
Using /Users/gspurrie/.rvm/gems/ruby-1.8.7-p352 with gemset rspec_bug
gspurrie-mn:proj% gem install bundler
Fetching: bundler-1.0.21.gem (100%)1.0.21.gem
Successfully installed bundler-1.0.21
1 gem installed
Installing ri documentation for bundler-1.0.21...
Installing RDoc documentation for bundler-1.0.21...
gspurrie-mn:proj% gem install rails
Fetching: multi_json-1.0.3.gem (100%)
Fetching: activesupport-3.1.0.gem (100%)
Fetching: builder-3.0.0.gem (100%)
Fetching: i18n-0.6.0.gem (100%)
Fetching: bcrypt-ruby-3.0.1.gem (100%)
Building native extensions. This could take a while...
Fetching: activemodel-3.1.0.gem (100%)
Fetching: rack-1.3.4.gem (100%)
Fetching: rack-cache-1.0.3.gem (100%)
Fetching: rack-test-0.6.1.gem (100%)
Fetching: rack-mount-0.8.3.gem (100%)
Fetching: hike-1.2.1.gem (100%)
Fetching: tilt-1.3.3.gem (100%)
Fetching: sprockets-2.0.2.gem (100%)
Fetching: erubis-2.7.0.gem (100%)
Fetching: actionpack-3.1.0.gem (100%)
Fetching: arel-2.2.1.gem (100%)
Fetching: tzinfo-0.3.30.gem (100%)
Fetching: activerecord-3.1.0.gem (100%)
Fetching: activeresource-3.1.0.gem (100%)
Fetching: mime-types-1.16.gem (100%)
Fetching: polyglot-0.3.2.gem (100%)
Fetching: treetop-1.4.10.gem (100%)
Fetching: mail-2.3.0.gem (100%)
Fetching: actionmailer-3.1.0.gem (100%)
Fetching: thor-0.14.6.gem (100%)
Fetching: rack-ssl-1.3.2.gem (100%)
Fetching: rdoc-3.9.4.gem (100%)
Depending on your version of ruby, you may need to install ruby rdoc/ri data:
<= 1.8.6 : unsupported
= 1.8.7 : gem install rdoc-data; rdoc-data --install
= 1.9.1 : gem install rdoc-data; rdoc-data --install
>= 1.9.2 : nothing to do! Yay!
Fetching: railties-3.1.0.gem (100%)
Fetching: rails-3.1.0.gem (100%)
Successfully installed multi_json-1.0.3
Successfully installed activesupport-3.1.0
Successfully installed builder-3.0.0
Successfully installed i18n-0.6.0
Successfully installed bcrypt-ruby-3.0.1
Successfully installed activemodel-3.1.0
Successfully installed rack-1.3.4
Successfully installed rack-cache-1.0.3
Successfully installed rack-test-0.6.1
Successfully installed rack-mount-0.8.3
Successfully installed hike-1.2.1
Successfully installed tilt-1.3.3
Successfully installed sprockets-2.0.2
Successfully installed erubis-2.7.0
Successfully installed actionpack-3.1.0
Successfully installed arel-2.2.1
Successfully installed tzinfo-0.3.30
Successfully installed activerecord-3.1.0
Successfully installed activeresource-3.1.0
Successfully installed mime-types-1.16
Successfully installed polyglot-0.3.2
Successfully installed treetop-1.4.10
Successfully installed mail-2.3.0
Successfully installed actionmailer-3.1.0
Successfully installed thor-0.14.6
Successfully installed rack-ssl-1.3.2
Successfully installed rdoc-3.9.4
Successfully installed railties-3.1.0
Successfully installed rails-3.1.0
29 gems installed
Installing ri documentation for multi_json-1.0.3...
Installing ri documentation for activesupport-3.1.0...
Installing ri documentation for builder-3.0.0...
Installing ri documentation for i18n-0.6.0...
Installing ri documentation for bcrypt-ruby-3.0.1...
Installing ri documentation for activemodel-3.1.0...
Installing ri documentation for rack-1.3.4...
Installing ri documentation for rack-cache-1.0.3...
Installing ri documentation for rack-test-0.6.1...
Installing ri documentation for rack-mount-0.8.3...
Installing ri documentation for hike-1.2.1...
Installing ri documentation for tilt-1.3.3...
Installing ri documentation for sprockets-2.0.2...
Installing ri documentation for erubis-2.7.0...
Installing ri documentation for actionpack-3.1.0...
Installing ri documentation for arel-2.2.1...
Installing ri documentation for tzinfo-0.3.30...
Installing ri documentation for activerecord-3.1.0...
Installing ri documentation for activeresource-3.1.0...
Installing ri documentation for mime-types-1.16...
Installing ri documentation for polyglot-0.3.2...
Installing ri documentation for treetop-1.4.10...
Installing ri documentation for mail-2.3.0...
Installing ri documentation for actionmailer-3.1.0...
Installing ri documentation for thor-0.14.6...
Installing ri documentation for rack-ssl-1.3.2...
Installing ri documentation for rdoc-3.9.4...
Installing ri documentation for railties-3.1.0...
Installing ri documentation for rails-3.1.0...
file 'lib' not found
Installing RDoc documentation for multi_json-1.0.3...
Installing RDoc documentation for activesupport-3.1.0...
Installing RDoc documentation for builder-3.0.0...
Installing RDoc documentation for i18n-0.6.0...
Installing RDoc documentation for bcrypt-ruby-3.0.1...
Installing RDoc documentation for activemodel-3.1.0...
Installing RDoc documentation for rack-1.3.4...
Installing RDoc documentation for rack-cache-1.0.3...
Installing RDoc documentation for rack-test-0.6.1...
Installing RDoc documentation for rack-mount-0.8.3...
Installing RDoc documentation for hike-1.2.1...
Installing RDoc documentation for tilt-1.3.3...
Installing RDoc documentation for sprockets-2.0.2...
Installing RDoc documentation for erubis-2.7.0...
Installing RDoc documentation for actionpack-3.1.0...
Installing RDoc documentation for arel-2.2.1...
Installing RDoc documentation for tzinfo-0.3.30...
Installing RDoc documentation for activerecord-3.1.0...
Installing RDoc documentation for activeresource-3.1.0...
Installing RDoc documentation for mime-types-1.16...
Installing RDoc documentation for polyglot-0.3.2...
Installing RDoc documentation for treetop-1.4.10...
Installing RDoc documentation for mail-2.3.0...
Installing RDoc documentation for actionmailer-3.1.0...
Installing RDoc documentation for thor-0.14.6...
Installing RDoc documentation for rack-ssl-1.3.2...
Installing RDoc documentation for rdoc-3.9.4...
Installing RDoc documentation for railties-3.1.0...
Installing RDoc documentation for rails-3.1.0...
file 'lib' not found
gspurrie-mn:proj% rails new example
create
create README
create Rakefile
create config.ru
create .gitignore
create Gemfile
create app
create app/assets/images/rails.png
create app/assets/javascripts/application.js
create app/assets/stylesheets/application.css
create app/controllers/application_controller.rb
create app/helpers/application_helper.rb
create app/mailers
create app/models
create app/views/layouts/application.html.erb
create app/mailers/.gitkeep
create app/models/.gitkeep
create config
create config/routes.rb
create config/application.rb
create config/environment.rb
create config/environments
create config/environments/development.rb
create config/environments/production.rb
create config/environments/test.rb
create config/initializers
create config/initializers/backtrace_silencers.rb
create config/initializers/inflections.rb
create config/initializers/mime_types.rb
create config/initializers/secret_token.rb
create config/initializers/session_store.rb
create config/initializers/wrap_parameters.rb
create config/locales
create config/locales/en.yml
create config/boot.rb
create config/database.yml
create db
create db/seeds.rb
create doc
create doc/README_FOR_APP
create lib
create lib/tasks
create lib/tasks/.gitkeep
create lib/assets
create lib/assets/.gitkeep
create log
create log/.gitkeep
create public
create public/404.html
create public/422.html
create public/500.html
create public/favicon.ico
create public/index.html
create public/robots.txt
create script
create script/rails
create test/fixtures
create test/fixtures/.gitkeep
create test/functional
create test/functional/.gitkeep
create test/integration
create test/integration/.gitkeep
create test/unit
create test/unit/.gitkeep
create test/performance/browsing_test.rb
create test/test_helper.rb
create tmp/cache
create tmp/cache/assets
create vendor/assets/stylesheets
create vendor/assets/stylesheets/.gitkeep
create vendor/plugins
create vendor/plugins/.gitkeep
run bundle install
Fetching source index for http://rubygems.org/
Using rake (0.9.2)
Using multi_json (1.0.3)
Using activesupport (3.1.0)
Using bcrypt-ruby (3.0.1)
Using builder (3.0.0)
Using i18n (0.6.0)
Using activemodel (3.1.0)
Using erubis (2.7.0)
Using rack (1.3.4)
Using rack-cache (1.0.3)
Using rack-mount (0.8.3)
Using rack-test (0.6.1)
Using hike (1.2.1)
Using tilt (1.3.3)
Using sprockets (2.0.2)
Using actionpack (3.1.0)
Using mime-types (1.16)
Using polyglot (0.3.2)
Using treetop (1.4.10)
Using mail (2.3.0)
Using actionmailer (3.1.0)
Using arel (2.2.1)
Using tzinfo (0.3.30)
Using activerecord (3.1.0)
Using activeresource (3.1.0)
Using bundler (1.0.21)
Installing coffee-script-source (1.1.2)
Installing execjs (1.2.9)
Installing coffee-script (2.2.0)
Using rack-ssl (1.3.2)
Using rdoc (3.9.4)
Using thor (0.14.6)
Using railties (3.1.0)
Installing coffee-rails (3.1.1)
Installing jquery-rails (1.0.14)
Installing json (1.6.1) with native extensions
Using rails (3.1.0)
Installing sass (3.1.8)
Installing sass-rails (3.1.4)
Installing sqlite3 (1.3.4) with native extensions
Installing uglifier (1.0.3)
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
gspurrie-mn:proj% cd example
gspurrie-mn:example% echo "gem 'rspec-rails', :group => [:development, :test]" >> Gemfile
gspurrie-mn:example% bundle install
Fetching source index for http://rubygems.org/
Using rake (0.9.2)
Using multi_json (1.0.3)
Using activesupport (3.1.0)
Using bcrypt-ruby (3.0.1)
Using builder (3.0.0)
Using i18n (0.6.0)
Using activemodel (3.1.0)
Using erubis (2.7.0)
Using rack (1.3.4)
Using rack-cache (1.0.3)
Using rack-mount (0.8.3)
Using rack-test (0.6.1)
Using hike (1.2.1)
Using tilt (1.3.3)
Using sprockets (2.0.2)
Using actionpack (3.1.0)
Using mime-types (1.16)
Using polyglot (0.3.2)
Using treetop (1.4.10)
Using mail (2.3.0)
Using actionmailer (3.1.0)
Using arel (2.2.1)
Using tzinfo (0.3.30)
Using activerecord (3.1.0)
Using activeresource (3.1.0)
Using bundler (1.0.21)
Using coffee-script-source (1.1.2)
Using execjs (1.2.9)
Using coffee-script (2.2.0)
Using rack-ssl (1.3.2)
Using rdoc (3.9.4)
Using thor (0.14.6)
Using railties (3.1.0)
Using coffee-rails (3.1.1)
Installing diff-lcs (1.1.3)
Using jquery-rails (1.0.14)
Using json (1.6.1)
Using rails (3.1.0)
Installing rspec-core (2.6.4)
Installing rspec-expectations (2.6.0)
Installing rspec-mocks (2.6.0)
Installing rspec (2.6.0)
Installing rspec-rails (2.6.1)
Using sass (3.1.8)
Using sass-rails (3.1.4)
Using sqlite3 (1.3.4)
Using uglifier (1.0.3)
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
gspurrie-mn:example% rails generate rspec:install
create .rspec
create spec
create spec/spec_helper.rb
gspurrie-mn:example% rake db:migrate
gspurrie-mn:example% rake db:test:prepare
gspurrie-mn:example% mkdir spec/controllers
gspurrie-mn:example% echo "require 'spec_helper'
>
> describe ApplicationController do
> controller do
> def index
> render :json => { 'message' => 'hello_world' }
> end
> end
>
> it 'renders JSON output' do
> get :index
> response.headers['Content-Type'].should =~ /application\/json/
> end
> end
> " >> spec/controllers/application_controller_spec.rb
gspurrie-mn:example% rspec spec
F
Failures:
1) ApplicationController renders JSON output
Failure/Error: render :json => { 'message' => 'hello_world' }
TypeError:
can't convert nil into String
# ./spec/controllers/application_controller_spec.rb:6:in `index'
# ./spec/controllers/application_controller_spec.rb:11
Finished in 0.03087 seconds
1 example, 1 failure
Failed examples:
rspec ./spec/controllers/application_controller_spec.rb:10 # ApplicationController renders JSON output
gspurrie-mn:example% ruby --version
ruby 1.8.7 (2011-06-30 patchlevel 352) [i686-darwin10.8.0]
gspurrie-mn:example% gem list
*** LOCAL GEMS ***
actionmailer (3.1.0)
actionpack (3.1.0)
activemodel (3.1.0)
activerecord (3.1.0)
activeresource (3.1.0)
activesupport (3.1.0)
arel (2.2.1)
bcrypt-ruby (3.0.1)
builder (3.0.0)
bundler (1.0.21)
coffee-rails (3.1.1)
coffee-script (2.2.0)
coffee-script-source (1.1.2)
diff-lcs (1.1.3)
erubis (2.7.0)
execjs (1.2.9)
hike (1.2.1)
i18n (0.6.0)
jquery-rails (1.0.14)
json (1.6.1)
mail (2.3.0)
mime-types (1.16)
multi_json (1.0.3)
polyglot (0.3.2)
rack (1.3.4)
rack-cache (1.0.3)
rack-mount (0.8.3)
rack-ssl (1.3.2)
rack-test (0.6.1)
rails (3.1.0)
railties (3.1.0)
rake (0.9.2)
rdoc (3.9.4)
rspec (2.6.0)
rspec-core (2.6.4)
rspec-expectations (2.6.0)
rspec-mocks (2.6.0)
rspec-rails (2.6.1)
sass (3.1.8)
sass-rails (3.1.4)
sprockets (2.0.2)
sqlite3 (1.3.4)
thor (0.14.6)
tilt (1.3.3)
treetop (1.4.10)
tzinfo (0.3.30)
uglifier (1.0.3)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment