我的单元测试存在一些问题。
当我运行我的单元测试时,我遇到了一些问题:
timestamp
undefined loacal variable or method
========== 1 ============
当我运行单元测试时,timpestamp
和date field
出错。它说:
- "date"=>"2011-11-05T22:03:54+09:00",
? ^ ^
+ "date"=>"2011-11-05T20:03:54+07:00",
? ^ ^
"finished"=>1,
"position"=>"",
"timestamp"=>"2014-03-21T09:43:05+07:00",
"type"=>"new type"},
"content_id2"=>
{"bookmark_suffix_max"=>3,
"bookmarks"=>
[{"date"=>"", "label"=>"", "name"=>"", "position"=>""},
{"date"=>"", "label"=>"", "name"=>"", "position"=>""}],
- "date"=>"2011-11-04T22:03:54+09:00",
? ^ ^
+ "date"=>"2011-11-04T20:03:54+07:00",
? ^ ^
"finished"=>1,
"position"=>"",
- "timestamp"=>"2011-11-04T22:03:54+09:00",
? ^ ^
+ "timestamp"=>"2011-11-04T20:03:54+07:00",
? ^ ^
"type"=>""}},
"timestamp"=>"2014-03-21T09:43:05+07:00"}
test_merge1_with_conflict_1:_should_update_bookmark_info_with_client's_'date'_field(AccountBookmarkInfoTest)
是因为time_zone
吗?或者是其他东西。我已经使用-
修复了+
,但我仍然有同样的错误。
============ 2 ===============
Error: test_ContentsJsonCache.key_for_params_should_depend_all_query_parameters(ContentsJsonCacheTest)
NameError: undefined local variable or method `current_protocol_version' for #<App:0x007fcc0a3f8800>
app/models/app.rb:166:in `implements_purchase_bonus_feature?'
app/models/app.rb:174:in `include_purchase_bonuses_in_contents_json?'
app/models/contents_json_cache.rb:21:in `key_for_params'
test/unit/contents_json_cache_test.rb:22:in `block in <class:ContentsJsonCacheTest>'
current_local_version
位于:
**Controller. define : app.current_protocol_version
**Models. define :
attr_accessible :current_protocol_version,
:name,
....
**test->functional->app.controller_test.rb
app = apps :one
app.current_protocol_version = '1.1.9'
assert_false app.implements_account_feature?
答案 0 :(得分:0)
如果你有以下代码:
之前。
time.parse var
后
time.zone.parse var