Sha256: cba4062ade5b3466203d69597cecf360b93198170904c642ea5a5649be5db19d

Contents?: true

Size: 1.81 KB

Versions: 25

Compression:

Stored size: 1.81 KB

Contents

require 'test_helper'

class User::ArticleShowPageTest < IT
  include Loco::Emitter
  include CommonHelpers
  include UserHelpers

  def setup
    super
    delete_cookies
    sign_in_user 'zbigniew.humeniuk@example.com', 'secret'
    within("#article_#{articles(:two).id}"){ click_link 'Show' }
  end

  test "should publish article" do
    click_link 'Publish'
    assert page.has_content? 'Published!'
  end

  test "should auto update article" do
    assert_not page.has_content? 'WiAR'
    update_article :two
    within "#article_title" do
      assert page.has_content? 'WiAR'
    end
    within "#article_text" do
      assert page.has_content?('Lorem Ipsum II' * 8)
    end
  end

  test "should auto load new comments" do
    within "#comments" do
      assert_not page.has_content? 'Some nice thoughts dude'
    end
    create_comment_for_article :two
    within "#comments" do
      assert page.has_content? 'Some nice thoughts dude'
    end
  end

  test "should auto update comment" do
    comment = create_comment_for_article :two
    visit "/user/articles/#{articles(:two).id}"
    within "#comments" do
      assert_not page.has_content? 'Some nice thoughts dude (edited)'
    end
    update_comment comment
    within "#comments" do
      assert page.has_content? 'Some nice thoughts dude (edited)'
    end
  end

  test "should auto remove comment if was destroyed" do
    comment = create_comment_for_article :two
    within "#comments" do
      assert page.has_content? 'Some nice thoughts dude'
    end
    destroy_comment comment
    sleep 1
    within "#comments" do
      assert_not page.has_content? 'Some nice thoughts dude'
    end
  end

  test "should auto redirect to list of articles if article has been deleted" do
    sleep 0.1
    destroy_article :two
    assert page.has_content? 'Article has been deleted.'
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
loco-rails-3.0.5 test/integration/user/article_show_page_test.rb
loco-rails-3.0.4 test/integration/user/article_show_page_test.rb
loco-rails-3.0.3 test/integration/user/article_show_page_test.rb
loco-rails-2.5.3 test/integration/user/article_show_page_test.rb
loco-rails-2.5.2 test/integration/user/article_show_page_test.rb
loco-rails-3.0.2 test/integration/user/article_show_page_test.rb
loco-rails-3.0.1 test/integration/user/article_show_page_test.rb
loco-rails-2.5.1 test/integration/user/article_show_page_test.rb
loco-rails-2.5.0 test/integration/user/article_show_page_test.rb
loco-rails-2.4.0 test/integration/user/article_show_page_test.rb
loco-rails-2.3.0 test/integration/user/article_show_page_test.rb
loco-rails-3.0.0 test/integration/user/article_show_page_test.rb
loco-rails-2.2.2 test/integration/user/article_show_page_test.rb
loco-rails-2.2.1 test/integration/user/article_show_page_test.rb
loco-rails-2.2.0 test/integration/user/article_show_page_test.rb
loco-rails-2.1.0 test/integration/user/article_show_page_test.rb
loco-rails-2.0.0 test/integration/user/article_show_page_test.rb
loco-rails-1.5.2 test/integration/user/article_show_page_test.rb
loco-rails-1.5.1 test/integration/user/article_show_page_test.rb
loco-rails-1.5.0 test/integration/user/article_show_page_test.rb