added rmq.debug.colorize with tests

This commit is contained in:
Gant
2014-11-23 19:30:54 -06:00
parent 653f0d20f6
commit 0c59c30fa4
2 changed files with 16 additions and 3 deletions

View File

@@ -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

View File

@@ -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