32 lines
710 B
Ruby
32 lines
710 B
Ruby
|
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
|