Sha256: e33fdf3943e9c7978d498398864f95850439187ed131d0d0fc4cc8e0c4786cf9

Contents?: true

Size: 720 Bytes

Versions: 1

Compression:

Stored size: 720 Bytes

Contents

require File.dirname(__FILE__) + '/../test_helper'

class JSONSerializerTest < ActiveRecord::TestCase
  def setup
    @red = create_color(:name => 'red')
    @car = create_car(:name => 'Ford Mustang', :color => @red)
    @json = @car.to_json
  end
  
  def test_should_include_enumeration_in_json
    assert_match %r{"color":\s*"red"}, @json
  end
  
  def test_should_render_other_attributes
    assert_match %r{"id":\s*#{@car.id}}, @json
    assert_match %r{"name":\s*"Ford Mustang"}, @json
  end
end

class JSONSerializerForPluginModelTest < ActiveRecord::TestCase
  def setup
    @tag = create_tag(:name => 'rails')
  end
  
  def test_should_serialize
    assert_match %r{"name":\s*"rails"}, @tag.to_json
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
enumerate_by-0.4.4 test/unit/json_serializer_test.rb