Skip to content

Commit

Permalink
refactor specs
Browse files Browse the repository at this point in the history
  • Loading branch information
durandom committed Apr 6, 2017
1 parent f7a5f3d commit 402bdd5
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions spec/models/miq_dialog_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,23 @@
allow(described_class).to receive(:find_by)

expect(described_class).to receive(:sync_from_file).at_least(:once).with(/^#{root}/, root).and_call_original

described_class.seed

expect(described_class).to have_received(:find_by).once.with(
expect(described_class).to receive(:find_by).once.with(
:name => "miq_host_provision_dialogs", :filename => "miq_host_provision_dialogs.yaml"
)

described_class.seed
end

it 'seed from plugins' do
mock_engine = double(:root => Pathname.new('/some/root'))
allow(Vmdb::Plugins.instance).to receive(:registered_provider_plugins).and_return([mock_engine])
allow(described_class).to receive(:sync_from_dir)

described_class.seed

expect(described_class).to have_received(:sync_from_dir).at_least(:once).with(
expect(Vmdb::Plugins.instance).to receive(:registered_provider_plugins).and_return([mock_engine])
expect(described_class).to receive(:sync_from_dir).once.with(
mock_engine.root.join('content', 'miq_dialogs')
)

described_class.seed
end
end
end

0 comments on commit 402bdd5

Please sign in to comment.