spec/uialertview_spec.rb in sugarcube-1.1.0 vs spec/uialertview_spec.rb in sugarcube-1.3.0

- old
+ new

@@ -7,18 +7,18 @@ alert.visible?.should == false end it 'should have :show option (show: true)' do alert = UIAlertView.alert('test', show: true) - proper_wait 0.6 + proper_wait 1 alert.visible?.should == true alert.dismissWithClickedButtonIndex(alert.firstOtherButtonIndex, animated: false) end it 'should show by default' do alert = UIAlertView.alert('test') - proper_wait 0.6 + proper_wait 1 alert.visible?.should == true alert.dismissWithClickedButtonIndex(alert.firstOtherButtonIndex, animated: false) end it 'should assign the title' do @@ -142,10 +142,14 @@ cancel: ->{ @touched = :cancel }, success: ->{ @touched = :success } ) end + after do + @alert.dismissWithClickedButtonIndex(@alert.cancelButtonIndex, animated: false) + end + it 'should work for :cancel' do proper_wait 0.6 @alert.dismissWithClickedButtonIndex(@alert.cancelButtonIndex, animated: false) @touched.should == :cancel @@ -165,16 +169,19 @@ before do @text = nil end it 'should work with :secure_text_input' do + @called = false alert = UIAlertView.alert('test', buttons: ['cancel', 'ok'], style: :secure_text_input) { |button, text| + @called = true @text = text } proper_wait 0.6 alert.textFieldAtIndex(0).text = 'test text' - alert.dismissWithClickedButtonIndex(alert.cancelButtonIndex, animated: false) + alert.dismissWithClickedButtonIndex(alert.firstOtherButtonIndex, animated: false) + @called.should == true @text.should == 'test text' end it 'should work with :plain_text_input' do alert = UIAlertView.alert('test', buttons: ['cancel', 'ok'], style: :plain_text_input) { |button, text|