spec/integration/yard/sinclair/config_spec.rb in sinclair-1.6.7 vs spec/integration/yard/sinclair/config_spec.rb in sinclair-1.7.0
- old
+ new
@@ -22,7 +22,34 @@
it 'returns all configs json on to_json calls' do
expect(config.to_json)
.to eq('{"password":null,"username":"bob"}')
end
end
+
+ describe '#options' do
+ subject(:config) { configurable.config }
+
+ let(:configurable) { LoginConfigurable }
+
+ before do
+ LoginConfigurable.configure do |conf|
+ conf.username :some_username
+ conf.password :some_password
+ end
+ end
+
+ it 'returns options with correct values' do
+ expect(config.options.username).to eq(:some_username)
+ expect(config.options.password).to eq(:some_password)
+ end
+
+ context 'when merging with given attributes' do
+ subject(:options) { config.options(password: :correct_password) }
+
+ it 'returns options with custom values' do
+ expect(options.username).to eq(:some_username)
+ expect(options.password).to eq(:correct_password)
+ end
+ end
+ end
end
end