mirror of
https://github.com/sinatra/sinatra
synced 2023-03-27 23:18:01 -04:00
add test for using set with a block
This commit is contained in:
parent
15651d9ee1
commit
0915274b69
1 changed files with 13 additions and 0 deletions
|
@ -21,6 +21,19 @@ class SettingsTest < Test::Unit::TestCase
|
|||
assert_equal 'baz', @base.foo
|
||||
end
|
||||
|
||||
it 'sets settings using a block' do
|
||||
@base.set(:foo){ 'baz' }
|
||||
assert @base.respond_to?(:foo)
|
||||
assert_equal 'baz', @base.foo
|
||||
end
|
||||
|
||||
# TODO: should it raise an error instead?
|
||||
it 'ignores any other value if set using a block' do
|
||||
@base.set(:foo, 'ignore'){ 'baz' }
|
||||
assert @base.respond_to?(:foo)
|
||||
assert_equal 'baz', @base.foo
|
||||
end
|
||||
|
||||
it "sets multiple settings with a Hash" do
|
||||
@base.set :foo => 1234,
|
||||
:bar => 'Hello World',
|
||||
|
|
Loading…
Add table
Reference in a new issue