Sha256: dcc268672473383838e8aaeec4b73d5df7ac954d7b7eb03a96979b8824112722

Contents?: true

Size: 1.05 KB

Versions: 10

Compression:

Stored size: 1.05 KB

Contents

require 'reform'
require 'minitest/autorun'

class ReformSpec < MiniTest::Spec
  let (:duran)  { Struct.new(:name).new("Duran Duran") }
  let (:rio)    { Struct.new(:title).new("Rio") }
end

require 'active_record'
class Artist < ActiveRecord::Base
end

class Song < ActiveRecord::Base
  belongs_to :artist
end

class Album < ActiveRecord::Base
  has_many :songs
end

ActiveRecord::Base.establish_connection(
  :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, :length)
  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

10 entries across 10 versions & 1 rubygems

Version Path
reform-1.2.6 test/test_helper.rb
reform-1.2.5 test/test_helper.rb
reform-1.2.4 test/test_helper.rb
reform-1.2.3 test/test_helper.rb
reform-1.2.2 test/test_helper.rb
reform-1.2.1 test/test_helper.rb
reform-1.2.0.beta2 test/test_helper.rb
reform-1.2.0.beta1 test/test_helper.rb
reform-1.1.1 test/test_helper.rb
reform-1.1.0 test/test_helper.rb