Sha256: 21cdb23cad808d783e968841f49469eda2ac0d0c6eb809bff6b7fafe4d91033d

Contents?: true

Size: 1.03 KB

Versions: 31

Compression:

Stored size: 1.03 KB

Contents

require 'test_helper'

class ThisorthatTest < ActionDispatch::IntegrationTest

  test "should be able to pick winners" do
    VCR.use_cassette('battle_images') do
      visit(lentil.thisorthat_battle_path)

      battle_images = all('form .battle-image-wrap')
      assert_equal(2, battle_images.length)

      buttons = all('.btn-large.battle-form')
      images_ids = buttons.map{|btn| btn[:value]}
      buttons.first.click

      # check for the presence of the results
      assert page.has_selector?("#image_#{images_ids.first}")
      assert page.has_selector?("#image_#{images_ids.last}")

      # check that there are again two images entered into battle
      battle_images = all('form .battle-image-wrap')
      assert_equal(2, battle_images.length)
    end
  end

  test "should see an error message when no images are present" do
    Lentil::Image.all.each{|image| image.destroy}
    visit(lentil.thisorthat_battle_path)
    assert page.has_content?('Error')
    assert page.has_content?('If the problem persists, please e-mail')
  end

end

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
lentil-1.0.5 test/integration/lentil/thisorthat_test.rb
lentil-1.0.4 test/integration/lentil/thisorthat_test.rb
lentil-1.0.3 test/integration/lentil/thisorthat_test.rb
lentil-1.0.2 test/integration/lentil/thisorthat_test.rb
lentil-1.0.1 test/integration/lentil/thisorthat_test.rb
lentil-1.0.0 test/integration/lentil/thisorthat_test.rb
lentil-0.9.0 test/integration/lentil/thisorthat_test.rb
lentil-0.8.0 test/integration/lentil/thisorthat_test.rb
lentil-0.7.1 test/integration/lentil/thisorthat_test.rb
lentil-0.6.0 test/integration/lentil/thisorthat_test.rb
lentil-0.5.2 test/integration/lentil/thisorthat_test.rb
lentil-0.5.1 test/integration/lentil/thisorthat_test.rb
lentil-0.5.0 test/integration/lentil/thisorthat_test.rb
lentil-0.4.2 test/integration/lentil/thisorthat_test.rb
lentil-0.4.0 test/integration/lentil/thisorthat_test.rb
lentil-0.3.1 test/integration/lentil/thisorthat_test.rb
lentil-0.3.0 test/integration/lentil/thisorthat_test.rb
lentil-0.2.3 test/integration/lentil/thisorthat_test.rb
lentil-0.2.2 test/integration/lentil/thisorthat_test.rb
lentil-0.2.1 test/integration/lentil/thisorthat_test.rb