File: test_helpers.rb

package info (click to toggle)
ruby-rabl-rails 0.6.2-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 288 kB
  • sloc: ruby: 1,630; makefile: 4
file content (23 lines) | stat: -rw-r--r-- 554 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
require 'helper'
require 'set'

class TestHelpers < Minitest::Test
  include RablRails::Helpers

  def test_collection_with_default
    assert collection?(['foo'])
    refute collection?(User.new(1))
  end

  NotACollection = Class.new do
    def each; end
  end

  def test_collection_with_configuration
    assert collection?(NotACollection.new)

    with_configuration(:non_collection_classes, Set.new(['Struct', 'TestHelpers::NotACollection'])) do
      refute collection?(NotACollection.new), 'NotACollection triggers #collection?'
    end
  end
end