Sha256: 1fa627ce34feac067cd7628e9967bbf389e203dc0dbff86e5eadcc5ee7996539

Contents?: true

Size: 1.19 KB

Versions: 8

Compression:

Stored size: 1.19 KB

Contents

$:.unshift(File.dirname(__FILE__))

require 'helpers/unit_test_helper'
require 'models/location'
require 'models/note'
require 'models/project'
require 'models/task'
require 'models/user'
require 'models/simple_property'

class ToFxmlTest < Test::Unit::TestCase
  fixtures :locations, :notes, :projects, :tasks, :users, :simple_properties
  
  def test_to_fxml_sanity
    assert_nothing_raised {users(:ludwig).to_fxml}
  end
  
  def test_to_fxml_doesnt_dasherize
    set_response_to users(:ludwig).to_fxml
    assert_xml_select 'user first_name', 'Ludwig'    
  end
  
  def test_default_xml_methods_on_user_are_included_in_fxml
    set_response_to users(:ludwig).to_fxml(:methods => [:has_nothing_to_do, :full_name])
    assert_xml_select 'user full_name', 'Ludwig van Beethoven'
    assert_xml_select 'user has_nothing_to_do'
  end
  
  def test_default_xml_methods_on_user_are_included_in_fxml_if_you_call_it_twice
    set_response_to users(:ludwig).to_fxml(:methods => [:has_nothing_to_do, :full_name])
    set_response_to users(:ludwig).to_fxml(:methods => [:has_nothing_to_do, :full_name])
    assert_xml_select 'user full_name', 'Ludwig van Beethoven'
    assert_xml_select 'user has_nothing_to_do'
  end
end

Version data entries

8 entries across 8 versions & 4 rubygems

Version Path
dima-restfulx-1.2.0 test/rails/test_to_fxml.rb
dima-restfulx-1.2.1 test/rails/test_to_fxml.rb
dima-restfulx-1.2.2 test/rails/test_to_fxml.rb
dima-ruboss4ruby-1.1.2 test/rails/test_to_fxml.rb
restfulx-1.2.2 test/rails/test_to_fxml.rb
restfulx-1.2.1 test/rails/test_to_fxml.rb
restfulx-1.2.0 test/rails/test_to_fxml.rb
ruboss4ruby-1.1.2 test/rails/test_to_fxml.rb