diff options
Diffstat (limited to 'spec/support/page_model.rb')
| -rw-r--r-- | spec/support/page_model.rb | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/spec/support/page_model.rb b/spec/support/page_model.rb new file mode 100644 index 0000000..3fbace2 --- /dev/null +++ b/spec/support/page_model.rb @@ -0,0 +1,26 @@ +class PageModel + include Capybara::DSL + include Rails.application.routes.url_helpers + attr_reader :page_path + + def initialize(page_path) + @page_path = page_path + end + + def visit_page + visit page_path + self + end + + def on_page? + current_path == page_path + end + + def has_error?(translation_key) + page.has_content?(translate(translation_key)) + end + + def translate(key) + I18n.translate(key) + end +end |
