summaryrefslogtreecommitdiff
path: root/spec/support/page_model.rb
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2014-12-28 09:28:08 -0700
committermo khan <mo@mokhan.ca>2014-12-28 09:28:08 -0700
commit24d148decc46704887e4ededb79f4152c1c34584 (patch)
tree3bad541abce70d3c4aba7b55e106379ab5107954 /spec/support/page_model.rb
parent23f025324d26dc0b68b9aa786b24faf90472e0f5 (diff)
move pag model up a directory.main
Diffstat (limited to 'spec/support/page_model.rb')
-rw-r--r--spec/support/page_model.rb26
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