spec/configurator_spec.rb in rconf-0.5.6 vs spec/configurator_spec.rb in rconf-0.5.8
- old
+ new
@@ -19,10 +19,13 @@
validate_has_settings :required
attr_reader :custom_setting
def test_setter(value)
@custom_setting = value
end
+ def run_darwin; end
+ alias :run_linux :run_darwin
+ alias :run_windows :run_darwin
end
class AnotherConfigurator
include RightConf::Configurator
register :another
@@ -54,9 +57,21 @@
it 'should validate' do
@configurator.validate.should =~ /^Required setting.*missing for configuration/
@configurator.instance_eval { required 42 }
@configurator.validate.should be_nil
+ end
+
+ it 'should persist the signature of configurators that ran' do
+ flexmock(RightConf::Profile.instance).should_receive(:set_configurator_signature).once
+ @configurator.run
+ end
+
+ it 'should skip configurators that have already run' do
+ flexmock(RightConf::Profile.instance).should_receive(:configurator_signature).with(:test).and_return('42')
+ flexmock(@configurator).should_receive(:signature).and_return('42')
+ flexmock(RightConf::Platform.instance).should_receive(:dispatch).never
+ @configurator.run
end
end