Sha256: b76b0d327d85f7a4311dedfa27b12eef7dfbc096da2feaa9de7ca9eefe757975

Contents?: true

Size: 1.86 KB

Versions: 1

Compression:

Stored size: 1.86 KB

Contents

if ENV['BROWSER']
  require 'spec_helper'

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

    after(:each) do
      # Clear out db
      DataStore.new.drop_database
      # Volt::Persistors::ArrayStore.query_pool.clear
    end

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

      # sleep 300

      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

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
volt-0.8.27.beta7 spec/integration/user_spec.rb