Sha256: 71f36c6caa9180735c2127c41d839e984085e9d0adc680b664438ee79ffd5bbe
Contents?: true
Size: 870 Bytes
Versions: 2
Compression:
Stored size: 870 Bytes
Contents
require File.join(File.dirname(__FILE__), "..", "test_helper") class ResourceFactoryTest < Test::Unit::TestCase class PetResource < ActiveResource::Base end ResourceFactory.define(:nonfiction_book) do |p| p.name "The Pragmatic Programmer" p.author "David Thomas" end context "building with resource factory" do should "have default attributes" do book = ResourceFactory.build(:nonfiction_book) assert_not_nil book.attributes[:name] end should "have a header that reflects the resource type" do book = ResourceFactory.build(:nonfiction_book) assert_match /<nonfiction-book>/, book.to_xml end should "contain the attributes inside the root" do book = ResourceFactory.build(:nonfiction_book) assert_match /<name>#{book.attributes[:name]}<\/name>/, book.to_xml end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
dpickett-resource_factory-0.5.0 | test/lib/resource_factory_test.rb |
dpickett-resource_factory-0.5.1 | test/lib/resource_factory_test.rb |