Sha256: 8e1a311e69a726086319bd1e6b69dfb95bd40ffb9167d2b6713e25c31adc65c9

Contents?: true

Size: 1.92 KB

Versions: 9

Compression:

Stored size: 1.92 KB

Contents

if ENV['BROWSER'] == 'firefox'
  require 'spec_helper'

  describe 'todo example spec', type: :feature, :sauce => true do
    before do
      visit '/'

      click_link 'Todos'

      fill_in('newtodo', with: "Item 1\n")
      fill_in('newtodo', with: "Item 2\n")
      fill_in('newtodo', with: "Item 3\n")
    end

    it 'should add items to the list' do
      expect(find('#todos-table')).to have_content('Item 1')
    end

    it 'should strikethrough when the checkbox is checked' do
      box = all(:css, '#todos-table input[type=checkbox]')[0]

      expect(find('#todos-table')).to_not have_css('td.name.complete')

      box.set(true)
      expect(find('#todos-table')).to have_css('td.name.complete')

      box.set(false)
      expect(find('#todos-table')).to_not have_css('td.name.complete')
    end

    it 'should delete items' do
      expect(find('#todos-table')).to have_content('Item 1')
      expect(find('#todos-table')).to have_content('Item 2')
      expect(find('#todos-table')).to have_content('Item 3')

      # Click the middle one
      all(:css, '#todos-table button')[1].click

      expect(find('#todos-table')).to have_content('Item 1')
      expect(find('#todos-table')).to_not have_content('Item 2')
      expect(find('#todos-table')).to have_content('Item 3')
    end

    it 'should track the number of todos and the numbers that are complete' do
      count = find('#count')

      expect(count).to have_content('0 of 3')

      box1 = all(:css, '#todos-table input[type=checkbox]')[0]
      box1.set(true)

      expect(count).to have_content('1 of 3')

      all(:css, '#todos-table button')[0].click
      expect(count).to have_content('0 of 2')

      box1 = all(:css, '#todos-table input[type=checkbox]')[0]
      box1.set(true)
      expect(count).to have_content('1 of 2')

      box2 = all(:css, '#todos-table input[type=checkbox]')[1]
      box2.set(true)

      expect(count).to have_content('2 of 2')
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
volt-0.8.27.beta2 spec/integration/list_spec.rb
volt-0.8.27.beta1 spec/integration/list_spec.rb
volt-0.8.26.beta1 spec/integration/list_spec.rb
volt-0.8.26 spec/integration/list_spec.rb
volt-0.8.24 spec/integration/list_spec.rb
volt-0.8.23 spec/integration/list_spec.rb
volt-0.8.22 spec/integration/list_spec.rb
volt-0.8.22.beta2 spec/integration/list_spec.rb
volt-0.8.22.beta1 spec/integration/list_spec.rb