Sha256: b9a247a89cac665e08e24d9bd34f1ec60b92a61d09d23b2818edd8cda81750ab

Contents?: true

Size: 934 Bytes

Versions: 1

Compression:

Stored size: 934 Bytes

Contents

require "reform"
require 'minitest/autorun'
require "representable/debug"
require "declarative/testing"
require "pp"
require 'byebug'

require "reform/form/dry"
# setup test classes so we can test without dry being included
class TestForm < Reform::Form
  feature Reform::Form::Dry
end

class TestContract < Reform::Contract
  feature Reform::Form::Dry
end

class BaseTest < MiniTest::Spec
  class AlbumForm < TestForm
    property :title

    property :hit do
      property :title
    end

    collection :songs do
      property :title
    end
  end

  Song   = Struct.new(:title, :length, :rating)
  Album  = Struct.new(:title, :hit, :songs, :band)
  Band   = Struct.new(:label)
  Label  = Struct.new(:name)
  Length = Struct.new(:minutes, :seconds)


  let (:hit) { Song.new("Roxanne") }
end

MiniTest::Spec.class_eval do
  module Saveable
    def save
      @saved = true
    end

    def saved?
      @saved
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
reform-2.3.0.rc1 test/test_helper.rb