Sha256: 13d19c2842131da06ea171f7d4e12ad91f0f6ec27445c97995b9219d5f89449c

Contents?: true

Size: 1.04 KB

Versions: 8

Compression:

Stored size: 1.04 KB

Contents

require 'test_helper'

class SyncTest < BaseTest
  describe "populated" do
    let (:params) {
      {
        "title" => "Best Of",
        "hit"   => {"title" => "Roxanne"},
        "songs" => [{"title" => "Fallout"}, {"title" => "Roxanne"}],
        :band  => {:label => {:name => "Polydor"}}
      }
    }

    let (:album) { Album.new(nil, hit, [song1, song2], band) }
    let (:hit) { Song.new }
    let (:song1) { Song.new }
    let (:song2) { Song.new }
    let (:band) { Band.new(label) }
    let (:label) { Label.new }

    subject { ErrorsTest::AlbumForm.new(album) }

    before do
      subject.validate(params)
      subject.sync
    end

    it { album.title.must_equal "Best Of" }
    it { album.hit.must_be_kind_of Struct }
    it { album.songs[0].must_be_kind_of Struct }
    it { album.songs[1].must_be_kind_of Struct }

    # it { hit.must_be_kind_of Struct }
    it { hit.title.must_equal "Roxanne" }
    it { song1.title.must_equal "Fallout" }
    it { song2.title.must_equal "Roxanne" }
    it { label.name.must_equal "Polydor" }
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
reform-1.2.0.beta1 test/sync_test.rb
reform-1.1.1 test/sync_test.rb
reform-1.1.0 test/sync_test.rb
reform-1.0.4 test/sync_test.rb
reform-1.0.3 test/sync_test.rb
reform-1.0.2 test/sync_test.rb
reform-1.0.1 test/sync_test.rb
reform-1.0.0 test/sync_test.rb