Sha256: 7b94926be8e88d03494a1634dd2b2c127735b4fd37b0f60b254f07381f3e149f

Contents?: true

Size: 1.6 KB

Versions: 5

Compression:

Stored size: 1.6 KB

Contents

module Symbiont
  module Helpers
    private

    def url_is_empty
      puts "\nERROR".on_red
      puts "The url_is assertion is empty on the definition #{retrieve_class(caller)}.".cyan
      raise Symbiont::Errors::NoUrlForDefinition
    end

    def url_match_is_empty
      puts "\nERROR".on_red
      puts "The url_matches assertion is empty on the definition #{retrieve_class(caller)}.".cyan
      raise Symbiont::Errors::NoUrlMatchForDefinition
    end

    def title_is_empty
      puts "\nERROR".on_red
      puts "The title_is assertion is empty on the definition #{retrieve_class(caller)}.".cyan
      raise Symbiont::Errors::NoTitleForDefinition
    end

    def no_url_is_provided
      puts "\nERROR".on_red
      puts "You called a '#{retrieve_method(caller)}' action but the ".cyan +
        "definition #{self.class} does not have a url_is assertion.".cyan
      raise Symbiont::Errors::NoUrlForDefinition
    end

    def no_url_matches_is_provided
      puts "\nERROR".on_red
      puts "You called a '#{retrieve_method(caller)}' action but the ".cyan +
        "definition #{self.class} does not have a url_matches assertion.".cyan
      raise Symbiont::Errors::NoUrlMatchForDefinition
    end

    def no_title_is_provided
      puts "\nERROR".on_red
      puts "You called a '#{retrieve_method(caller)}' action but the ".cyan +
        "definition #{self.class} does not have a title_is assertion.".cyan
      raise Symbiont::Errors::NoTitleForDefinition
    end

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

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

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
symbiont-1.2.0 lib/symbiont/helpers.rb
symbiont-1.1.2 lib/symbiont/helpers.rb
symbiont-1.1.0 lib/symbiont/helpers.rb
symbiont-1.0.0 lib/symbiont/helpers.rb
symbiont-0.14.0 lib/symbiont/helpers.rb