我有模块模块FakeText
require 'faker'
require 'xkcd'
module FakeText
def generate_title
"Auto Title: #{Faker::Commerce.department} #{get_current_time}"
end
我用它作为:
require_relative '../../lib/helpers/text_generator'
class TitlePage
include PageObject
def add_new_title
$title_text = generate_title
self.title_element.send_keys($title_text)
end
但它给出了错误:
NameError:
undefined local variable or method `generate_title'