Sha256: af21cc5d63d8b1e09304cbaffa2c9c55aae209a8e4b4a0e359aa48d5f9cdbfc0
Contents?: true
Size: 1.03 KB
Versions: 3
Compression:
Stored size: 1.03 KB
Contents
module RSpec::Rails::Matchers # Matcher for template rendering. module RenderTemplate # @private class RenderTemplateMatcher < RSpec::Matchers::BuiltIn::BaseMatcher def initialize(scope, expected, message=nil) @expected = Symbol === expected ? expected.to_s : expected @message = message @scope = scope end # @api private def matches?(*) match_unless_raises ActiveSupport::TestCase::Assertion do @scope.assert_template expected, @message end end # @api private def failure_message rescued_exception.message end # @api private def failure_message_when_negated "expected not to render #{expected.inspect}, but did" end end # Delegates to `assert_template`. # # @example # expect(response).to have_rendered("new") def have_rendered(options, message=nil) RenderTemplateMatcher.new(self, options, message) end alias_method :render_template, :have_rendered end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
rspec-rails-3.0.2 | lib/rspec/rails/matchers/have_rendered.rb |
rspec-rails-3.0.1 | lib/rspec/rails/matchers/have_rendered.rb |
rspec-rails-3.0.0 | lib/rspec/rails/matchers/have_rendered.rb |