@@ -153,6 +153,12 class Repository < ActiveRecord::Base | |||
|
153 | 153 | end |
|
154 | 154 | end |
|
155 | 155 | |
|
156 | # TODO: should return an empty hash instead of nil to avoid many ||{} | |
|
157 | def extra_info | |
|
158 | h = read_attribute(:extra_info) | |
|
159 | h.is_a?(Hash) ? h : nil | |
|
160 | end | |
|
161 | ||
|
156 | 162 | def merge_extra_info(arg) |
|
157 | 163 | h = extra_info || {} |
|
158 | 164 | return h if arg.nil? |
@@ -326,6 +326,12 class RepositoryTest < ActiveSupport::TestCase | |||
|
326 | 326 | assert_equal true, klass.scm_available |
|
327 | 327 | end |
|
328 | 328 | |
|
329 | def test_extra_info_should_not_return_non_hash_value | |
|
330 | repo = Repository.new | |
|
331 | repo.extra_info = "foo" | |
|
332 | assert_nil repo.extra_info | |
|
333 | end | |
|
334 | ||
|
329 | 335 | def test_merge_extra_info |
|
330 | 336 | repo = Repository::Subversion.new(:project => Project.find(3)) |
|
331 | 337 | assert !repo.save |
General Comments 0
You need to be logged in to leave comments.
Login now