test/integration/inventory_test.rb in cogy-0.1.1 vs test/integration/inventory_test.rb in cogy-0.2.0

- old
+ new

@@ -6,12 +6,12 @@ include Engine.routes.url_helpers setup { @routes = Engine.routes } def test_valid_yaml - with_config(bundle_name: "hyu", bundle_version: "5.0", - bundle_description: "Yet another bundle", + 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 @@ -20,17 +20,17 @@ 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| + with_config(bundle: { version: -> { 1 + 2 } }) do |inv| assert_equal 3, inv["version"] end end def test_commands_section - with_config(executable_path: "/bin/no") do |inv| + with_config(bundle: { cogy_executable: "/bin/no" }) do |inv| expected = { "executable" => "/bin/no", "description" => "Print a foo", "rules" => ["allow"] } @@ -46,8 +46,22 @@ end def test_content_type get "/cogy/inventory" assert_equal "application/x-yaml", response.content_type + end + + def test_template + get "/cogy/inventory" + + expected = <<TEMPLATE.strip +**foo:** ~$results[0].name~ + +~br~ + +foo +TEMPLATE + + assert_equal expected, fetch_inventory["templates"]["pretty-command"]["body"] end end end