mardi 24 novembre 2015

Berkeley CS169.1 MOOC Rotten Potatoes TDD Rspec Error Movie does not implement:

I am trying to go through the Esaas examples of BerkeleyX CS169.1 MOOC class, TDD example using Rspec. I am stuck with this error when I run rspec on my controller.

My rottenpotatoes/spec/controllers/movies_controller_spec.rb file:

require 'rails_helper'
require_relative '../app/controllers/movies_controller.rb'


RSpec.describe MoviesController, type: :controller do
  describe 'searching TMDb' do
    it 'should call the model method that performs TMDb search' do
      allow(Movie).to receive(:show)
    end
  end

My rottenpotatoes/app/controllers/movies_controller.rb

class MoviesController < ApplicationController

  def show
  end

end

running $ rspec /spec/controllers/movies_controller_spec.rb' gives me the following error:

Failure/Error: allow(Movie).to receive(:show)
       Movie(id: integer, title: string, rating: string, description: text, release_date: datetime, created_at: datetime, updated_at: datetime) does not implement: show

An excerpt of my Gemfile:

ruby '2.2.2'
gem 'rails', '4.2.1'
group :development, :test do
  gem 'sqlite3'
  gem 'rspec-rails', '3.3.2'
  gem 'ZenTest', '4.11.0'
end

group :test do
  gem 'cucumber-rails', :require => false
  gem 'cucumber-rails-training-wheels'
end

Also I really should not need:

require_relative '../app/controllers/movies_controller.rb'

in my rspec file, right?

Aucun commentaire:

Enregistrer un commentaire