class InfoTest

Public Instance Methods

setup() click to toggle source
# File railties/test/rails_info_test.rb, line 14
def setup
  Quails.send :remove_const, :Info
  silence_warnings { load "quails/info.rb" }
end
test_html_includes_middleware() click to toggle source
# File railties/test/rails_info_test.rb, line 47
def test_html_includes_middleware
  Quails::Info.module_eval do
    property "Middleware", ["Rack::Lock", "Rack::Static"]
  end

  html = Quails::Info.to_html
  assert_includes html, '<tr><td class="name">Middleware</td>'
  properties.value_for("Middleware").each do |value|
    assert_includes html, "<li>#{CGI.escapeHTML(value)}</li>"
  end
end
test_property_with_block() click to toggle source
# File railties/test/rails_info_test.rb, line 35
def test_property_with_block
  Quails::Info.module_eval do
    property("Goodbye") { "World" }
  end
  assert_property "Goodbye", "World"
end
test_property_with_block_swallows_exceptions_and_ignores_property() click to toggle source
# File railties/test/rails_info_test.rb, line 19
def test_property_with_block_swallows_exceptions_and_ignores_property
  assert_nothing_raised do
    Quails::Info.module_eval do
      property("Bogus") { raise }
    end
  end
  assert !property_defined?("Bogus")
end
test_property_with_string() click to toggle source
# File railties/test/rails_info_test.rb, line 28
def test_property_with_string
  Quails::Info.module_eval do
    property "Hello", "World"
  end
  assert_property "Hello", "World"
end
test_quails_version() click to toggle source
# File railties/test/rails_info_test.rb, line 42
def test_quails_version
  assert_property "Quails version",
    File.read(File.realpath("../../RAILS_VERSION", __dir__)).chomp
end

Private Instance Methods

assert_property(property_name, value) click to toggle source
# File railties/test/rails_info_test.rb, line 68
def assert_property(property_name, value)
  raise "Property #{property_name.inspect} not defined" unless
    property_defined? property_name
  assert_equal value, properties.value_for(property_name)
end
properties() click to toggle source
# File railties/test/rails_info_test.rb, line 60
def properties
  Quails::Info.properties
end
property_defined?(property_name) click to toggle source
# File railties/test/rails_info_test.rb, line 64
def property_defined?(property_name)
  properties.names.include? property_name
end