mirror of
https://github.com/zhigang1992/rmq.git
synced 2026-04-30 21:52:33 +08:00
make rmq.device.simulator? spec work when run on the device
This commit is contained in:
@@ -89,15 +89,32 @@ describe 'device' do
|
|||||||
@rmq.device.iphone?.should == false
|
@rmq.device.iphone?.should == false
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should return the right value for simulator?' do
|
if !(UIDevice.currentDevice.model =~ /simulator/i).nil?
|
||||||
@rmq.device.simulator?.should == true
|
context "when run on simulator" do
|
||||||
|
it 'should return the right value for simulator?' do
|
||||||
|
@rmq.device.simulator?.should == true
|
||||||
|
|
||||||
class RubyMotionQuery::Device
|
class RubyMotionQuery::Device
|
||||||
def self.fake_simulator_value; @_simulator = false; end
|
def self.fake_simulator_value; @_simulator = false; end
|
||||||
|
end
|
||||||
|
|
||||||
|
@rmq.device.fake_simulator_value
|
||||||
|
@rmq.device.simulator?.should == false
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
else
|
||||||
|
context "when run on the device" do
|
||||||
|
it 'should return the right value for simulator?' do
|
||||||
|
@rmq.device.simulator?.should == false
|
||||||
|
|
||||||
@rmq.device.fake_simulator_value
|
class RubyMotionQuery::Device
|
||||||
@rmq.device.simulator?.should == false
|
def self.fake_simulator_value; @_simulator = true; end
|
||||||
|
end
|
||||||
|
|
||||||
|
@rmq.device.fake_simulator_value
|
||||||
|
@rmq.device.simulator?.should == true
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should return the right value for three_point_five_inch?' do
|
it 'should return the right value for three_point_five_inch?' do
|
||||||
|
|||||||
Reference in New Issue
Block a user