Sha256: 13e36b8fc240c6633b7fbf7895a074e4dd1ca4f285c06b3cca1c0369441dafcb

Contents?: true

Size: 1.5 KB

Versions: 4

Compression:

Stored size: 1.5 KB

Contents

require "test_helper"
require "mimoco"

class ModelsTest < Minitest::Test
  def test_valid
    models = {Order => {valid: {name: "Name", qty: 123}}}
    check_models models
  end

  def test_valids
    models = {
      Order => {
        valids: [
          {name: "Name", qty: 123},
          {qty: 123}
        ]
      }
    }
    check_models models
  end

  def test_invalid
    models = {Order => {invalid: {qty: :abc}}}
    check_models models
  end

  def test_invalids
    models = {
      Order => {
        invalids: [
          {qty: :abc},
          {name: "Name", qty: :def}
        ]
      }
    }
    check_models models
  end

  def test_class_methods
    models = {Order => {class_methods: %i[class_method]}}
    check_models models
  end

  def test_call_class_methods
    models = {Order => {call_class_methods: %i[class_method]}}
    check_models models
  end

  def test_public_methods
    models = {Order => {public_methods: %i[public_method]}}
    check_models models
  end

  def test_call_public_methods
    models = {
      Order => {
        valid: {name: "Name", qty: 123},
        call_public_methods: %i[public_method]
      }
    }
    check_models models
  end

  def test_several
    models = {
      Order => {
        valid: {name: "Name", qty: 123},
        invalid: {qty: :abc},
        class_methods: %i[class_method],
        call_class_methods: %i[class_method],
        public_methods: %i[public_method],
        call_public_methods: %i[public_method]
      }
    }
    check_models models
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
mimoco-0.3.2 test/models/models_test.rb
mimoco-0.3.1 test/models/models_test.rb
mimoco-0.3.0 test/models/models_test.rb
mimoco-0.2.0 test/models/models_test.rb