Sha256: af09c779a73506c1f482e89dcd005ecba4c75c4fdd2424da60ccc54cdb736974

Contents?: true

Size: 976 Bytes

Versions: 17

Compression:

Stored size: 976 Bytes

Contents

module RSpec::Rails::Matchers
  module RenderTemplate
    class RenderTemplateMatcher
      include RSpec::Matchers::BuiltIn::BaseMatcher

      def initialize(scope, expected, message=nil)
        super(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_for_should
        rescued_exception.message
      end

      # @api private
      def failure_message_for_should_not
        "expected not to render #{expected.inspect}, but did"
      end
    end

    # Delegates to `assert_template`
    #
    # @example
    #
    #     response.should render_template("new")
    def render_template(options, message=nil)
      RenderTemplateMatcher.new(self, options, message)
    end
  end
end

Version data entries

17 entries across 12 versions & 3 rubygems

Version Path
sunrise-cms-0.5.0.rc1 vendor/bundle/ruby/1.9.1/gems/rspec-rails-2.10.1/lib/rspec/rails/matchers/render_template.rb
sunrise-cms-0.3.3 vendor/bundle/ruby/1.9.1/gems/rails-uploader-0.0.1/vendor/bundle/ruby/1.9.1/gems/rspec-rails-2.10.1/lib/rspec/rails/matchers/render_template.rb
sunrise-cms-0.3.3 vendor/bundle/ruby/1.9.1/gems/rspec-rails-2.10.1/lib/rspec/rails/matchers/render_template.rb
sunrise-cms-0.3.2 vendor/bundle/ruby/1.9.1/gems/rails-uploader-0.0.1/vendor/bundle/ruby/1.9.1/gems/rspec-rails-2.10.1/lib/rspec/rails/matchers/render_template.rb
sunrise-cms-0.3.2 vendor/bundle/ruby/1.9.1/gems/rspec-rails-2.10.1/lib/rspec/rails/matchers/render_template.rb
sunrise-cms-0.3.1 vendor/bundle/ruby/1.9.1/gems/rails-uploader-0.0.1/vendor/bundle/ruby/1.9.1/gems/rspec-rails-2.10.1/lib/rspec/rails/matchers/render_template.rb
sunrise-cms-0.3.1 vendor/bundle/ruby/1.9.1/gems/rspec-rails-2.10.1/lib/rspec/rails/matchers/render_template.rb
sunrise-cms-0.3.0 vendor/bundle/ruby/1.9.1/gems/rspec-rails-2.10.1/lib/rspec/rails/matchers/render_template.rb
sunrise-cms-0.3.0 vendor/bundle/ruby/1.9.1/gems/rails-uploader-0.0.1/vendor/bundle/ruby/1.9.1/gems/rspec-rails-2.10.1/lib/rspec/rails/matchers/render_template.rb
rails-uploader-0.0.4 vendor/bundle/ruby/1.9.1/gems/rspec-rails-2.10.1/lib/rspec/rails/matchers/render_template.rb
sunrise-cms-0.3.0.rc vendor/bundle/ruby/1.9.1/gems/rspec-rails-2.10.1/lib/rspec/rails/matchers/render_template.rb
sunrise-cms-0.3.0.rc vendor/bundle/ruby/1.9.1/gems/rails-uploader-0.0.1/vendor/bundle/ruby/1.9.1/gems/rspec-rails-2.10.1/lib/rspec/rails/matchers/render_template.rb
rails-uploader-0.0.1 vendor/bundle/ruby/1.9.1/gems/rspec-rails-2.10.1/lib/rspec/rails/matchers/render_template.rb
rspec-rails-2.10.1 lib/rspec/rails/matchers/render_template.rb
rspec-rails-2.10.0 lib/rspec/rails/matchers/render_template.rb
rspec-rails-2.9.0 lib/rspec/rails/matchers/render_template.rb
rspec-rails-2.9.0.rc2 lib/rspec/rails/matchers/render_template.rb