Sha256: 6feb1d48377a4e3ddee89cf7511920716c56ad28131767469c6ad749dd3cfe66

Contents?: true

Size: 1.98 KB

Versions: 36

Compression:

Stored size: 1.98 KB

Contents

require File.dirname(__FILE__) + '/../../spec_helper'
require 'controller_spec_controller'

describe "a controller spec running in isolation mode", :type => :controller do
  controller_name :controller_spec

  it "should not care if the template doesn't exist" do
    get 'some_action'
    response.should be_success
    response.should render_template("template/that/does/not/actually/exist")
  end

  it "should not care if the template has errors" do
    get 'action_with_errors_in_template'
    response.should be_success
    response.should render_template("action_with_errors_in_template")
  end
end

describe "a controller spec running in integration mode", :type => :controller do
  controller_name :controller_spec
  integrate_views
  
  before(:each) do
    controller.class.send(:define_method, :rescue_action) { |e| raise e }
  end

  it "should render a template" do
    get 'action_with_template'
    response.should be_success
    response.should have_tag('div', 'This is action_with_template.rhtml')
  end

  it "should choke if the template doesn't exist" do
    error = defined?(ActionController::MissingTemplate) ? ActionController::MissingTemplate : ActionView::MissingTemplate    
    lambda { get 'some_action' }.should raise_error(error)
    response.should_not be_success
  end

  it "should choke if the template has errors" do
    lambda { get 'action_with_errors_in_template' }.should raise_error(ActionView::TemplateError)
    response.should_not be_success
  end
  
  describe "nested" do
    it "should render a template" do
      get 'action_with_template'
      response.should be_success
      response.should have_tag('div', 'This is action_with_template.rhtml')
    end
    
    describe "with integrate_views turned off" do
      integrate_views false
      
      it "should not care if the template doesn't exist" do
        get 'some_action'
        response.should be_success
        response.should render_template("template/that/does/not/actually/exist")
      end
    end
  end
end

Version data entries

36 entries across 36 versions & 8 rubygems

Version Path
dchelimsky-rspec-rails-1.1.10 spec/rails/example/controller_isolation_spec.rb
dchelimsky-rspec-rails-1.1.11.1 spec/rails/example/controller_isolation_spec.rb
dchelimsky-rspec-rails-1.1.11.2 spec/rails/example/controller_isolation_spec.rb
dchelimsky-rspec-rails-1.1.11.3 spec/rails/example/controller_isolation_spec.rb
dchelimsky-rspec-rails-1.1.11 spec/rails/example/controller_isolation_spec.rb
dchelimsky-rspec-rails-1.1.6 spec/rails/example/controller_isolation_spec.rb
dchelimsky-rspec-rails-1.1.7 spec/rails/example/controller_isolation_spec.rb
dchelimsky-rspec-rails-1.1.8 spec/rails/example/controller_isolation_spec.rb
dchelimsky-rspec-rails-1.1.9 spec/rails/example/controller_isolation_spec.rb
jcnetdev-rspec-rails-1.1.5 spec/rails/example/controller_isolation_spec.rb
jnstq-acts_as_sms-0.1.0 test/vendor/plugins/rspec-rails/spec/rails/example/controller_isolation_spec.rb
jnstq-acts_as_sms-0.1.1 test/vendor/plugins/rspec-rails/spec/rails/example/controller_isolation_spec.rb
jnstq-acts_as_sms-0.1.3 test/vendor/plugins/rspec-rails/spec/rails/example/controller_isolation_spec.rb
jnstq-acts_as_sms-0.1.4 test/vendor/plugins/rspec-rails/spec/rails/example/controller_isolation_spec.rb
jstorimer-deep-test-2.0.0 sample_rails_project/vendor/plugins/rspec_on_rails/spec/rails/example/controller_isolation_spec.rb
jstorimer-deep-test-1.4.0 sample_rails_project/vendor/plugins/rspec_on_rails/spec/rails/example/controller_isolation_spec.rb
jstorimer-deep-test-1.3.0 sample_rails_project/vendor/plugins/rspec_on_rails/spec/rails/example/controller_isolation_spec.rb
jstorimer-deep-test-1.2.0 sample_rails_project/vendor/plugins/rspec_on_rails/spec/rails/example/controller_isolation_spec.rb
jstorimer-deep-test-1.1.0 sample_rails_project/vendor/plugins/rspec_on_rails/spec/rails/example/controller_isolation_spec.rb
jstorimer-deep-test-1.0.0 sample_rails_project/vendor/plugins/rspec_on_rails/spec/rails/example/controller_isolation_spec.rb