From 0c59c30fa44e7c309ba49907ce99a23bf5e193ba Mon Sep 17 00:00:00 2001 From: Gant Date: Sun, 23 Nov 2014 19:30:54 -0600 Subject: [PATCH] added rmq.debug.colorize with tests --- motion/ruby_motion_query/debug.rb | 2 +- spec/debug.rb | 17 +++++++++++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/motion/ruby_motion_query/debug.rb b/motion/ruby_motion_query/debug.rb index 183ed8e..baae8ee 100644 --- a/motion/ruby_motion_query/debug.rb +++ b/motion/ruby_motion_query/debug.rb @@ -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 diff --git a/spec/debug.rb b/spec/debug.rb index 00cc32f..1ffb937 100644 --- a/spec/debug.rb +++ b/spec/debug.rb @@ -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