Sha256: f55665d7ede36e83f116762f7ac39d65379b46cad6ff65911661a7a1b7e37861

Contents?: true

Size: 1.61 KB

Versions: 3

Compression:

Stored size: 1.61 KB

Contents

require 'spec_helper'

describe 'user accounts', type: :feature, sauce: true do
  before(:each) do
    # Clear out db
    DataStore.new.drop_database
  end

  after(:each) do
    # Clear out db
    DataStore.new.drop_database
  end

  it 'should create an account' do
    visit '/'

    click_link 'Login'

    click_link 'Signup here'

    fields = all(:css, 'form .form-control')

    fields[0].set('test@test.com')
    fields[1].set('awes0mesEcRet')
    fields[2].set('Test Account 9550')

    click_button 'Signup'

    expect(page).to have_content('Test Account 9550')
  end

  it 'should login and logout' do
    visit '/'

    # Add the user
    store._users! << { email: 'test@test.com', password: 'awes0mesEcRet', name: 'Test Account 9550' }

    click_link 'Login'

    fields = all(:css, 'form .form-control')
    fields[0].set('test@test.com')
    fields[1].set('awes0mesEcRet')
    click_button 'Login'

    expect(page).to have_content('Test Account 9550')

    # Click the logout link
    click_link 'Test Account 9550'
    click_link 'Logout'

    expect(page).to_not have_content('Test Account 9550')
  end

  it 'should fail to create an account without a valid email and password' do
    visit '/'

    click_link 'Login'
    click_link 'Signup here'

    expect(page).to_not have_content('must be at least 8 characters')

    fields = all(:css, 'form .form-control')

    fields[0].set('test')
    fields[1].set('awe')
    fields[2].set('Tes')

    # some capybara drivers don't trigger blur correctly
    page.execute_script("$('.form-control').blur()")

    expect(page).to have_content('must be at least 8 characters')
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
volt-0.9.1.pre4 spec/integration/user_spec.rb
volt-0.9.1.pre3 spec/integration/user_spec.rb
volt-0.9.1.pre2 spec/integration/user_spec.rb