Module: GlobalHelpers

Defined in:
lib/testing/helpers/global_helpers.rb

Instance Method Summary collapse

Instance Method Details

#accountObject



10
11
12
# File 'lib/testing/helpers/global_helpers.rb', line 10

def 
  Account.first || raise("Could not find a site. Maybe you want to set one up in your story background?")
end

#parsed_htmlObject



14
15
16
17
18
19
# File 'lib/testing/helpers/global_helpers.rb', line 14

def parsed_html
  # memoizing this causes problems since it seems to be memoized across requests
  # TODO: Figure out way to memoize within one request only
  # @parsed_body ||= Nokogiri::HTML(response.body)
  Nokogiri::HTML(response.body)
end

#siteObject



2
3
4
# File 'lib/testing/helpers/global_helpers.rb', line 2

def site
  Site.first || raise("Could not find a site. Maybe you want to set one up in your story background?")
end

#userObject



6
7
8
# File 'lib/testing/helpers/global_helpers.rb', line 6

def user
  @user || raise("@current_user is not set. Maybe you want to sign in first?")
end