Sha256: e344acd2c95bc57fa68ceff5bca1a39f21c3ead943fc51473369e2127f9437cd

Contents?: true

Size: 1.96 KB

Versions: 33

Compression:

Stored size: 1.96 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', type: :feature 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', type: :feature 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', type: :feature 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

33 entries across 33 versions & 1 rubygems

Version Path
volt-0.9.7.pre8 spec/integration/list_spec.rb
volt-0.9.7.pre7 spec/integration/list_spec.rb
volt-0.9.7.pre6 spec/integration/list_spec.rb
volt-0.9.7.pre5 spec/integration/list_spec.rb
volt-0.9.7.pre3 spec/integration/list_spec.rb
volt-0.9.7.pre2 spec/integration/list_spec.rb
volt-0.9.6 spec/integration/list_spec.rb
volt-0.9.6.pre3 spec/integration/list_spec.rb
volt-0.9.6.pre2 spec/integration/list_spec.rb
volt-0.9.6.pre1 spec/integration/list_spec.rb
volt-0.9.5 spec/integration/list_spec.rb
volt-0.9.5.pre12 spec/integration/list_spec.rb
volt-0.9.5.pre11 spec/integration/list_spec.rb
volt-0.9.5.pre9 spec/integration/list_spec.rb
volt-0.9.5.pre8 spec/integration/list_spec.rb
volt-0.9.5.pre7 spec/integration/list_spec.rb
volt-0.9.5.pre6 spec/integration/list_spec.rb
volt-0.9.5.pre5 spec/integration/list_spec.rb
volt-0.9.5.pre4 spec/integration/list_spec.rb
volt-0.9.5.pre3 spec/integration/list_spec.rb