Sha256: 3e681ce9eb58689a2b75d9c141aee9d81c027fd3c9a20ad888bd1d00b522e516

Contents?: true

Size: 1.14 KB

Versions: 13

Compression:

Stored size: 1.14 KB

Contents

require "spec_helper"

describe "render_template" do
  include RSpec::Rails::Matchers::RenderTemplate

  it "uses failure message from render_template" do
    self.stub!(:assert_template).and_raise(
      Test::Unit::AssertionFailedError.new("this message"))
    response = ActionController::TestResponse.new
    expect do
      response.should render_template("destination")
    end.to raise_error("this message")
  end

  context "given a hash" do
    it "delegates to assert_template" do
      self.should_receive(:assert_template).with({:this => "hash"}, "this message")
      "response".should render_template({:this => "hash"}, "this message")
    end
  end

  context "given a string" do
    it "delegates to assert_template" do
      self.should_receive(:assert_template).with("this string", "this message")
      "response".should render_template("this string", "this message")
    end
  end

  context "given a symbol" do
    it "converts to_s and delegates to assert_template" do
      self.should_receive(:assert_template).with("template_name", "this message")
      "response".should render_template(:template_name, "this message")
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
rspec-rails-2.3.1 spec/rspec/rails/matchers/render_template_spec.rb
rspec-rails-2.3.0 spec/rspec/rails/matchers/render_template_spec.rb
rspec-rails-2.2.1 spec/rspec/rails/matchers/render_template_spec.rb
rspec-rails-2.2.0 spec/rspec/rails/matchers/render_template_spec.rb
rspec-rails-2.1.0 spec/rspec/rails/matchers/render_template_spec.rb
rspec-rails-2.0.1 spec/rspec/rails/matchers/render_template_spec.rb
rspec-rails-2.0.0 spec/rspec/rails/matchers/render_template_spec.rb
rspec-rails-2.0.0.rc spec/rspec/rails/matchers/render_template_spec.rb
rspec-rails-2.0.0.beta.22 spec/rspec/rails/matchers/render_template_spec.rb
rspec-rails-2.0.0.beta.20 spec/rspec/rails/matchers/render_template_spec.rb
rspec-rails-2.0.0.beta.19 spec/rspec/rails/matchers/render_template_spec.rb
rspec-rails-2.0.0.beta.18 spec/rspec/rails/matchers/render_template_spec.rb
rspec-rails-2.0.0.beta.17 spec/rspec/rails/matchers/render_template_spec.rb