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