Sha256: 981dca4aef54f9bb091c3c53934b2c84068bead312d4b57c693aa99ddfbc7c8e

Contents?: true

Size: 1.11 KB

Versions: 6

Compression:

Stored size: 1.11 KB

Contents

require 'spec_helper'

describe 'todos app', type: :feature, sauce: true do
  ENTER_KEY = ENV["BROWSER"] == 'phantom' ? :Enter : :return
  it 'should add a todo and remove it' do
    visit '/todos'
    store._todos

    fill_in 'newtodo', with: 'Todo 1'
    find('#newtodo').native.send_keys(ENTER_KEY)

    expect(page).to have_content('Todo 1')

    expect(find('#newtodo').value).to eq('')

    click_button 'X'

    expect(page).to_not have_content('Todo 1')

    # Make sure it deleted
    if ENV['BROWSER'] == 'phantom'
      visit '/todos'
    else
      page.driver.browser.navigate.refresh
    end
    expect(page).to_not have_content('Todo 1')
  end

  it 'should update a todo check state and persist' do
    visit '/todos'
    store._todos

    fill_in 'newtodo', with: 'Todo 1'
    find('#newtodo').native.send_keys(ENTER_KEY)

    expect(page).to have_content('Todo 1')

    find("input[type='checkbox']").click

    if ENV['BROWSER'] == 'phantom'
      visit '/todos'
    else
      page.evaluate_script('document.location.reload()')
    end

    expect(find("input[type='checkbox']").checked?).to eq(true)
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
volt-0.9.7.pre8 spec/integration/todos_spec.rb
volt-0.9.7.pre7 spec/integration/todos_spec.rb
volt-0.9.7.pre6 spec/integration/todos_spec.rb
volt-0.9.7.pre5 spec/integration/todos_spec.rb
volt-0.9.7.pre3 spec/integration/todos_spec.rb
volt-0.9.7.pre2 spec/integration/todos_spec.rb