Sha256: 060fe9167f9c34161696d800dd61a244017e2aea67706db07e4ab9440443dba1

Contents?: true

Size: 1.45 KB

Versions: 1

Compression:

Stored size: 1.45 KB

Contents

module Symbiote
  module Situation
    private

    def url_is_empty
      puts "PROBLEM: url_is assertion empty."
      puts "The url_is assertion is empty on"
      puts "the definition #{retrieve_class(caller)}."
      abort
    end

    def no_url_provided
      puts "PROBLEM: No url provided."
      puts "You called a '#{retrieve_method(caller)}' action but the "
      puts "definition #{self.class} does not have a url_is assertion."
      puts "Either provide the url_is assertion or pass the url as an"
      puts "argument to the visit call."
      abort
    end

    def title_is_empty
      puts "PROBLEM: title_is assertion empty."
      puts "The title_is assertion is empty on"
      puts "the definition #{retrieve_class(caller)}."
      abort
    end

    def no_title_is_provided
      puts "PROBLEM: No title provided."
      puts "You called a '#{retrieve_method(caller)}' action but the"
      puts "definition #{self.class} does not have a title_is assertion."
    end

    def no_locator(definition, identifier)
      puts "PROBLEM: No locator provided."
      puts "You are using '#{identifier}' on '#{definition}'."
      puts "But there is no locator provided with it."
      abort
    end

    def empty_locator(locator, values)
      locator[0].nil? && values.empty? && !values[0].is_a?(Hash)
    end

    def retrieve_class(caller)
      caller[1][/`.*'/][8..-3]
    end

    def retrieve_method(caller)
      caller[0][/`.*'/][1..-2]
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
symbiote-0.2.0 lib/symbiote/situation.rb