test/test_helper.rb in reform-0.2.7 vs test/test_helper.rb in reform-1.0.0

- old
+ new

@@ -1,11 +1,11 @@ require 'reform' require 'minitest/autorun' class ReformSpec < MiniTest::Spec - let (:duran) { OpenStruct.new(:name => "Duran Duran") } - let (:rio) { OpenStruct.new(:title => "Rio") } + let (:duran) { Struct.new(:name).new("Duran Duran") } + let (:rio) { Struct.new(:title).new("Rio") } end require 'active_record' class Artist < ActiveRecord::Base end @@ -13,5 +13,39 @@ :adapter => "sqlite3", :database => "#{Dir.pwd}/database.sqlite3" ) #Artist.delete_all + +class BaseTest < MiniTest::Spec + class AlbumForm < Reform::Form + property :title + + property :hit do + property :title + end + + collection :songs do + property :title + end + end + + Song = Struct.new(:title) + Album = Struct.new(:title, :hit, :songs, :band) + Band = Struct.new(:label) + Label = Struct.new(:name) + + + let (:hit) { Song.new("Roxanne") } +end + +MiniTest::Spec.class_eval do + module Saveable + def save + @saved = true + end + + def saved? + @saved + end + end +end \ No newline at end of file