зеркало из https://github.com/github/github-ds.git
Merge pull request #19 from github/no-block
Make initialize without block return `true` for `ok?`
This commit is contained in:
Коммит
e42141e1ad
|
@ -15,7 +15,7 @@ module GitHub
|
||||||
#
|
#
|
||||||
def initialize
|
def initialize
|
||||||
begin
|
begin
|
||||||
@value = yield
|
@value = yield if block_given?
|
||||||
@error = nil
|
@error = nil
|
||||||
rescue => e
|
rescue => e
|
||||||
@error = e
|
@error = e
|
||||||
|
|
|
@ -83,4 +83,8 @@ class GitHub::ResultTest < Minitest::Test
|
||||||
|
|
||||||
assert_equal e, GitHub::Result.new { raise e }.error
|
assert_equal e, GitHub::Result.new { raise e }.error
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_initialize_without_block
|
||||||
|
assert_predicate GitHub::Result.new, :ok?
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Загрузка…
Ссылка в новой задаче