spec/ios/uialertview_spec.rb in sugarcube-2.4.1 vs spec/ios/uialertview_spec.rb in sugarcube-2.4.2
- old
+ new
@@ -1,24 +1,24 @@
describe UIAlertView do
tests UIViewController # this is just needed so that a window is available
it 'should have :show option (show: false)' do
alert = UIAlertView.alert('test', show: false)
- proper_wait 0.6
+ proper_wait 0.5
alert.visible?.should == false
end
it 'should have :show option (show: true)' do
alert = UIAlertView.alert('test', show: true)
- proper_wait 1
+ proper_wait 0.5
alert.visible?.should == true
alert.dismissWithClickedButtonIndex(alert.firstOtherButtonIndex, animated: false)
end
it 'should show by default' do
alert = UIAlertView.alert('test')
- proper_wait 1
+ proper_wait 0.5
alert.visible?.should == true
alert.dismissWithClickedButtonIndex(alert.firstOtherButtonIndex, animated: false)
end
it 'should assign the title' do
@@ -97,55 +97,55 @@
end
it 'should call the block when dismissed' do
alert = UIAlertView.alert('test') { @touched = true }
alert.numberOfButtons.should == 1
- proper_wait 0.6
+ proper_wait 0.5
alert.dismissWithClickedButtonIndex(alert.firstOtherButtonIndex, animated: false)
-
+ proper_wait 0.5
@touched.should == true
end
it 'should call the block and pass the button when dismissed' do
alert = UIAlertView.alert('test') { |button| @touched = button }
- proper_wait 0.6
+ proper_wait 0.5
alert.dismissWithClickedButtonIndex(alert.firstOtherButtonIndex, animated: false)
-
+ proper_wait 0.5
@touched.should == 'OK'
end
it 'should call the block and pass the button and index when dismissed' do
alert = UIAlertView.alert('test') { |button, index| @touched, @touched_index = button, index }
- proper_wait 0.6
+ proper_wait 0.5
alert.dismissWithClickedButtonIndex(alert.firstOtherButtonIndex, animated: false)
-
+ proper_wait 0.5
@touched.should == 'OK'
@touched_index.should == 0
end
it 'should call the block when dismissed no matter when cancel button pressed' do
alert = UIAlertView.alert('test', buttons:['cancel','ok']) { @touched = true }
alert.numberOfButtons.should == 2
- proper_wait 0.6
+ proper_wait 0.5
alert.dismissWithClickedButtonIndex(alert.cancelButtonIndex, animated: false)
-
+ proper_wait 0.5
@touched.should == true
end
it 'should call the block and pass the button when dismissed with multiple buttons' do
alert = UIAlertView.alert('test', buttons: ['cancel', 'ok']) { |button| @touched = button }
- proper_wait 0.6
+ proper_wait 0.5
alert.dismissWithClickedButtonIndex(alert.cancelButtonIndex, animated: false)
-
+ proper_wait 0.5
@touched.should == 'cancel'
end
it 'should call the block and pass the button and index when dismissed with multiple buttons' do
alert = UIAlertView.alert('test', buttons: ['cancel', 'ok']) { |button, index| @touched, @touched_index = button, index }
- proper_wait 0.6
+ proper_wait 0.5
alert.dismissWithClickedButtonIndex(alert.cancelButtonIndex, animated: false)
-
+ proper_wait 0.5
@touched.should == 'cancel'
@touched_index.should == 0
end
describe 'when :cancel and :success handlers are used' do
@@ -161,20 +161,20 @@
after do
@alert.dismissWithClickedButtonIndex(@alert.cancelButtonIndex, animated: false) if @alert.visible?
end
it 'should call the :cancel block' do
- proper_wait 0.6
+ proper_wait 0.5
@alert.dismissWithClickedButtonIndex(@alert.cancelButtonIndex, animated: false)
-
+ proper_wait 0.5
@touched.should == :cancel
end
it 'should call the :success block' do
- proper_wait 0.6
+ proper_wait 0.5
@alert.dismissWithClickedButtonIndex(@alert.firstOtherButtonIndex, animated: false)
-
+ proper_wait 0.5
@touched.should == :success
end
end
@@ -188,30 +188,28 @@
@called = false
alert = UIAlertView.alert('test', buttons: ['cancel', 'ok'], style: :secure_text_input) do |button, text|
@called = true
@text = text
end
- proper_wait 0.6
+ proper_wait 0.5
alert.textFieldAtIndex(0).text = 'test text'
alert.dismissWithClickedButtonIndex(alert.firstOtherButtonIndex, animated: false)
- proper_wait 0.1
-
+ proper_wait 0.5
@called.should == true
@text.should == 'test text'
end
it 'should work with UIAlertViewStyleSecureTextInput' do
@called = false
alert = UIAlertView.alert('test', buttons: ['cancel', 'ok'], style: UIAlertViewStyleSecureTextInput) do |button, text|
@called = true
@text = text
end
- proper_wait 0.6
+ proper_wait 0.5
alert.textFieldAtIndex(0).text = 'test text'
alert.dismissWithClickedButtonIndex(alert.firstOtherButtonIndex, animated: false)
- proper_wait 0.1
-
+ proper_wait 0.5
@called.should == true
@text.should == 'test text'
end
it 'should work with :secure_text_input and pass the index' do
@@ -219,95 +217,88 @@
alert = UIAlertView.alert('test', buttons: ['cancel', 'ok'], style: :secure_text_input) do |button, text, touched_index|
@called = true
@text = text
@touched_index = touched_index
end
- proper_wait 0.6
+ proper_wait 0.5
alert.textFieldAtIndex(0).text = 'test text'
alert.dismissWithClickedButtonIndex(alert.firstOtherButtonIndex, animated: false)
- proper_wait 0.1
-
+ proper_wait 0.5
@called.should == true
@text.should == 'test text'
@touched_index.should == alert.firstOtherButtonIndex
end
it 'should work with :plain_text_input' do
alert = UIAlertView.alert('test', buttons: ['cancel', 'ok'], style: :plain_text_input) do |button, text|
@text = text
end
- proper_wait 0.6
+ proper_wait 0.5
alert.textFieldAtIndex(0).text = 'test text'
alert.dismissWithClickedButtonIndex(alert.cancelButtonIndex, animated: false)
- proper_wait 0.1
-
+ proper_wait 0.5
@text.should == 'test text'
end
it 'should work with UIAlertViewStylePlainTextInput' do
alert = UIAlertView.alert('test', buttons: ['cancel', 'ok'], style: UIAlertViewStylePlainTextInput) do |button, text|
@text = text
end
- proper_wait 0.6
+ proper_wait 0.5
alert.textFieldAtIndex(0).text = 'test text'
alert.dismissWithClickedButtonIndex(alert.cancelButtonIndex, animated: false)
- proper_wait 0.1
-
+ proper_wait 0.5
@text.should == 'test text'
end
it 'should work with :plain_text_input and pass the index' do
alert = UIAlertView.alert('test', buttons: ['cancel', 'ok'], style: :plain_text_input) do |button, text, touched_index|
@text = text
@touched_index = touched_index
end
- proper_wait 0.6
+ proper_wait 0.5
alert.textFieldAtIndex(0).text = 'test text'
alert.dismissWithClickedButtonIndex(alert.cancelButtonIndex, animated: false)
- proper_wait 0.1
-
+ proper_wait 0.5
@text.should == 'test text'
@touched_index.should == alert.cancelButtonIndex
end
it 'should work with :login_and_password_input' do
alert = UIAlertView.alert('test', buttons: ['cancel', 'ok'], style: :login_and_password_input) do |button, text1, text2|
@text = "#{text1} + #{text2}"
end
- proper_wait 0.6
+ proper_wait 0.5
alert.textFieldAtIndex(0).text = 'test text 1'
alert.textFieldAtIndex(1).text = 'test text 2'
alert.dismissWithClickedButtonIndex(alert.cancelButtonIndex, animated: false)
- proper_wait 0.1
-
+ proper_wait 0.5
@text.should == 'test text 1 + test text 2'
end
it 'should work with UIAlertViewStyleLoginAndPasswordInput' do
alert = UIAlertView.alert('test', buttons: ['cancel', 'ok'], style: UIAlertViewStyleLoginAndPasswordInput) do |button, text1, text2|
@text = "#{text1} + #{text2}"
end
- proper_wait 0.6
+ proper_wait 0.5
alert.textFieldAtIndex(0).text = 'test text 1'
alert.textFieldAtIndex(1).text = 'test text 2'
alert.dismissWithClickedButtonIndex(alert.cancelButtonIndex, animated: false)
- proper_wait 0.1
-
+ proper_wait 0.5
@text.should == 'test text 1 + test text 2'
end
it 'should work with :login_and_password_input and pass the index' do
alert = UIAlertView.alert('test', buttons: ['cancel', 'ok'], style: :login_and_password_input) do |button, text1, text2, index|
@text = "#{text1} + #{text2}"
@touched_index = index
end
- proper_wait 0.6
+ proper_wait 0.5
alert.textFieldAtIndex(0).text = 'test text 1'
alert.textFieldAtIndex(1).text = 'test text 2'
alert.dismissWithClickedButtonIndex(alert.cancelButtonIndex, animated: false)
- proper_wait 0.1
-
+ proper_wait 0.5
@text.should == 'test text 1 + test text 2'
@touched_index.should == alert.cancelButtonIndex
end
end
@@ -328,18 +319,20 @@
after do
@alert.dismissWithClickedButtonIndex(@alert.cancelButtonIndex, animated: false) if @alert.visible?
end
it 'should work for :cancel' do
- proper_wait 0.6
+ proper_wait 0.5
@alert.dismissWithClickedButtonIndex(@alert.cancelButtonIndex, animated: false)
+ proper_wait 0.5
@touched.should == :cancel
end
it 'should work for :ok' do
- proper_wait 0.6
+ proper_wait 0.5
@alert.dismissWithClickedButtonIndex(@alert.firstOtherButtonIndex, animated: false)
+ proper_wait 0.5
@touched.should == :ok
end
end
@@ -356,19 +349,19 @@
after do
@alert.dismissWithClickedButtonIndex(@alert.cancelButtonIndex, animated: false) if @alert.visible?
end
it 'should call the :cancel block' do
- proper_wait 0.6
+ proper_wait 0.5
@alert.dismissWithClickedButtonIndex(@alert.cancelButtonIndex, animated: false)
-
+ proper_wait 0.5
@touched.should == :cancel
end
it 'should call the :success block' do
- proper_wait 0.6
+ proper_wait 0.5
@alert.dismissWithClickedButtonIndex(@alert.firstOtherButtonIndex, animated: false)
-
+ proper_wait 0.5
@touched.should == :success
end
end