dima-ruboss4ruby 1.0.5 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (106) hide show
  1. data/History.txt +2 -3
  2. data/Manifest.txt +46 -37
  3. data/README.rdoc +12 -10
  4. data/Rakefile +37 -0
  5. data/app_generators/ruboss_app/USAGE +13 -0
  6. data/app_generators/ruboss_app/ruboss_app_generator.rb +88 -0
  7. data/{merb_generators/templates/ruboss_config → app_generators/ruboss_app/templates}/actionscript.properties +1 -1
  8. data/{merb_generators/templates/ruboss_config → app_generators/ruboss_app/templates}/actionscriptair.properties +0 -0
  9. data/app_generators/ruboss_app/templates/default_tasks.rake +51 -0
  10. data/{merb_generators/templates/ruboss_config → app_generators/ruboss_app/templates}/expressInstall.swf +0 -0
  11. data/{merb_generators/templates/ruboss_config → app_generators/ruboss_app/templates}/flex.properties +0 -0
  12. data/app_generators/ruboss_app/templates/generate.rb +21 -0
  13. data/{merb_generators/templates/ruboss_config → app_generators/ruboss_app/templates}/html-template/AC_OETags.js +0 -0
  14. data/{merb_generators/templates/ruboss_config → app_generators/ruboss_app/templates}/html-template/history/history.css +0 -0
  15. data/{merb_generators/templates/ruboss_config → app_generators/ruboss_app/templates}/html-template/history/history.js +0 -0
  16. data/{merb_generators/templates/ruboss_config → app_generators/ruboss_app/templates}/html-template/history/historyFrame.html +0 -0
  17. data/{merb_generators/templates/ruboss_config → app_generators/ruboss_app/templates}/html-template/index.template.html +0 -0
  18. data/{merb_generators/templates/ruboss_config → app_generators/ruboss_app/templates}/html-template/playerProductInstall.swf +0 -0
  19. data/{merb_generators/templates/ruboss_config → app_generators/ruboss_app/templates}/index.html.erb +2 -2
  20. data/{merb_generators/templates/ruboss_config → app_generators/ruboss_app/templates}/mainair-app.xml +3 -3
  21. data/app_generators/ruboss_app/templates/mainapp-config.xml +21 -0
  22. data/{merb_generators/templates/ruboss_flex_app → app_generators/ruboss_app/templates}/mainapp.mxml +6 -9
  23. data/app_generators/ruboss_app/templates/project-textmate.erb +52 -0
  24. data/{merb_generators/templates/ruboss_config → app_generators/ruboss_app/templates}/project.properties +0 -0
  25. data/{merb_generators/templates/ruboss_config → app_generators/ruboss_app/templates}/projectair.properties +0 -0
  26. data/{merb_generators/templates/ruboss_config → app_generators/ruboss_app/templates}/swfobject.js +0 -0
  27. data/bin/ruboss-gen +17 -0
  28. data/generators/ruboss_config/USAGE +5 -0
  29. data/generators/ruboss_config/ruboss_config_generator.rb +24 -0
  30. data/generators/ruboss_controller/USAGE +10 -0
  31. data/generators/ruboss_controller/ruboss_controller_generator.rb +34 -0
  32. data/{merb_generators/templates/ruboss_controller → generators/ruboss_controller/templates}/controller.as.erb +0 -4
  33. data/generators/ruboss_main_app/USAGE +8 -0
  34. data/generators/ruboss_main_app/ruboss_main_app_generator.rb +46 -0
  35. data/generators/ruboss_main_app/templates/mainapp.mxml +31 -0
  36. data/generators/ruboss_scaffold/USAGE +29 -0
  37. data/generators/ruboss_scaffold/ruboss_scaffold_generator.rb +117 -0
  38. data/generators/ruboss_scaffold/templates/component.mxml.erb +149 -0
  39. data/generators/ruboss_scaffold/templates/model.as.erb +42 -0
  40. data/generators/ruboss_yaml_scaffold/USAGE +7 -0
  41. data/generators/ruboss_yaml_scaffold/ruboss_yaml_scaffold_generator.rb +43 -0
  42. data/lib/ruboss4ruby/active_foo.rb +0 -64
  43. data/lib/ruboss4ruby/active_record_default_methods.rb +54 -0
  44. data/lib/ruboss4ruby/configuration.rb +13 -28
  45. data/lib/ruboss4ruby/datamapper_foo.rb +1 -1
  46. data/lib/ruboss4ruby/rails/recipes.rb +58 -0
  47. data/lib/ruboss4ruby/rails/swf_helper.rb +59 -0
  48. data/lib/ruboss4ruby/tasks.rb +1 -1
  49. data/lib/ruboss4ruby.rb +35 -15
  50. data/rails_generators/ruboss_config/ruboss_config_generator.rb +2 -2
  51. data/rails_generators/ruboss_config/templates/mainair-app.xml +2 -2
  52. data/rails_generators/ruboss_controller/USAGE +1 -2
  53. data/rails_generators/ruboss_controller/ruboss_controller_generator.rb +1 -1
  54. data/rails_generators/ruboss_scaffold/ruboss_scaffold_generator.rb +1 -1
  55. data/rails_generators/ruboss_scaffold/templates/component.mxml.erb +69 -69
  56. data/rails_generators/ruboss_scaffold/templates/model.as.erb +1 -1
  57. data/ruboss4ruby.gemspec +43 -0
  58. data/spec/ruboss4ruby_spec.rb +7 -0
  59. data/spec/spec_helper.rb +16 -0
  60. data/test/rails/controllers/application.rb +15 -0
  61. data/test/rails/controllers/locations_controller.rb +93 -0
  62. data/test/rails/controllers/notes_controller.rb +96 -0
  63. data/test/rails/controllers/projects_controller.rb +93 -0
  64. data/test/rails/controllers/tasks_controller.rb +93 -0
  65. data/test/rails/controllers/users_controller.rb +93 -0
  66. data/test/rails/database.yml +4 -0
  67. data/test/rails/fixtures/locations.yml +8 -0
  68. data/test/rails/fixtures/notes.yml +17 -0
  69. data/test/rails/fixtures/projects.yml +25 -0
  70. data/test/rails/fixtures/simple_properties.yml +19 -0
  71. data/test/rails/fixtures/tasks.yml +46 -0
  72. data/test/rails/fixtures/users.yml +13 -0
  73. data/test/rails/helpers/functional_test_helper.rb +21 -0
  74. data/test/rails/helpers/test_helper.rb +61 -0
  75. data/test/rails/helpers/unit_test_helper.rb +30 -0
  76. data/test/rails/model.yml +35 -0
  77. data/test/rails/models/location.rb +4 -0
  78. data/test/rails/models/note.rb +3 -0
  79. data/test/rails/models/project.rb +4 -0
  80. data/test/rails/models/simple_property.rb +2 -0
  81. data/test/rails/models/task.rb +20 -0
  82. data/test/rails/models/user.rb +22 -0
  83. data/test/rails/playing_around_in_a_console.txt +71 -0
  84. data/test/rails/schema.rb +77 -0
  85. data/test/rails/test.swf +1 -0
  86. data/test/rails/test_active_foo.rb +81 -0
  87. data/test/rails/test_ruboss_rails_integration_functional.rb +22 -0
  88. data/test/rails/test_to_fxml.rb +77 -0
  89. data/test/rails/test_to_json.rb +23 -0
  90. data/test/rails/views/notes/empty_params_action.html.erb +1 -0
  91. data/test/rails/views/notes/index.html.erb +1 -0
  92. metadata +121 -92
  93. data/Generators +0 -7
  94. data/lib/ruboss4ruby/generated_attribute.rb +0 -61
  95. data/merb_generators/ruboss_config.rb +0 -103
  96. data/merb_generators/ruboss_controller.rb +0 -59
  97. data/merb_generators/ruboss_flex_app.rb +0 -67
  98. data/merb_generators/ruboss_resource.rb +0 -37
  99. data/merb_generators/ruboss_resource_controller.rb +0 -80
  100. data/merb_generators/ruboss_scaffold.rb +0 -157
  101. data/merb_generators/templates/ruboss_config/ruboss.yml +0 -16
  102. data/merb_generators/templates/ruboss_resource_controller/controller_ar.rb.erb +0 -49
  103. data/merb_generators/templates/ruboss_resource_controller/controller_dm.rb.erb +0 -46
  104. data/merb_generators/templates/ruboss_resource_controller/spec/controllers/%file_name%_spec.rb +0 -7
  105. data/merb_generators/templates/ruboss_resource_controller/spec/requests/%file_name%_spec.rb +0 -1
  106. data/merb_generators/templates/ruboss_resource_controller/test/controllers/%file_name%_test.rb +0 -17
@@ -0,0 +1,61 @@
1
+ RAILS_ROOT = File.join(File.dirname(__FILE__), '..') unless defined? RAILS_ROOT
2
+
3
+ require 'rubygems'
4
+ require 'test/unit'
5
+
6
+ require 'active_support'
7
+ require 'active_support/test_case'
8
+ require 'active_record'
9
+ require 'active_record/fixtures'
10
+ require 'action_controller'
11
+ require 'action_controller/test_case'
12
+ require 'action_controller/assertions'
13
+ require 'action_controller/test_process'
14
+ require 'action_controller/integration'
15
+ require 'sqlite3'
16
+ require File.join(File.dirname(__FILE__), '..', '..', '..', 'lib', 'ruboss4ruby')
17
+ require File.join(File.dirname(__FILE__), '..', 'models', 'note')
18
+ require File.join(File.dirname(__FILE__), '..', 'models', 'user')
19
+ require File.join(File.dirname(__FILE__), '..', 'models', 'project')
20
+ require File.join(File.dirname(__FILE__), '..', 'models', 'location')
21
+ require File.join(File.dirname(__FILE__), '..', 'models', 'task')
22
+ require File.join(File.dirname(__FILE__), '..', 'models', 'simple_property')
23
+
24
+ class MockResponse
25
+ attr_reader :body, :content_type
26
+
27
+ def initialize(body, content_type = 'xml')
28
+ @body = body
29
+ @content_type = content_type
30
+ end
31
+
32
+ end
33
+
34
+ class Test::Unit::TestCase #:nodoc:
35
+ # Turn off transactional fixtures if you're working with MyISAM tables in MySQL
36
+ self.use_transactional_fixtures = true
37
+
38
+ # Instantiated fixtures are slow, but give you @david where you otherwise would need people(:david)
39
+ self.use_instantiated_fixtures = true
40
+
41
+ # Add more helper methods to be used by all tests here...
42
+
43
+ # Use this to test xml or fxml responses in unit tests. For example,
44
+ # set_response_to user.to_fxml
45
+ # assert_xml_select 'user name', 'quentin'
46
+ def set_response_to(response, content_type = 'xml')
47
+ @response = MockResponse.new(response, content_type)
48
+ end
49
+
50
+ # Make xml functional testing work.
51
+ # From http://weblog.jamisbuck.org/2007/1/4/assert_xml_select
52
+ def xml_document
53
+ @xml_document ||= HTML::Document.new(@response.body, false, true)
54
+ end
55
+
56
+ def assert_xml_select(*args, &block)
57
+ @html_document = xml_document
58
+ assert_select(*args, &block)
59
+ end
60
+
61
+ end
@@ -0,0 +1,30 @@
1
+ RAILS_ROOT = File.join(File.dirname(__FILE__), '..') unless defined? RAILS_ROOT
2
+
3
+ $:.unshift(File.dirname(__FILE__) + '/../..')
4
+ $:.unshift(File.dirname(__FILE__) + '/../../lib')
5
+ schema_file = File.join(File.dirname(__FILE__), '..', 'schema.rb')
6
+
7
+ require 'rubygems'
8
+ require 'test/unit'
9
+
10
+ require 'active_support'
11
+ require 'active_support/test_case'
12
+ require 'active_record'
13
+ require 'active_record/fixtures'
14
+ require 'action_controller'
15
+ require 'action_controller/test_case'
16
+ require 'action_controller/assertions'
17
+ require 'action_controller/test_process'
18
+ require 'action_controller/integration'
19
+ require 'sqlite3'
20
+
21
+ require File.join(File.dirname(__FILE__), '..', '..', '..', 'lib', 'ruboss4ruby')
22
+
23
+ config = YAML::load(IO.read(File.join(File.dirname(__FILE__), '..', 'database.yml')))[ENV['DB'] || 'test']
24
+ ActiveRecord::Base.configurations = config
25
+ ActiveRecord::Base.establish_connection(config)
26
+
27
+ load(schema_file) if File.exist?(schema_file)
28
+
29
+ Test::Unit::TestCase.fixture_path = File.join(File.dirname(__FILE__), '..', 'fixtures')
30
+ $:.unshift(Test::Unit::TestCase.fixture_path)
@@ -0,0 +1,35 @@
1
+ project:
2
+ - name: string
3
+ - notes: text
4
+ - start_date: date
5
+ - end_date: date
6
+ - completed: boolean
7
+ - belongs_to: [user]
8
+ - has_many: [tasks]
9
+
10
+ location:
11
+ - name: string
12
+ - notes: text
13
+ - belongs_to: [user]
14
+ - has_many: [tasks]
15
+
16
+ task:
17
+ - name: string
18
+ - notes: text
19
+ - start_time: datetime
20
+ - end_time: datetime
21
+ - completed: boolean
22
+ - next_action: boolean
23
+ - belongs_to: [project, location, user]
24
+
25
+ note:
26
+ - content: text
27
+ - belongs_to: [user]
28
+
29
+ user:
30
+ - login: string
31
+ - first_name: string
32
+ - last_name: string
33
+ - email: string
34
+ - has_many: [tasks, projects, locations]
35
+ - has_one: [note]
@@ -0,0 +1,4 @@
1
+ class Location < ActiveRecord::Base
2
+ belongs_to :user
3
+ has_many :tasks
4
+ end
@@ -0,0 +1,3 @@
1
+ class Note < ActiveRecord::Base
2
+ belongs_to :user
3
+ end
@@ -0,0 +1,4 @@
1
+ class Project < ActiveRecord::Base
2
+ belongs_to :user
3
+ has_many :tasks
4
+ end
@@ -0,0 +1,2 @@
1
+ class SimpleProperty < ActiveRecord::Base
2
+ end
@@ -0,0 +1,20 @@
1
+ class Task < ActiveRecord::Base
2
+ belongs_to :project
3
+ belongs_to :location
4
+ belongs_to :user
5
+
6
+ default_methods :is_active
7
+
8
+ def is_active
9
+ case
10
+ when start_time && end_time
11
+ (start_time .. end_time) === Time.now
12
+ when start_time && end_time.nil?
13
+ start_time <= Time.now
14
+ when start_time.nil && end_time
15
+ end_time >= Time.now
16
+ else
17
+ true
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,22 @@
1
+ class User < ActiveRecord::Base
2
+ has_one :note
3
+ has_many :tasks
4
+ has_many :projects
5
+ has_many :locations
6
+
7
+ default_methods :full_name, :has_nothing_to_do
8
+
9
+ validates_length_of :login, :maximum => 10
10
+
11
+ def full_name
12
+ "#{first_name} #{last_name}"
13
+ end
14
+
15
+ def has_nothing_to_do
16
+ tasks.all? {|task| task.completed}
17
+ end
18
+
19
+ def email_host
20
+ email.split('@').last
21
+ end
22
+ end
@@ -0,0 +1,71 @@
1
+ To play with the test models in a console, do this:
2
+
3
+ $> irb -r test/helpers/test_helper.rb -r test/helpers/unit_test_helper.rb
4
+
5
+ You can then do things like this:
6
+
7
+ $> irb -r test/helpers/test_helper.rb -r test/helpers/unit_test_helper.rb
8
+ -- create_table("locations", {:force=>true})
9
+ -> 0.0170s
10
+ -- create_table("notes", {:force=>true})
11
+ -> 0.0091s
12
+ -- create_table("projects", {:force=>true})
13
+ -> 0.0091s
14
+ -- create_table("tasks", {:force=>true})
15
+ -> 0.0098s
16
+ -- create_table("users", {:force=>true})
17
+ -> 0.0506s
18
+ -- initialize_schema_migrations_table()
19
+ -> 0.0010s
20
+ -- assume_migrated_upto_version(20080729045550)
21
+ -> 0.0009s
22
+ >> u = User.create(:login => 'spatten')
23
+ => #<User id: 1, login: "spatten", first_name: nil, last_name: nil, email: nil, created_at: "2008-10-15 17:29:36", updated_at: "2008-10-15 17:29:36">
24
+ >> u.tasks << Task.create
25
+ => [#<Task id: 1, name: nil, notes: nil, start_time: nil, end_time: nil, completed: nil, next_action: nil, project_id: nil, location_id: nil, user_id: 1, created_at: "2008-10-15 17:29:48", updated_at: "2008-10-15 17:29:48">]
26
+ >> u.projects << Project.create
27
+ => [#<Project id: 1, name: nil, notes: nil, start_date: nil, end_date: nil, completed: nil, user_id: 1, created_at: "2008-10-15 17:29:54", updated_at: "2008-10-15 17:29:54">]
28
+ >> puts u.to_fxml
29
+ <?xml version="1.0" encoding="UTF-8"?>
30
+ <user>
31
+ <created_at type="datetime">2008/10/15 17:29:36</created_at>
32
+ <email nil="true"></email>
33
+ <first_name nil="true"></first_name>
34
+ <id type="integer">1</id>
35
+ <last_name nil="true"></last_name>
36
+ <login>spatten</login>
37
+ <updated_at type="datetime">2008/10/15 17:29:36</updated_at>
38
+ <full_name> </full_name>
39
+ <has_nothing_to_do type="boolean">false</has_nothing_to_do>
40
+ <tasks type="array">
41
+ <task>
42
+ <completed type="boolean" nil="true"></completed>
43
+ <created_at type="datetime">2008/10/15 17:29:48</created_at>
44
+ <end_time type="datetime" nil="true"></end_time>
45
+ <id type="integer">1</id>
46
+ <location_id type="integer" nil="true"></location_id>
47
+ <name nil="true"></name>
48
+ <next_action type="boolean" nil="true"></next_action>
49
+ <notes nil="true"></notes>
50
+ <project_id type="integer" nil="true"></project_id>
51
+ <start_time type="datetime" nil="true"></start_time>
52
+ <updated_at type="datetime">2008/10/15 17:29:48</updated_at>
53
+ <user_id type="integer">1</user_id>
54
+ </task>
55
+ </tasks>
56
+ <projects type="array">
57
+ <project>
58
+ <completed type="boolean" nil="true"></completed>
59
+ <created_at type="datetime">2008/10/15 17:29:54</created_at>
60
+ <end_date type="date" nil="true"></end_date>
61
+ <id type="integer">1</id>
62
+ <name nil="true"></name>
63
+ <notes nil="true"></notes>
64
+ <start_date type="date" nil="true"></start_date>
65
+ <updated_at type="datetime">2008/10/15 17:29:54</updated_at>
66
+ <user_id type="integer">1</user_id>
67
+ </project>
68
+ </projects>
69
+ </user>
70
+ => nil
71
+ >>
@@ -0,0 +1,77 @@
1
+ # This file is auto-generated from the current state of the database. Instead of editing this file,
2
+ # please use the migrations feature of Active Record to incrementally modify your database, and
3
+ # then regenerate this schema definition.
4
+ #
5
+ # Note that this schema.rb definition is the authoritative source for your database schema. If you need
6
+ # to create the application database on another system, you should be using db:schema:load, not running
7
+ # all the migrations from scratch. The latter is a flawed and unsustainable approach (the more migrations
8
+ # you'll amass, the slower it'll run and the greater likelihood for issues).
9
+ #
10
+ # It's strongly recommended to check this file into your version control system.
11
+
12
+ ActiveRecord::Schema.define(:version => 20080729045550) do
13
+
14
+ # standard pomodo models
15
+ create_table "locations", :force => true do |t|
16
+ t.string "name"
17
+ t.text "notes"
18
+ t.integer "user_id"
19
+ t.datetime "created_at"
20
+ t.datetime "updated_at"
21
+ end
22
+
23
+ create_table "notes", :force => true do |t|
24
+ t.text "content"
25
+ t.integer "user_id"
26
+ t.datetime "created_at"
27
+ t.datetime "updated_at"
28
+ end
29
+
30
+ create_table "projects", :force => true do |t|
31
+ t.string "name"
32
+ t.text "notes"
33
+ t.date "start_date"
34
+ t.date "end_date"
35
+ t.boolean "completed"
36
+ t.integer "user_id"
37
+ t.datetime "created_at"
38
+ t.datetime "updated_at"
39
+ end
40
+
41
+ create_table "tasks", :force => true do |t|
42
+ t.string "name"
43
+ t.text "notes"
44
+ t.datetime "start_time"
45
+ t.datetime "end_time"
46
+ t.boolean "completed"
47
+ t.boolean "next_action"
48
+ t.integer "project_id"
49
+ t.integer "location_id"
50
+ t.integer "user_id"
51
+ t.datetime "created_at"
52
+ t.datetime "updated_at"
53
+ end
54
+
55
+ create_table "users", :force => true do |t|
56
+ t.string "login"
57
+ t.string "first_name"
58
+ t.string "last_name"
59
+ t.string "email"
60
+ t.datetime "created_at"
61
+ t.datetime "updated_at"
62
+ end
63
+
64
+ # all simple properties test model
65
+ create_table "simple_properties", :force => true do |t|
66
+ t.string "name"
67
+ t.integer "amount"
68
+ t.float "price"
69
+ t.decimal "quantity"
70
+ t.boolean "available"
71
+ t.date "delivered_on"
72
+ t.datetime "created_at"
73
+ t.datetime "updated_at"
74
+ t.time "sold_on"
75
+ end
76
+
77
+ end
@@ -0,0 +1 @@
1
+ This is used for the ruboss_helper_test.rb test suite.
@@ -0,0 +1,81 @@
1
+ RAILS_ROOT = File.dirname(__FILE__) unless defined? RAILS_ROOT
2
+ require File.join(File.dirname(__FILE__), 'helpers', 'test_helper')
3
+ require File.join(File.dirname(__FILE__), 'helpers', 'unit_test_helper')
4
+
5
+ class ActiveFooTest < Test::Unit::TestCase
6
+ fixtures :all
7
+
8
+ def setup
9
+ @shakespeare = users(:shakespeare)
10
+ end
11
+
12
+ def test_user_fxml
13
+ set_response_to users(:ludwig).to_fxml
14
+ assert_xml_select 'user'
15
+ end
16
+
17
+ def test_task_fxml_has_default_method
18
+ set_response_to tasks(:haydn).to_fxml
19
+ assert_xml_select 'task is_active'
20
+ end
21
+
22
+ def test_user_fxml_includes_tasks
23
+ set_response_to users(:ludwig).to_fxml(:include => :tasks)
24
+ assert_xml_select 'user tasks task'
25
+ end
26
+
27
+ def test_user_fxml_has_nothing_to_do_method
28
+ set_response_to users(:ludwig).to_fxml
29
+ assert_xml_select 'user has_nothing_to_do'
30
+ end
31
+
32
+ def test_user_fxml_includes_default_method_from_task
33
+ set_response_to users(:ludwig).to_fxml(:include => :tasks)
34
+ assert_xml_select 'user tasks task is_active'
35
+ end
36
+ #
37
+ # def test_projects_fxml_includes_tasks
38
+ # set_response_to projects(:music).to_fxml
39
+ # assert_xml_select 'project tasks task'
40
+ # end
41
+ #
42
+ # def test_projects_with_user_included_as_symbol
43
+ # set_response_to projects(:music).to_fxml(:include => :user)
44
+ # assert_xml_select 'project user'
45
+ # end
46
+ #
47
+ # def test_includes_as_hash_returns_hashes
48
+ # assert_equal Hash.new, User.includes_as_hash
49
+ # assert_equal ({:one => 1, :two => 2}), User.includes_as_hash({:one => 1, :two => 2})
50
+ # assert_equal ({:test => {}}), User.includes_as_hash(:test)
51
+ # assert_equal ({:test1 => {}, :test2 => {}}), User.includes_as_hash([:test1, :test2])
52
+ # end
53
+ #
54
+ # def test_validates_length_of_validates_length
55
+ # assert_nothing_raised do
56
+ # @shakespeare.login = 'william_shakespeare'
57
+ # @shakespeare.save
58
+ # assert !@shakespeare.errors.empty?
59
+ # end
60
+ # @shakespeare.login = 'william'
61
+ # @shakespeare.save
62
+ # assert @shakespeare.errors.empty?
63
+ # end
64
+ #
65
+ # def test_you_can_do_to_fxml_with_validates_length
66
+ # assert_nothing_raised do
67
+ # @shakespeare.to_fxml
68
+ # end
69
+ # end
70
+ #
71
+ # def test_array_of_users_includes_default_fxml_includes
72
+ # set_response_to User.find(:all).to_fxml
73
+ # assert_xml_select 'users user tasks task'
74
+ # end
75
+ #
76
+ # def test_to_fxml_should_take_a_block
77
+ # set_response_to users(:ludwig).to_fxml {|xml| xml.test 42}
78
+ # assert_xml_select 'test', '42'
79
+ # end
80
+
81
+ end
@@ -0,0 +1,22 @@
1
+ require File.join(File.dirname(__FILE__), 'helpers', 'test_helper')
2
+ require File.join(File.dirname(__FILE__), 'helpers', 'functional_test_helper')
3
+
4
+ ActionController::Routing::Routes.draw do |map|
5
+ map.connect ':controller/:action/:id'
6
+ end
7
+
8
+ class RubossRailsIntegrationFunctionalTest < Test::Unit::TestCase
9
+ fixtures :all
10
+
11
+ def setup
12
+ @controller = NotesController.new()
13
+ @controller.request = @request = ActionController::TestRequest.new
14
+ @response = ActionController::TestResponse.new
15
+ end
16
+
17
+ # def test_render_with_an_empty_params_hash_should_not_blow_up
18
+ # get :empty_params_action
19
+ # assert_response :success
20
+ # end
21
+
22
+ end
@@ -0,0 +1,77 @@
1
+ $:.unshift(File.dirname(__FILE__))
2
+
3
+ require 'helpers/unit_test_helper'
4
+ require 'models/location'
5
+ require 'models/note'
6
+ require 'models/project'
7
+ require 'models/task'
8
+ require 'models/user'
9
+ require 'models/simple_property'
10
+
11
+ class ToFxmlTest < Test::Unit::TestCase
12
+ fixtures :locations, :notes, :projects, :tasks, :users, :simple_properties
13
+
14
+ def test_to_fxml_sanity
15
+ assert_nothing_raised {users(:ludwig).to_fxml}
16
+ end
17
+
18
+ def test_to_fxml_doesnt_dasherize
19
+ set_response_to users(:ludwig).to_fxml
20
+ assert_xml_select 'user first_name', 'Ludwig'
21
+ end
22
+
23
+ def test_default_xml_methods_on_user_are_included_in_fxml
24
+ set_response_to users(:ludwig).to_fxml
25
+ assert_xml_select 'user full_name', 'Ludwig van Beethoven'
26
+ assert_xml_select 'user has_nothing_to_do'
27
+ end
28
+
29
+ def test_default_xml_methods_on_user_are_included_in_fxml_if_you_call_it_twice
30
+ set_response_to users(:ludwig).to_fxml
31
+ set_response_to users(:ludwig).to_fxml
32
+ assert_xml_select 'user full_name', 'Ludwig van Beethoven'
33
+ assert_xml_select 'user has_nothing_to_do'
34
+ end
35
+
36
+ def test_default_xml_methods_exists
37
+ assert User.respond_to?(:default_methods_array)
38
+ assert_equal [:full_name, :has_nothing_to_do], User.default_methods_array
39
+ end
40
+ #
41
+ # def test_default_xml_methods_on_dependencies
42
+ # t = users(:ludwig).tasks.first
43
+ # assert t.class.respond_to?(:default_xml_methods_array)
44
+ # assert_equal [:is_active], t.class.default_xml_methods_array
45
+ # end
46
+ #
47
+ # def test_default_xml_methods_are_included_in_includes
48
+ # set_response_to users(:ludwig).to_fxml(:include => :tasks)
49
+ # assert_xml_select 'tasks task is_active'
50
+ # end
51
+ #
52
+ # def test_model_without_default_xml_methods_still_works
53
+ # assert_nothing_raised{ locations(:vienna).to_fxml }
54
+ # end
55
+ #
56
+ # def test_user_with_non_default_methods_in_to_xml
57
+ # set_response_to users(:ludwig).to_fxml(:methods => :email_host)
58
+ # assert_xml_select 'user email_host', 'vienna.de'
59
+ # assert_xml_select 'user full_name'
60
+ # end
61
+ #
62
+ # def test_model_with_default_xml_includes
63
+ # set_response_to users(:ludwig).to_fxml
64
+ # assert_xml_select 'user tasks task'
65
+ # end
66
+ #
67
+ # def test_simple_properies
68
+ # puts simple_properties
69
+ # end
70
+
71
+ # Test type=.... stuff for has_many, booleans, integers, dates, date-times
72
+
73
+ # Test empty arrays
74
+
75
+ # Test options[:except]
76
+
77
+ end
@@ -0,0 +1,23 @@
1
+ $:.unshift(File.dirname(__FILE__))
2
+
3
+ require 'helpers/unit_test_helper'
4
+ require 'models/location'
5
+ require 'models/note'
6
+ require 'models/project'
7
+ require 'models/task'
8
+ require 'models/user'
9
+ require 'models/simple_property'
10
+
11
+ class ToJsonTest < Test::Unit::TestCase
12
+ fixtures :locations, :notes, :projects, :tasks, :users, :simple_properties
13
+
14
+ def test_to_json_sanity
15
+ assert_nothing_raised {users(:ludwig).to_json}
16
+ end
17
+
18
+ def test_to_json_methods
19
+ #set_response_to users(:ludwig).to_json
20
+ #puts users(:ludwig).to_json
21
+ puts User.all.to_json
22
+ end
23
+ end
@@ -0,0 +1 @@
1
+ empty params action
@@ -0,0 +1 @@
1
+ <p>This is the note index!</p>