Sha256: 21a146b4ce15f2f658fcdd0b84ed201caf56a62e4509cbb1ad5947c8b079592d

Contents?: true

Size: 1.38 KB

Versions: 4

Compression:

Stored size: 1.38 KB

Contents

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

describe "a controller spec running in isolation mode", :behaviour_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", :behaviour_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
    lambda { get 'some_action' }.should raise_error(ActionController::MissingTemplate)
    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
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
deckshuffler-0.0.2 vendor/plugins/rspec_on_rails/spec/rails/dsl/controller_isolation_spec.rb
has_finder-0.1.1 spec/rails/vendor/plugins/rspec_on_rails/spec/rails/dsl/controller_isolation_spec.rb
has_finder-0.1.2 spec/rails/vendor/plugins/rspec_on_rails/spec/rails/dsl/controller_isolation_spec.rb
has_finder-0.1.3 spec/rails/vendor/plugins/rspec_on_rails/spec/rails/dsl/controller_isolation_spec.rb