Sha256: 91cf1886b7ffc481d81b91afab04e97c469bc94985e7b23746d34c14d4b3c0fb
Contents?: true
Size: 1.63 KB
Versions: 4
Compression:
Stored size: 1.63 KB
Contents
require "test_helper" require "yaml" module Cogy class InventoryTest < ActionDispatch::IntegrationTest include Engine.routes.url_helpers setup { @routes = Engine.routes } def test_valid_yaml with_config(bundle: { name: "hyu", version: "5.0", description: "Yet another bundle" }, command_load_paths: ["cogy"]) do |inv| assert_equal "hyu", inv["name"] assert_equal "5.0", inv["version"] assert_equal "Yet another bundle", inv["description"] end end def test_cog_bundle_version assert_equal 4, fetch_inventory["cog_bundle_version"] end def test_bundle_version_lambda with_config(bundle: { version: -> { 1 + 2 } }) do |inv| assert_equal 3, inv["version"] end end def test_commands_section with_config(bundle: { cogy_executable: "/bin/no" }) do |inv| expected = { "executable" => "/bin/no", "description" => "Print a foo", "rules" => ["allow"], "env_vars" => { "COGY_BACKEND" => "http://www.example.com/cogy" } } assert_equal expected, inv["commands"]["say_foo"] end end def test_without_commands without_commands do refute_includes fetch_inventory.keys, "commands" end end def test_content_type get "/cogy/inventory" assert_equal "application/x-yaml", response.content_type end def test_template expected = <<TEMPLATE.strip **foo:** ~$results[0].name~ ~br~ foo TEMPLATE assert_equal expected, fetch_inventory["templates"]["pretty-command"]["body"] end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
cogy-0.6.0 | test/integration/inventory_test.rb |
cogy-0.5.2 | test/integration/inventory_test.rb |
cogy-0.5.1 | test/integration/inventory_test.rb |
cogy-0.5.0 | test/integration/inventory_test.rb |