Sha256: 5a54b52a78e9e7b5f300dde19c336699e9da8f9d74c945c9b201284a118a0ffb
Contents?: true
Size: 1.78 KB
Versions: 6
Compression:
Stored size: 1.78 KB
Contents
require 'spec_helper' describe Synchronisable do describe 'synchronization' do subject do -> { Synchronisable.sync } end describe 'models specified in configuration' do context 'only Team and Match' do before :all do Synchronisable.models = %w(Match Team) 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 'all' do before :all do Synchronisable.models = %w( Stage Tournament Team Match MatchPlayer Player ) end it { is_expected.to change { Tournament.count }.by(1) } it { is_expected.to change { Stage.count }.by(2) } it { is_expected.to change { Match.count }.by(1) } it { is_expected.to change { Team.count }.by(2) } it { is_expected.to change { MatchPlayer.count }.by(4) } it { is_expected.to change { Player.count }.by(4) } it { is_expected.to change { Synchronisable::Import.count }.by(14) } end # context 'when models setting is overriden in method call' do # before :all do # Synchronisable.models = %w(Team Match) # end # subject do # -> { Synchronisable.sync(Match, Player) } # end # it { is_expected.to change { Match.count }.by(1) } # it { is_expected.to change { Player.count }.by(22) } # it { is_expected.not_to change { Team.count }.by(2) } # it { is_expected.to change { Synchronisable::Import.count }.by(5) } # end end end end
Version data entries
6 entries across 6 versions & 1 rubygems