I have checked : I am in the RAILS_ROOT/spec/controllers directory I have tried with the second solution, but the get and post methodes remain undefined. Could it be a version compatibility problem ? I'm using rails 2.1.0, and the REL_1_1_3 for the rspec plugin. What is the best version of rspec and rails to make them work well together ? Thib.
> On Thu, Aug 14, 2008 at 12:42 PM, <[EMAIL PROTECTED]> wrote: >> >> 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 spec doesn't know it is supposed to be a controller spec. For it > to know that, it needs to be in RAILS_ROOT/spec/controllers, or you > can use this argument to the describe method: > > describe SetupController, :type => :controller do > ... > end > > HTH, > David > >> ### >> >> (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 >> _______________________________________________ >> rspec-users mailing list >> rspec-users@rubyforge.org >> http://rubyforge.org/mailman/listinfo/rspec-users >> > _______________________________________________ > rspec-users mailing list > rspec-users@rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users > _______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users