class Juxtapose::FrankStrategy

Attributes

context[RW]

Public Class Methods

new(context) click to toggle source
# File lib/juxtapose/strategy/frank_strategy.rb, line 8
def initialize(context)
  self.context = context
end
setup() click to toggle source
# File lib/juxtapose/strategy/frank_strategy.rb, line 3
def self.setup
  Cucumber::RbSupport::RbDsl.register_rb_hook('before', [], Proc.new {|scenario, block| @__scenario = scenario })
end

Public Instance Methods

current_spec_description() click to toggle source
# File lib/juxtapose/strategy/frank_strategy.rb, line 16
def current_spec_description
  context.instance_variable_get('@__scenario').name
end
device_name() click to toggle source
# File lib/juxtapose/strategy/frank_strategy.rb, line 20
def device_name
  screen_type = ''
  name = [context.version]
  if context.version == 'iphone'
    name << 'retina' if width > 320
    name << '5' if height > 960
  else
    name << 'retina' if width > 768
  end

  name.join('-')
end
save_current(filename) click to toggle source
# File lib/juxtapose/strategy/frank_strategy.rb, line 33
def save_current(filename)
  context.frankly_screenshot(filename, nil, false)
end
spec_dir() click to toggle source
# File lib/juxtapose/strategy/frank_strategy.rb, line 37
def spec_dir
  "features/screens"
end
version() click to toggle source
# File lib/juxtapose/strategy/frank_strategy.rb, line 12
def version
  @version ||= "ios_#{context.app_exec("ios_version").first}"
end

Private Instance Methods

height() click to toggle source
# File lib/juxtapose/strategy/frank_strategy.rb, line 54
def height
  resolution['height']
end
resolution() click to toggle source
# File lib/juxtapose/strategy/frank_strategy.rb, line 46
def resolution
  @resolution ||= JSON.parse(server.send_get('resolution'))
end
server() click to toggle source
# File lib/juxtapose/strategy/frank_strategy.rb, line 42
def server
  @_server ||= Frank::Cucumber::Gateway.new( context.base_server_url )
end
width() click to toggle source
# File lib/juxtapose/strategy/frank_strategy.rb, line 50
def width
  resolution['width']
end