Skip to content

Instantly share code, notes, and snippets.

@ajwinn
Created November 13, 2012 17:40
Show Gist options
  • Save ajwinn/4067212 to your computer and use it in GitHub Desktop.
Save ajwinn/4067212 to your computer and use it in GitHub Desktop.
spec/controllers/movies_controller_spec.rb
Admins-MacBook-Air-2:spec administrator$ rspec /Users/administrator/Dropbox/projects/edX/nabin/spec/movies_controller_spec.rb
WARNING: Cucumber-rails required outside of env.rb. The rest of loading is being defered until env.rb is called.
To avoid this warning, move 'gem cucumber-rails' under only group :test in your Gemfile
/Users/administrator/Dropbox/projects/edX/nabin/spec/movies_controller_spec.rb:8:in `block (2 levels) in <top (required)>': undefined method `post' for #<Class:0x007fd07dfc71c8> (NoMethodError)
from /Users/administrator/.rvm/gems/ruby-1.9.2-p290/gems/rspec-core-2.8.0/lib/rspec/core/example_group.rb:201:in `module_eval'
from /Users/administrator/.rvm/gems/ruby-1.9.2-p290/gems/rspec-core-2.8.0/lib/rspec/core/example_group.rb:201:in `subclass'
from /Users/administrator/.rvm/gems/ruby-1.9.2-p290/gems/rspec-core-2.8.0/lib/rspec/core/example_group.rb:187:in `describe'
from /Users/administrator/Dropbox/projects/edX/nabin/spec/movies_controller_spec.rb:5:in `block in <top (required)>'
from /Users/administrator/.rvm/gems/ruby-1.9.2-p290/gems/rspec-core-2.8.0/lib/rspec/core/example_group.rb:201:in `module_eval'
from /Users/administrator/.rvm/gems/ruby-1.9.2-p290/gems/rspec-core-2.8.0/lib/rspec/core/example_group.rb:201:in `subclass'
from /Users/administrator/.rvm/gems/ruby-1.9.2-p290/gems/rspec-core-2.8.0/lib/rspec/core/example_group.rb:187:in `describe'
from /Users/administrator/.rvm/gems/ruby-1.9.2-p290/gems/rspec-core-2.8.0/lib/rspec/core/dsl.rb:18:in `describe'
from /Users/administrator/Dropbox/projects/edX/nabin/spec/movies_controller_spec.rb:4:in `<top (required)>'
from /Users/administrator/.rvm/gems/ruby-1.9.2-p290/gems/rspec-core-2.8.0/lib/rspec/core/configuration.rb:698:in `load'
from /Users/administrator/.rvm/gems/ruby-1.9.2-p290/gems/rspec-core-2.8.0/lib/rspec/core/configuration.rb:698:in `block in load_spec_files'
from /Users/administrator/.rvm/gems/ruby-1.9.2-p290/gems/rspec-core-2.8.0/lib/rspec/core/configuration.rb:698:in `map'
from /Users/administrator/.rvm/gems/ruby-1.9.2-p290/gems/rspec-core-2.8.0/lib/rspec/core/configuration.rb:698:in `load_spec_files'
from /Users/administrator/.rvm/gems/ruby-1.9.2-p290/gems/rspec-core-2.8.0/lib/rspec/core/command_line.rb:22:in `run'
from /Users/administrator/.rvm/gems/ruby-1.9.2-p290/gems/rspec-core-2.8.0/lib/rspec/core/runner.rb:80:in `run_in_process'
from /Users/administrator/.rvm/gems/ruby-1.9.2-p290/gems/rspec-core-2.8.0/lib/rspec/core/runner.rb:69:in `run'
from /Users/administrator/.rvm/gems/ruby-1.9.2-p290/gems/rspec-core-2.8.0/lib/rspec/core/runner.rb:10:in `block in autorun'
source 'http://rubygems.org'
gem 'rails', '3.1.0'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
# for Heroku deployment - as described in Ap. A of ELLS book
group :development, :test do
gem 'sqlite3'
gem 'ruby-debug19', :require => 'ruby-debug'
gem 'cucumber-rails'
gem 'cucumber-rails-training-wheels'
gem 'database_cleaner'
gem 'capybara'
gem 'launchy'
gem 'rspec-rails'
gem 'simplecov'
end
group :production do
gem 'pg'
end
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'therubyracer'
gem 'sass-rails', " ~> 3.1.0"
gem 'coffee-rails', "~> 3.1.0"
gem 'uglifier'
end
gem 'jquery-rails'
# Use unicorn as the web server
# gem 'unicorn'
# Deploy with Capistrano
# gem 'capistrano'
# To use debugger
gem 'haml'
require 'spec_helper'
describe MoviesController do
describe 'searching TMDb' do
it 'should call the model method that performs TMDb search'
# Movie.should_receive(:find_in_tmdb).with('hardware')
post :search_tmdb, {:search_terms => 'hardware'}
it 'should select the Search Results template for rendering'
Movie.stub(:find_in_tmdb)
post :search_tmdb, {:search_terms => 'hardware'}
result.should render_template('search_tmdb')
it 'should make the TMDb search results available to that template'
fake_results = [mock('Movie'), mock('Movie')]
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment