Sha256: 2c775a99c27b5186f9736c9f720a7f5b8d882a9e2d441c86a2d842db696d36dc

Contents?: true

Size: 971 Bytes

Versions: 1

Compression:

Stored size: 971 Bytes

Contents

require 'test_helper'

class FormObjectTest < TestCase
  def setup
    @form = Filter.new(query: "find me")
    @base_form = BaseAuthForm.new(email: "test@example.com", name: "test")
    @twitter_form = TwitterAuthForm.new
  end

  def test_should_form_not_persisted
    assert !@form.persisted?
  end

  def test_form_should_have_query_attribute
    assert "find me", @form.query
  end

  def test_should_be_valid_form
    assert @form.valid?
    assert @base_form.valid?
  end

  def test_should_be_invalid_with_empty_query
    @form.query = ""
    assert @form.invalid?
  end

  def test_should_have_not_nil_created_at_attribute
    assert_kind_of DateTime, @form.created_at
    assert @form.created_at.present?
  end

  def test_base_form_have_a_model
    assert_equal User, @base_form.class.model
  end

  def test_form_should_have_name
    assert_equal :base_auth, @base_form.class.form_name
    assert_equal :twitter_auth, @twitter_form.class.form_name
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
form_object-0.1.1 test/lib/form_object_test.rb