Sha256: 157a8a082b4d4325881df7c2d1aa233dc42839dcc197c9f6a2a46b88c8540472

Contents?: true

Size: 1.01 KB

Versions: 30

Compression:

Stored size: 1.01 KB

Contents

# coding: UTF-8

module PathSelectorFallbacks
  def _selector_for(locator)
    if respond_to?(:selector_for)
      selector_for(locator)
    elsif locator =~ /^"(.+)"$/
      $1
    else
      raise "Can't find mapping from \"#{locator}\" to a selector.\n" +
        "Add a selectors.rb file (compare #{Spreewald.github_url}/blob/master/examples/selectors.rb)"
    end
  end

  def _path_to(page_name)
    if respond_to?(:path_to)
      path_to(page_name)
    else
      begin
        page_name =~ /^the (.*) page$/
        path_components = $1.split(/\s+/)
        self.send(path_components.push('path').join('_').to_sym)
      rescue NoMethodError, ArgumentError
        raise "Can't find mapping from \"#{page_name}\" to a path.\n" +
          "Add a paths.rb file (compare #{Spreewald.github_url}/blob/master/examples/paths.rb)"
      end
    end
  end
end
World(PathSelectorFallbacks)

module WithinHelpers
  def with_scope(locator)
    locator ? within(*_selector_for(locator)) { yield } : yield
  end
end
World(WithinHelpers)

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
spreewald-4.4.0 lib/spreewald_support/path_selector_fallbacks.rb
spreewald-4.3.6 lib/spreewald_support/path_selector_fallbacks.rb
spreewald-4.3.5 lib/spreewald_support/path_selector_fallbacks.rb
spreewald-4.3.4 lib/spreewald_support/path_selector_fallbacks.rb
spreewald-4.3.3 lib/spreewald_support/path_selector_fallbacks.rb
spreewald-4.3.2 lib/spreewald_support/path_selector_fallbacks.rb
spreewald-4.2.3 lib/spreewald_support/path_selector_fallbacks.rb
spreewald-4.2.2 lib/spreewald_support/path_selector_fallbacks.rb
spreewald-4.1.2 lib/spreewald_support/path_selector_fallbacks.rb
spreewald-4.1.1 lib/spreewald_support/path_selector_fallbacks.rb
spreewald-4.1.0 lib/spreewald_support/path_selector_fallbacks.rb
spreewald-3.0.3 lib/spreewald_support/path_selector_fallbacks.rb
spreewald-3.0.2 lib/spreewald_support/path_selector_fallbacks.rb
spreewald-2.99.3 lib/spreewald_support/path_selector_fallbacks.rb
spreewald-2.99.2 lib/spreewald_support/path_selector_fallbacks.rb
spreewald-3.0.1 lib/spreewald_support/path_selector_fallbacks.rb
spreewald-2.99.1 lib/spreewald_support/path_selector_fallbacks.rb
spreewald-3.0.0 lib/spreewald_support/path_selector_fallbacks.rb
spreewald-2.99.0 lib/spreewald_support/path_selector_fallbacks.rb
spreewald-2.9.0 lib/spreewald_support/path_selector_fallbacks.rb