Top Level Namespace

Defined Under Namespace

Modules: DefaultConfigLoader, GeneratorHelpers, HotGlue, HotGlueHelper, LayoutStrategy Classes: AssociationField, AttachmentField, BooleanField, DateField, DateTimeField, EnumField, Field, FieldFactory, FloatField, IntegerField, RelatedSetField, StringField, TextField, TimeField, UUIDField

Instance Method Summary collapse

Instance Method Details

#login_as(user) ⇒ Object



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/generators/hot_glue/templates/capybara_login.rb', line 1

def (user)
  visit '/users/sign_in'
  within("#new_user") do
    fill_in 'Email', with: user.email
    fill_in 'Password', with: 'password'
  end
  click_button 'Log in'

  # headless Chrome/Selenium occasionally drops this click without submitting
  # the form at all (confirmed via server log: no POST /users/sign_in received).
  # Retry once before failing for real.
  click_button 'Log in' unless page.has_content?('Signed in successfully', wait: 3)

  expect(page).to have_content("Signed in successfully")
end