Sha256: cffee8d4c26af03a91fd2369ae4548dfe6e2a23a91d4c8f9ba4b8c279cabf5a6

Contents?: true

Size: 668 Bytes

Versions: 7

Compression:

Stored size: 668 Bytes

Contents

require 'helper'
require 'parse_resource'

class Post < ParseResource
  fields :title, :body, :author
  validates_presence_of :title
end

class Tweet < ParseResource
end

class TestParseResource < Test::Unit::TestCase

  def test_initialize_without_args
    assert Post.new.is_a?(Post)
    assert Tweet.new.is_a?(Tweet)
  end

  def test_initialize_with_args
    p = Post.new(:title => "title1", :body => "ipso")
    t = Tweet.new(:user => "aplusk")
    assert_equal p.title, "title1"
    assert_equal p.body, "ipso"
    assert_equal t.user, "aplusk"
  end

  def test_validation
    p = Post.new
    assert !p.valid?
    p.title = "foo"
    assert p.valid?
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
parse_resource-1.5.9 test/test_parse_resource.rb
parse_resource-1.5.8 test/test_parse_resource.rb
parse_resource-1.5.7 test/test_parse_resource.rb
parse_resource-1.5.6 test/test_parse_resource.rb
parse_resource-1.5.5 test/test_parse_resource.rb
parse_resource-1.5.4 test/test_parse_resource.rb
parse_resource-1.5.2 test/test_parse_resource.rb