first spec

This commit is contained in:
2022-03-31 15:53:39 +03:00
parent 9d9314317f
commit 0297c57361
17 changed files with 221 additions and 29 deletions

View File

@ -0,0 +1,31 @@
module RequestHelper
def ensure_path path
expect(page.current_path).to eq path
end
def visit_path path
visit path
expect(status_code).to be 200
expect(page).not_to have_css(".translation_missing")
ensure_path path
end
def ensure_admin
admin = Clerk.where(:admin => true).first
admin = create :admin unless admin
expect(admin).not_to be nil
admin
end
def sign_in
admin = ensure_admin
visit sign_in_path
fill_in "email" , :with => admin.email
fill_in "password" , :with => "password"
click_button I18n.t(:sign_in)
expect(page).to have_content I18n.t(:baskets)
end
end
RSpec.configure do |config|
config.include RequestHelper
end