Skip to content

Commit

Permalink
Formally deprecate Device iphone_4in reader
Browse files Browse the repository at this point in the history
  • Loading branch information
jmoody committed Mar 21, 2015
1 parent af217ef commit af8c83e
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
11 changes: 10 additions & 1 deletion calabash-cucumber/lib/calabash-cucumber/device.rb
Expand Up @@ -136,7 +136,7 @@ class Device
# @return [Hash] screen dimensions, scale and down/up sampling fraction.
attr_reader :screen_dimensions

# @deprecated 0.13.0 no replacement
# @deprecated 0.13.1 no replacement
# Indicates whether or not this device has a 4in screen.
# @attribute [r] iphone_4in
# @return [Boolean] `true` if this device has a 4in screen.
Expand Down Expand Up @@ -323,6 +323,15 @@ def iphone_5?
_deprecated('0.9.168', "use 'iphone_4in?' instead", :warn)
iphone_4in?
end

# @deprecated 0.13.1 - Call `iphone_4in?` instead.
# @see #iphone_4in?
# @note Deprecated after introducing new `form_factor` behavior.
# @return [Boolean] true if this device is an iPhone 5 or 5s
def iphone_4in
_deprecated('0.13.1', "use 'iphone_4in?' instead", :warn)
@iphone_4in
end
end
end
end
12 changes: 12 additions & 0 deletions calabash-cucumber/spec/lib/deprecated_spec.rb
Expand Up @@ -21,5 +21,17 @@
expect(val).to be == nil
end
end

it 'Device iphone_4in attribute' do
simulator_data = Resources.shared.server_version :simulator
endpoint = 'http://localhost:37265'
device = Calabash::Cucumber::Device.new(endpoint, simulator_data)
out = capture_stderr do
device.iphone_4in
end
expect(out.string).not_to be == nil
expect(out.string).not_to be == ''
expect(out.string =~ /WARN: deprecated '0.13.1' - 'use 'iphone_4in\?' instead/).not_to be == nil
end
end
end

0 comments on commit af8c83e

Please sign in to comment.