Class: Parklife::Browser

Inherits:
Object
  • Object
show all
Defined in:
lib/parklife/browser.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(app, base) ⇒ Browser

Returns a new instance of Browser.



10
11
12
13
14
15
# File 'lib/parklife/browser.rb', line 10

def initialize(app, base)
  @app = app
  @base = base
  @session = Rack::Test::Session.new(app)
  set_env
end

Instance Attribute Details

#appObject (readonly)

Returns the value of attribute app.



8
9
10
# File 'lib/parklife/browser.rb', line 8

def app
  @app
end

#baseObject (readonly)

Returns the value of attribute base.



8
9
10
# File 'lib/parklife/browser.rb', line 8

def base
  @base
end

#envObject (readonly)

Returns the value of attribute env.



8
9
10
# File 'lib/parklife/browser.rb', line 8

def env
  @env
end

#sessionObject (readonly)

Returns the value of attribute session.



8
9
10
# File 'lib/parklife/browser.rb', line 8

def session
  @session
end

Instance Method Details

#get(path) ⇒ Object



17
18
19
# File 'lib/parklife/browser.rb', line 17

def get(path)
  session.get(path, nil, env)
end

#uri_for(path) ⇒ Object



21
22
23
# File 'lib/parklife/browser.rb', line 21

def uri_for(path)
  base.dup.tap { |uri| uri.path = path }
end