Sha256: 39a6a31614ac48bafd6f05ef84ef9cbfd6a1ec848b6bbba84ca77516c2903602

Contents?: true

Size: 632 Bytes

Versions: 5

Compression:

Stored size: 632 Bytes

Contents

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

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

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

  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
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
adva-core-0.0.14 lib/testing/helpers/global_helpers.rb
adva-core-0.0.13 lib/testing/helpers/global_helpers.rb
adva-core-0.0.9 lib/testing/helpers/global_helpers.rb
adva-core-0.0.8 lib/testing/helpers/global_helpers.rb
adva-core-0.0.7 lib/testing/helpers/global_helpers.rb