Sha256: 282b3c940c8def8cf3532f99e09d310dc6ce54752dcbe6f751621f6d23c61253

Contents?: true

Size: 1.12 KB

Versions: 6

Compression:

Stored size: 1.12 KB

Contents

class CubismHelperTest < ActionView::TestCase
  include CubismHelper

  setup do
    @post = posts(:one)
    @user = users(:one)
  end

  teardown do
    Cubism.block_store.clear
  end

  test "it displays a cubicle element for a resource" do
    element = Nokogiri::HTML.fragment(cubicle_for(@post, @user) { |users| })

    cubicle_element = element.children.first

    assert_equal "cubicle-element", cubicle_element.name
    assert_equal "connect", cubicle_element["appear-trigger"]
    assert_nil cubicle_element["disappear-trigger"]
    assert_nil cubicle_element["trigger-root"]
    assert cubicle_element["exclude-current-user"]

    refute_nil cubicle_element["id"]
  end

  test "it passes html_options" do
    element = Nokogiri::HTML.fragment(cubicle_for(@post, @user, html_options: {class: "my-class1 my-class2"}) { |users| })
    cubicle_element = element.children.first

    assert_equal "my-class1 my-class2", cubicle_element["class"]
  end

  test "it stores the passed block in the global store" do
    Nokogiri::HTML.fragment(cubicle_for(@post, @user) { |present_users| })

    assert_equal 1, Cubism.block_store.size
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
cubism-0.2.0 test/helpers/cubism_helper_test.rb
cubism-0.1.1 test/helpers/cubism_helper_test.rb
cubism-0.1.0 test/helpers/cubism_helper_test.rb
cubism-0.1.0.rc2 test/helpers/cubism_helper_test.rb
cubism-0.1.0.rc1 test/helpers/cubism_helper_test.rb
cubism-0.1.0.pre13 test/helpers/cubism_helper_test.rb