Sha256: fb384873126ee435ad72e1a7605f4ef8301a02652eb29ede86aa478332026e27

Contents?: true

Size: 1.56 KB

Versions: 23

Compression:

Stored size: 1.56 KB

Contents

require File.join(File.dirname(__FILE__), 'test_helper')

describe ApipieBindings::Param do

  let(:param) {ApipieBindings::Param.new({
          "allow_nil" => false,
          "description" => "<p>Architecture</p>",
          "expected_type" => "hash",
          "full_name" => "architecture",
          "name" => "architecture",
          "params" => [
              {
                  "allow_nil" => false,
                  "description" => "",
                  "expected_type" => "string",
                  "full_name" => "architecture[name]",
                  "name" => "name",
                  "required" => false,
                  "validator" => "Must be String"
              }

          ],
          "required" => true,
          "validator" => "Must be a Hash"
      }
    )}
  it "should create nested params" do
    param.params.first.name.must_equal 'name'
  end

  it "should have expected_type" do
    param.expected_type.must_equal :hash
  end

  it "should have description taht strip html tags" do
    param.description.must_equal "Architecture"
  end

  it "should have required?" do
    param.required?.must_equal true
    param.params.first.required?.must_equal false
  end

  it "should have validator" do
    param.validator.must_equal "Must be a Hash"
  end

  it "should have full name, type and required visible in puts" do
    out, err = capture_io { puts param }
    out.must_equal "<Param *architecture (Hash)>\n"
  end

  it "should have full name, type and required visible in inspect" do
    param.inspect.must_equal "<Param *architecture (Hash)>"
  end

end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
apipie-bindings-0.2.2 test/unit/param_test.rb
apipie-bindings-0.2.1 test/unit/param_test.rb
apipie-bindings-0.2.0 test/unit/param_test.rb
apipie-bindings-0.1.0 test/unit/param_test.rb
apipie-bindings-0.0.19 test/unit/param_test.rb
apipie-bindings-0.0.18 test/unit/param_test.rb
apipie-bindings-0.0.17 test/unit/param_test.rb
apipie-bindings-0.0.16 test/unit/param_test.rb
apipie-bindings-0.0.15 test/unit/param_test.rb
apipie-bindings-0.0.14 test/unit/param_test.rb
apipie-bindings-0.0.13 test/unit/param_test.rb
apipie-bindings-0.0.12 test/unit/param_test.rb
apipie-bindings-0.0.11 test/unit/param_test.rb
apipie-bindings-0.0.10 test/unit/param_test.rb
apipie-bindings-0.0.9 test/unit/param_test.rb
apipie-bindings-0.0.8 test/unit/param_test.rb
apipie-bindings-0.0.7 test/unit/param_test.rb
apipie-bindings-0.0.6 test/unit/param_test.rb
apipie-bindings-0.0.5 test/unit/param_test.rb
apipie-bindings-0.0.4 test/unit/param_test.rb