Sha256: a8cfb4a7af8b733eb8fed3d9583f8ff06a363d7fe54bd943586b5ce6c561e51d

Contents?: true

Size: 1.17 KB

Versions: 10

Compression:

Stored size: 1.17 KB

Contents

require 'spec_helper'

describe Match do
  describe 'synchronization' do
    context 'when has associations defined in Synchronizer' do
      subject do
        -> { Match.sync }
      end

      it { is_expected.to change { Match.count }.by(1) }
      it { is_expected.to change { Team.count }.by(2) }
      it { is_expected.to change { Player.count }.by(4) }
      it { is_expected.to change { MatchPlayer.count }.by(4) }

      it { is_expected.to change { Synchronisable::Import.count }.by(11) }
    end

    # TODO: Left here until :include option is implemented
    #
    # context 'when associations specified with :include option' do
    #   subject do
    #     -> { sync_match }
    #   end

    #   def sync_match
    #     Match.sync(:include => {
    #       :match => {
    #         :team => :players
    #       }
    #     })
    #   end

    #   it { is_expected.to change { Match.count }.by(1) }
    #   it { is_expected.to change { Team.count }.by(2) }
    #   it { is_expected.to change { Player.count }.by(22) }
    #   it { is_expected.to change { MatchPlayer.count }.by(22) }

    #   it { is_expected.to change { Synchronisable::Import.count }.by(47) }
    # end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
synchronisable-1.0.2 spec/models/match_spec.rb
synchronisable-1.0.1 spec/models/match_spec.rb
synchronisable-1.0.0 spec/models/match_spec.rb
synchronisable-0.0.9 spec/models/match_spec.rb
synchronisable-0.0.8 spec/models/match_spec.rb
synchronisable-0.0.7 spec/models/match_spec.rb
synchronisable-0.0.6 spec/models/match_spec.rb
synchronisable-0.0.5 spec/models/match_spec.rb
synchronisable-0.0.4 spec/models/match_spec.rb
synchronisable-0.0.3 spec/models/match_spec.rb