aboutsummaryrefslogtreecommitdiffstats
path: root/spec/models/referential_cloning_spec.rb
blob: 5acd433ec5ea264c901bad81720fa1b260570c59 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
require 'spec_helper'

RSpec.describe ReferentialCloning, :type => :model do
  it 'should have a valid factory' do
    expect(FactoryGirl.build(:referential_cloning)).to be_valid
  end

  it { should belong_to :source_referential }
  it { should belong_to :target_referential }

  describe "ReferentialCloningWorker" do
    let(:referential_cloning) { FactoryGirl.create(:referential_cloning) }

    it "should schedule a job in worker" do
      expect{referential_cloning.run_callbacks(:commit)}.to change {ReferentialCloningWorker.jobs.count}.by(1)
    end
  end
end