Sha256: f77dcd9dc96b6553576069909b288dc6484b50474d6f26059563b98317094b48

Contents?: true

Size: 1.05 KB

Versions: 27

Compression:

Stored size: 1.05 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

    context 'when associations specified with :includes option' do
      subject do
        -> { sync_match }
      end

      def sync_match
        Match.sync(:includes => {
          :team => :players,
          :blha => {
            :x => :z,
            :y => :f
          }
        })
      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 { Synchronisable::Import.count }.by(7) }
    end
  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
synchronisable-1.3.1 spec/models/match_spec.rb
synchronisable-1.3.0 spec/models/match_spec.rb
synchronisable-1.2.7 spec/models/match_spec.rb
synchronisable-1.2.6 spec/models/match_spec.rb
synchronisable-1.2.5 spec/models/match_spec.rb
synchronisable-1.2.4 spec/models/match_spec.rb
synchronisable-1.2.3 spec/models/match_spec.rb
synchronisable-1.2.2 spec/models/match_spec.rb
synchronisable-1.2.1 spec/models/match_spec.rb
synchronisable-1.2.0 spec/models/match_spec.rb
synchronisable-1.1.9 spec/models/match_spec.rb
synchronisable-1.1.8 spec/models/match_spec.rb
synchronisable-1.1.7 spec/models/match_spec.rb
synchronisable-1.1.6 spec/models/match_spec.rb
synchronisable-1.1.5 spec/models/match_spec.rb
synchronisable-1.1.4 spec/models/match_spec.rb
synchronisable-1.1.3 spec/models/match_spec.rb
synchronisable-1.1.2 spec/models/match_spec.rb
synchronisable-1.1.1 spec/models/match_spec.rb
synchronisable-1.1.0 spec/models/match_spec.rb