Sha256: a8c72327d5ba1434c14099c95d39f594fff2539df59c2344e08c0e9460a90b3e

Contents?: true

Size: 568 Bytes

Versions: 3

Compression:

Stored size: 568 Bytes

Contents

require 'test_helper'

class DismissibleBlocksControllerTest < ActionController::TestCase

  test "dismiss block via ajax" do
    session[:username] = users(:one).username # Login
    refute users(:one).dismissed_blocks.include?('lorem')
    xhr :post, :create, block: 'lorem', format: 'json'
    users(:one).reload
    assert users(:one).dismissed_blocks.include?('lorem')
    assert_response :ok
  end

  test "dismiss block fails via ajax; not logged in" do
    xhr :post, :create, block: 'lorem', format: 'json'
    assert_response :unprocessable_entity
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
dismissible_blocks-1.1.1 test/controllers/dismissible_blocks_controller_test.rb
dismissible_blocks-1.1.0 test/controllers/dismissible_blocks_controller_test.rb
dismissible_blocks-0.0.2 test/controllers/dismissible_blocks_controller_test.rb