mirror of
https://github.com/zhigang1992/rmq.git
synced 2026-01-12 09:33:43 +08:00
added rmq.debug.colorize with tests
This commit is contained in:
@@ -80,7 +80,7 @@ module RubyMotionQuery
|
||||
# foo: foo,
|
||||
# bar: bar
|
||||
# })
|
||||
def assert(truthy, label = nil, objects = nil)
|
||||
def self.assert(truthy, label = nil, objects = nil)
|
||||
if (RMQ.app.development? || RMQ.app.test?) && !truthy
|
||||
label ||= 'Assert failed'
|
||||
if block_given? && !objects
|
||||
|
||||
@@ -1,10 +1,23 @@
|
||||
describe 'debug' do
|
||||
should 'assert value is true' do
|
||||
before do
|
||||
@rmq = RubyMotionQuery::RMQ
|
||||
end
|
||||
|
||||
it 'asserts value is true' do
|
||||
a = true
|
||||
RubyMotionQuery::Debug.assert(1==1) do
|
||||
@rmq.debug.assert(1==1) do
|
||||
a = false
|
||||
{}
|
||||
end
|
||||
a.should == true
|
||||
end
|
||||
|
||||
it 'randomly colors a selected view' do
|
||||
vc = UIViewController.new
|
||||
|
||||
some_view = vc.rmq.append!(UIView)
|
||||
some_view.backgroundColor.should == nil
|
||||
vc.rmq(some_view).debug.colorize
|
||||
some_view.backgroundColor.is_a?(UIColor).should == true
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user