I'm completely new to RSpec (and fairly new to Rails, too.) I'm working on an existing application that has an Admin::BaseController and sub-controllers such as Admin:TestimonialsController:
class Admin::BaseController < ApplicationController end class Admin::TestimonialsController < Admin::BaseController def new @page_title = "Create New Testimonial" end end I'm trying to write very basic tests for my Testimonials controller, like so: [testimonials_controller_spec.rb] require 'spec_helper' describe Admin::TestimonialsController do integrate_views describe "GET 'new'" do it "should be successful" do get 'new' response.should be_success end it "should have the right title" do get 'testimonials/new' response.should have_tag("title", /Create New Testimonial/) end end end I've created the 'new' view and it gets the right title tag, but the tests fail: 1) 'Admin::TestimonialsController GET 'new' should render the create testimonial template' FAILED expected success? to return true, got false /Users/Lowell/rails_projects/genlighten_dr/spec/controllers/admin/ testimonials_controller_spec.rb:9: 2) 'Admin::TestimonialsController GET 'new' should have the right title' FAILED Expected at least 1 element matching "title", found 0. <false> is not true. /Users/Lowell/rails_projects/genlighten_dr/spec/controllers/admin/ testimonials_controller_spec.rb:14: I suspect it has something to do with the path to my views. Because the testimonials sub-controller inherits from the admin BaseController, both testimonials controllers and views are in subdirectories, e.g.: app/controllers/admin/testimonials_controller.rb and app/views/admin/testimonials/new.html.erb Should my tests say something like: get 'admin/testimonials/new' instead of get 'new'? Or am I making a less subtle mistake? Thanks, Dean _______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users