Sha256: 3ce1431ea7a497ca1439248642eac0f620a4ba4200bc120db708fcf029bd7675
Contents?: true
Size: 1.45 KB
Versions: 1
Compression:
Stored size: 1.45 KB
Contents
require 'spec_helper' module Omnitest class Psychic class FakeRubyFactory < ScriptFactory runs '**.fake_rb' runs '**.fake_erb' end class FakeJavaScriptFactory < ScriptFactory runs '**.fake_js' end RSpec.describe ScriptFactoryManager do let(:psychic) { Psychic.new(cwd: current_dir) } let(:opts) do {} end let(:subject) do described_class.new psychic, opts end before(:each) do described_class.register_factory(FakeRubyFactory) described_class.register_factory(FakeJavaScriptFactory) end def fake_script(name) write_file name, '' psychic.script name end describe '#initialize' do it 'creates instances of registered factories' do expect(subject.factories).to include( an_instance_of FakeRubyFactory ) end end describe '#factories_for' do it 'returns nil if no factories can run the script' do expect(subject.factories_for fake_script('foo.asdf')).to be_empty end it 'returns the factories that can run the script' do expect(subject.factories_for fake_script('foo.fake_rb')).to include( an_instance_of FakeRubyFactory ) expect(subject.factories_for fake_script('foo.fake_js')).to include( an_instance_of FakeJavaScriptFactory ) end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
omnitest-psychic-0.0.9 | spec/omnitest/psychic/script_factory_manager_spec.rb |