def expected_title(expected_title)
      define_method("has_expected_title?") do
        page_title = title
        has_expected_title = (expected_title === page_title)
        raise "Expected title '#{expected_title}' instead of '#{page_title}'" unless has_expected_title
        has_expected_title
      end
    end
def expected_title(expected_title)
      define_method("has_expected_title?") do
        page_title = title
        has_expected_title = (expected_title === page_title)
        raise "Expected title '#{expected_title}' instead of '#{page_title}'" unless has_expected_title
        has_expected_title
      end
    end
Creates a method that compares the expected_title of a page against the actual.
 @param [String] expected_title the literal expected title for the page
 @param [Regexp] expected_title the expected title pattern for the page
 @return [boolean]
 @raise An exception if expected_title does not match actual title

 @example Specify 'Google' as the expected title of a page
   expected_title "Google"
   page.has_expected_title?