[rspec-users] problem with get and post methods.. require missing ?

tgateau at seethroo.us tgateau at seethroo.us
Thu Aug 14 13:42:29 EDT 2008


Hello, I got an error when I run my spec test of a controlleur : the get
and post methodes are unknown. here is my test file :

##
setup_controller_spec.rb :
##

require File.dirname(__FILE__) + '/../spec_helper'
require "#{LIB_DIR}/application"
require "#{LIB_DIR}/setups_controller"

describe "A SetupController" do
  before :each do
    @setup_controller = SetupsController.new
  end

  it "should get step 1 first" do
    get 'step1'
    response.should be_success
  end
###

here is my spec_helper file :
##
ENV["RAILS_ENV"] = "test"
require "rubygems"
require "activerecord"
require "spec"
require File.dirname(__FILE__) + '/../config/environment'
LIB_DIR = File.join(File.expand_path(File.dirname(__FILE__)), *%w[.. app
controllers])

puts LIB_DIR
###

I get the error :
##
NoMethodError in 'A SetupController should get step 1 first'
undefined method `get' for
#<Spec::Example::ExampleGroup::Subclass_1:0xb786cefc>
./setup_controller_spec.rb:13:
###

(the same thing happens with the post methode)

depending on the RSpec doc, this methode should exist in the rspec plugin...
http://rspec.info/documentation/rails/writing/controllers.html
##sample :
get 'some_action'
response.should render_template("path/to/template/for/action")
###

I think it's another require problem...
Or maybe I make a mistake in my installation of the plugin
(I just execute the 2 commands in my working directory :
ruby script/plugin install
http://rspec.rubyforge.org/svn/tags/REL_1_1_3/rspec
ruby script/plugin install
http://rspec.rubyforge.org/svn/tags/REL_1_1_3/rspec_on_rails
)

Could somebody help me for this problem ?
Thanks
Thibault


More information about the rspec-users mailing list