Sha256: bfbe4283c6abe1fcc33bd01e50b4a090b876366ac45bfdad937cce60f628f2f4

Contents?: true

Size: 929 Bytes

Versions: 31

Compression:

Stored size: 929 Bytes

Contents

# Configure Rails Envinronment
ENV["RAILS_ENV"] = "test"

require File.expand_path("../../config/environment.rb", __FILE__)
require "rails/test_help"
require "nokogiri"

Rails.backtrace_cleaner.remove_silencers!

class ActionDispatch::IntegrationTest

protected

  def assert_xpath(xpath, message="Unable to find '#{xpath}' in response body.")
    assert_response :success, "Response type is not :success (code 200..299)."

    body = @response.body
    assert !body.empty?, "No response body found."

    doc = Nokogiri::HTML(body) rescue nil
    assert_not_nil doc, "Cannot parse response body."

    assert doc.xpath(xpath).size >= 1, message
  end

  def assert_html(expected, options = {})
    expected = "<!DOCTYPE html><html><head><title>Dummy</title></head><body>#{options[:heading]}<div class=\"content\">#{expected}</div></body></html>" unless options[:skip_layout]
    assert_equal expected, @response.body
  end

end

Version data entries

31 entries across 31 versions & 3 rubygems

Version Path
brakeman-4.3.1 bundle/ruby/2.5.0/gems/slim-3.0.7/test/rails/test/helper.rb
brakeman-4.3.0 bundle/ruby/2.5.0/gems/slim-3.0.7/test/rails/test/helper.rb
brakeman-4.2.1 bundle/ruby/2.5.0/gems/slim-3.0.7/test/rails/test/helper.rb
brakeman-4.2.0 bundle/ruby/2.3.0/gems/slim-3.0.7/test/rails/test/helper.rb
brakeman-4.1.1 bundle/ruby/2.3.0/gems/slim-3.0.7/test/rails/test/helper.rb
brakeman-4.1.0 bundle/ruby/2.3.0/gems/slim-3.0.7/test/rails/test/helper.rb
slim-3.0.9 test/rails/test/helper.rb
brakeman-4.0.1 bundle/ruby/2.3.0/gems/slim-3.0.7/test/rails/test/helper.rb
brakeman-4.0.1.pre1 bundle/ruby/2.3.0/gems/slim-3.0.7/test/rails/test/helper.rb
brakeman-4.0.0 bundle/ruby/2.3.0/gems/slim-3.0.7/test/rails/test/helper.rb
brakeman-3.7.2 bundle/ruby/2.3.0/gems/slim-3.0.7/test/rails/test/helper.rb
brakeman-3.7.1 bundle/ruby/2.3.0/gems/slim-3.0.7/test/rails/test/helper.rb
brakeman-3.7.0 bundle/ruby/2.3.0/gems/slim-3.0.7/test/rails/test/helper.rb
brakeman-3.6.2 bundle/ruby/2.3.0/gems/slim-3.0.7/test/rails/test/helper.rb
slim-3.0.8 test/rails/test/helper.rb
brakeman-3.6.1 bundle/ruby/2.3.0/gems/slim-3.0.7/test/rails/test/helper.rb
brakeman-3.6.0 bundle/ruby/2.3.0/gems/slim-3.0.7/test/rails/test/helper.rb
brakeman-3.5.0 bundle/ruby/2.3.0/gems/slim-3.0.7/test/rails/test/helper.rb
brakeman-3.4.1 bundle/ruby/2.3.0/gems/slim-3.0.7/test/rails/test/helper.rb
brakeman-3.4.0 bundle/ruby/2.3.0/gems/slim-3.0.7/test/rails/test/helper.rb