rlmattax-restfulx 1.2.4.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +50 -0
- data/Rakefile +79 -0
- data/VERSION.yml +4 -0
- data/app_generators/rx_app/USAGE +22 -0
- data/app_generators/rx_app/rx_app_generator.rb +110 -0
- data/app_generators/rx_app/templates/actionscript.properties +16 -0
- data/app_generators/rx_app/templates/actionscriptair.properties +16 -0
- data/app_generators/rx_app/templates/app.yaml.erb +12 -0
- data/app_generators/rx_app/templates/default_tasks.rake +38 -0
- data/app_generators/rx_app/templates/empty.txt +0 -0
- data/app_generators/rx_app/templates/expressInstall.swf +0 -0
- data/app_generators/rx_app/templates/flex.properties +2 -0
- data/app_generators/rx_app/templates/generate.rb +17 -0
- data/app_generators/rx_app/templates/html-template/AC_OETags.js +276 -0
- data/app_generators/rx_app/templates/html-template/history/history.css +6 -0
- data/app_generators/rx_app/templates/html-template/history/history.js +645 -0
- data/app_generators/rx_app/templates/html-template/history/historyFrame.html +29 -0
- data/app_generators/rx_app/templates/html-template/index.template.html +121 -0
- data/app_generators/rx_app/templates/html-template/playerProductInstall.swf +0 -0
- data/app_generators/rx_app/templates/index.html.erb +18 -0
- data/app_generators/rx_app/templates/index.yaml +11 -0
- data/app_generators/rx_app/templates/mainair-app.xml +134 -0
- data/app_generators/rx_app/templates/mainapp-config.xml +22 -0
- data/app_generators/rx_app/templates/mainapp.mxml +152 -0
- data/app_generators/rx_app/templates/project-textmate.erb +72 -0
- data/app_generators/rx_app/templates/project.properties +18 -0
- data/app_generators/rx_app/templates/projectair.properties +24 -0
- data/app_generators/rx_app/templates/restfulx.yml +46 -0
- data/app_generators/rx_app/templates/swfobject.js +5 -0
- data/bin/rx-gen +31 -0
- data/lib/restfulx.rb +90 -0
- data/lib/restfulx/active_foo.rb +181 -0
- data/lib/restfulx/active_record_tasks.rb +90 -0
- data/lib/restfulx/active_record_uuid_helper.rb +17 -0
- data/lib/restfulx/configuration.rb +75 -0
- data/lib/restfulx/datamapper_foo.rb +81 -0
- data/lib/restfulx/rails/recipes.rb +60 -0
- data/lib/restfulx/rails/schema_to_yaml.rb +111 -0
- data/lib/restfulx/rails/schema_to_yaml/extensions/enumerable.rb +8 -0
- data/lib/restfulx/rails/schema_to_yaml/settings/config.rb +17 -0
- data/lib/restfulx/rails/schema_to_yaml/settings/core.rb +73 -0
- data/lib/restfulx/rails/swf_helper.rb +59 -0
- data/lib/restfulx/tasks.rb +110 -0
- data/rails_generators/rx_config/USAGE +19 -0
- data/rails_generators/rx_config/rx_config_generator.rb +151 -0
- data/rails_generators/rx_config/templates/actionscript.properties +16 -0
- data/rails_generators/rx_config/templates/actionscriptair.properties +16 -0
- data/rails_generators/rx_config/templates/expressInstall.swf +0 -0
- data/rails_generators/rx_config/templates/flex.properties +2 -0
- data/rails_generators/rx_config/templates/flex_controller.erb +4 -0
- data/rails_generators/rx_config/templates/html-template/AC_OETags.js +276 -0
- data/rails_generators/rx_config/templates/html-template/history/history.css +6 -0
- data/rails_generators/rx_config/templates/html-template/history/history.js +645 -0
- data/rails_generators/rx_config/templates/html-template/history/historyFrame.html +29 -0
- data/rails_generators/rx_config/templates/html-template/index.template.html +121 -0
- data/rails_generators/rx_config/templates/html-template/playerProductInstall.swf +0 -0
- data/rails_generators/rx_config/templates/index.erb +16 -0
- data/rails_generators/rx_config/templates/mainair-app.xml +134 -0
- data/rails_generators/rx_config/templates/mainapp-config.xml +22 -0
- data/rails_generators/rx_config/templates/mainapp.mxml +129 -0
- data/rails_generators/rx_config/templates/project-textmate.erb +72 -0
- data/rails_generators/rx_config/templates/project.properties +18 -0
- data/rails_generators/rx_config/templates/projectair.properties +24 -0
- data/rails_generators/rx_config/templates/restfulx.erb +75 -0
- data/rails_generators/rx_config/templates/restfulx.yml +65 -0
- data/rails_generators/rx_config/templates/restfulx_tasks.rake +9 -0
- data/rails_generators/rx_config/templates/routes.erb +47 -0
- data/rails_generators/rx_config/templates/session_store_flash.erb +1 -0
- data/rails_generators/rx_config/templates/swfobject.js +5 -0
- data/rails_generators/rx_controller/USAGE +10 -0
- data/rails_generators/rx_controller/rx_controller_generator.rb +31 -0
- data/rails_generators/rx_controller/templates/controller.as.erb +38 -0
- data/rails_generators/rx_main_app/USAGE +8 -0
- data/rails_generators/rx_main_app/rx_main_app_generator.rb +60 -0
- data/rails_generators/rx_main_app/templates/mainapp.mxml +129 -0
- data/rails_generators/rx_scaffold/USAGE +35 -0
- data/rails_generators/rx_scaffold/rx_scaffold_generator.rb +242 -0
- data/rails_generators/rx_scaffold/templates/controllers/default.rb.erb +125 -0
- data/rails_generators/rx_scaffold/templates/controllers/resource_controller.rb.erb +23 -0
- data/rails_generators/rx_scaffold/templates/fixtures.yml.erb +39 -0
- data/rails_generators/rx_scaffold/templates/functional_test.rb +45 -0
- data/rails_generators/rx_scaffold/templates/helper_test.rb +4 -0
- data/rails_generators/rx_scaffold/templates/layouts/default.erb +167 -0
- data/rails_generators/rx_scaffold/templates/migration.rb.erb +46 -0
- data/rails_generators/rx_scaffold/templates/model.as.erb +73 -0
- data/rails_generators/rx_scaffold/templates/model.rb.erb +46 -0
- data/rails_generators/rx_yaml_scaffold/USAGE +51 -0
- data/rails_generators/rx_yaml_scaffold/rx_yaml_scaffold_generator.rb +68 -0
- data/rxgen_generators/rx_config/USAGE +5 -0
- data/rxgen_generators/rx_config/rx_config_generator.rb +21 -0
- data/rxgen_generators/rx_controller/USAGE +10 -0
- data/rxgen_generators/rx_controller/rx_controller_generator.rb +41 -0
- data/rxgen_generators/rx_controller/templates/assist.py +65 -0
- data/rxgen_generators/rx_controller/templates/controller.as.erb +38 -0
- data/rxgen_generators/rx_controller/templates/iso8601.py +92 -0
- data/rxgen_generators/rx_controller/templates/restful.py +136 -0
- data/rxgen_generators/rx_main_app/USAGE +8 -0
- data/rxgen_generators/rx_main_app/rx_main_app_generator.rb +65 -0
- data/rxgen_generators/rx_main_app/templates/main.py.erb +29 -0
- data/rxgen_generators/rx_main_app/templates/mainapp.mxml +152 -0
- data/rxgen_generators/rx_scaffold/USAGE +29 -0
- data/rxgen_generators/rx_scaffold/rx_scaffold_generator.rb +194 -0
- data/rxgen_generators/rx_scaffold/templates/controller.py.erb +27 -0
- data/rxgen_generators/rx_scaffold/templates/layouts/default.erb +167 -0
- data/rxgen_generators/rx_scaffold/templates/model.as.erb +73 -0
- data/rxgen_generators/rx_scaffold/templates/model.py.erb +14 -0
- data/rxgen_generators/rx_yaml_scaffold/USAGE +45 -0
- data/rxgen_generators/rx_yaml_scaffold/rx_yaml_scaffold_generator.rb +47 -0
- data/spec/restfulx_spec.rb +4 -0
- data/spec/spec_helper.rb +13 -0
- data/tasks/restfulx.rake +2 -0
- data/test/rails/controllers/application_controller.rb +15 -0
- data/test/rails/controllers/locations_controller.rb +93 -0
- data/test/rails/controllers/notes_controller.rb +96 -0
- data/test/rails/controllers/projects_controller.rb +93 -0
- data/test/rails/controllers/tasks_controller.rb +93 -0
- data/test/rails/controllers/users_controller.rb +93 -0
- data/test/rails/database.yml +4 -0
- data/test/rails/fixtures/locations.yml +8 -0
- data/test/rails/fixtures/notes.yml +17 -0
- data/test/rails/fixtures/projects.yml +25 -0
- data/test/rails/fixtures/simple_properties.yml +19 -0
- data/test/rails/fixtures/tasks.yml +46 -0
- data/test/rails/fixtures/users.yml +13 -0
- data/test/rails/helpers/functional_test_helper.rb +21 -0
- data/test/rails/helpers/test_helper.rb +54 -0
- data/test/rails/helpers/unit_test_helper.rb +29 -0
- data/test/rails/model.yml +35 -0
- data/test/rails/models/location.rb +4 -0
- data/test/rails/models/note.rb +3 -0
- data/test/rails/models/project.rb +4 -0
- data/test/rails/models/simple_property.rb +2 -0
- data/test/rails/models/task.rb +18 -0
- data/test/rails/models/user.rb +20 -0
- data/test/rails/schema.rb +77 -0
- data/test/rails/test.swf +1 -0
- data/test/rails/test_active_foo.rb +36 -0
- data/test/rails/test_rails_integration_functional.rb +22 -0
- data/test/rails/test_to_fxml.rb +35 -0
- data/test/rails/test_to_json.rb +23 -0
- data/test/rails/views/notes/empty_params_action.html.erb +1 -0
- data/test/rails/views/notes/index.html.erb +1 -0
- metadata +234 -0
@@ -0,0 +1,46 @@
|
|
1
|
+
# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
|
2
|
+
|
3
|
+
haydn:
|
4
|
+
name: Get piano lessons from Haydn
|
5
|
+
location: vienna
|
6
|
+
user: ludwig
|
7
|
+
project: music
|
8
|
+
start_time: <%= 30.days.ago %>
|
9
|
+
end_time: <%= 100.days.from_now %>
|
10
|
+
|
11
|
+
salieri:
|
12
|
+
name: Arrange lessions with Antonio Salieri
|
13
|
+
location: vienna
|
14
|
+
user: ludwig
|
15
|
+
project: music
|
16
|
+
start_time: <%= 30.days.ago %>
|
17
|
+
|
18
|
+
hearing:
|
19
|
+
name: See doctor about hearing again
|
20
|
+
location: vienna
|
21
|
+
user: ludwig
|
22
|
+
project: health
|
23
|
+
start_time: <%= 30.days.ago %>
|
24
|
+
|
25
|
+
sound_board:
|
26
|
+
name: Get a new sound board made
|
27
|
+
location: vienna
|
28
|
+
user: ludwig
|
29
|
+
project: health
|
30
|
+
start_time: <%= 30.days.ago %>
|
31
|
+
|
32
|
+
hamlet_soliloquy:
|
33
|
+
name: "Edit Hamlet's soliloquy"
|
34
|
+
notes: "'That is the question' or 'is that the question?'"
|
35
|
+
location: stratford
|
36
|
+
user: shakespeare
|
37
|
+
project: hamlet
|
38
|
+
start_time: <%= 30.days.ago %>
|
39
|
+
|
40
|
+
othello_outline:
|
41
|
+
name: Outline Othello
|
42
|
+
location: stratford
|
43
|
+
user: shakespeare
|
44
|
+
project: othello
|
45
|
+
start_time: <%= 30.days.ago %>
|
46
|
+
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
|
2
|
+
|
3
|
+
ludwig:
|
4
|
+
login: ludwig
|
5
|
+
first_name: Ludwig
|
6
|
+
last_name: van Beethoven
|
7
|
+
email: ludwig@vienna.de
|
8
|
+
|
9
|
+
shakespeare:
|
10
|
+
login: william
|
11
|
+
first_name: William
|
12
|
+
last_name: Shakespeare
|
13
|
+
email: will@theglobetheater.com
|
@@ -0,0 +1,21 @@
|
|
1
|
+
$:.unshift(File.dirname(__FILE__) + '/../..')
|
2
|
+
$:.unshift(File.dirname(__FILE__) + '/../../lib')
|
3
|
+
schema_file = File.join(File.dirname(__FILE__), '..', 'schema.rb')
|
4
|
+
ENV["RAILS_ENV"] = "test"
|
5
|
+
|
6
|
+
require File.join(File.dirname(__FILE__), '..', 'controllers', 'application_controller')
|
7
|
+
require File.join(File.dirname(__FILE__), '..', 'controllers', 'notes_controller')
|
8
|
+
|
9
|
+
config = YAML::load(IO.read(File.join(File.dirname(__FILE__), '..', 'database.yml')))['test']
|
10
|
+
puts "config:\n#{config.inspect}"
|
11
|
+
ActiveRecord::Base.configurations = config
|
12
|
+
ActiveRecord::Base.establish_connection(config)
|
13
|
+
|
14
|
+
ActiveRecord::Base.logger = Logger.new(File.dirname(__FILE__) + "/models.log")
|
15
|
+
ActionController::Base.logger = Logger.new(File.dirname(__FILE__) + "/controllers.log")
|
16
|
+
ApplicationController.append_view_path File.join(File.dirname(__FILE__), '..', 'views')
|
17
|
+
|
18
|
+
load(schema_file) if File.exist?(schema_file)
|
19
|
+
|
20
|
+
Test::Unit::TestCase.fixture_path = File.join(File.dirname(__FILE__), '..', 'fixtures')
|
21
|
+
$:.unshift(Test::Unit::TestCase.fixture_path)
|
@@ -0,0 +1,54 @@
|
|
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/test_process'
|
13
|
+
require 'action_controller/integration'
|
14
|
+
require 'sqlite3'
|
15
|
+
require File.join(File.dirname(__FILE__), '..', '..', '..', 'lib', 'restfulx')
|
16
|
+
require File.join(File.dirname(__FILE__), '..', 'models', 'note')
|
17
|
+
require File.join(File.dirname(__FILE__), '..', 'models', 'user')
|
18
|
+
require File.join(File.dirname(__FILE__), '..', 'models', 'project')
|
19
|
+
require File.join(File.dirname(__FILE__), '..', 'models', 'location')
|
20
|
+
require File.join(File.dirname(__FILE__), '..', 'models', 'task')
|
21
|
+
require File.join(File.dirname(__FILE__), '..', 'models', 'simple_property')
|
22
|
+
|
23
|
+
class MockResponse
|
24
|
+
attr_reader :body, :content_type
|
25
|
+
|
26
|
+
def initialize(body, content_type = 'xml')
|
27
|
+
@body = body
|
28
|
+
@content_type = content_type
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
|
33
|
+
class ActiveRecord::TestCase #:nodoc:
|
34
|
+
# Add more helper methods to be used by all tests here...
|
35
|
+
|
36
|
+
# Use this to test xml or fxml responses in unit tests. For example,
|
37
|
+
# set_response_to user.to_fxml
|
38
|
+
# assert_xml_select 'user name', 'quentin'
|
39
|
+
def set_response_to(response, content_type = 'xml')
|
40
|
+
@response = MockResponse.new(response, content_type)
|
41
|
+
end
|
42
|
+
|
43
|
+
# Make xml functional testing work.
|
44
|
+
# From http://weblog.jamisbuck.org/2007/1/4/assert_xml_select
|
45
|
+
def xml_document
|
46
|
+
@xml_document ||= HTML::Document.new(@response.body, false, true)
|
47
|
+
end
|
48
|
+
|
49
|
+
def assert_xml_select(*args, &block)
|
50
|
+
@html_document = xml_document
|
51
|
+
assert_select(*args, &block)
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
@@ -0,0 +1,29 @@
|
|
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/test_process'
|
17
|
+
require 'action_controller/integration'
|
18
|
+
require 'sqlite3'
|
19
|
+
|
20
|
+
require File.join(File.dirname(__FILE__), '..', '..', '..', 'lib', 'restfulx')
|
21
|
+
|
22
|
+
config = YAML::load(IO.read(File.join(File.dirname(__FILE__), '..', 'database.yml')))[ENV['DB'] || 'test']
|
23
|
+
ActiveRecord::Base.configurations = config
|
24
|
+
ActiveRecord::Base.establish_connection(config)
|
25
|
+
|
26
|
+
load(schema_file) if File.exist?(schema_file)
|
27
|
+
|
28
|
+
ActiveSupport::TestCase.fixture_path.fixture_path = File.join(File.dirname(__FILE__), '..', 'fixtures')
|
29
|
+
$:.unshift(ActiveSupport::TestCase.fixture_path.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,18 @@
|
|
1
|
+
class Task < ActiveRecord::Base
|
2
|
+
belongs_to :project
|
3
|
+
belongs_to :location
|
4
|
+
belongs_to :user
|
5
|
+
|
6
|
+
def is_active
|
7
|
+
case
|
8
|
+
when start_time && end_time
|
9
|
+
(start_time .. end_time) === Time.now
|
10
|
+
when start_time && end_time.nil?
|
11
|
+
start_time <= Time.now
|
12
|
+
when start_time.nil && end_time
|
13
|
+
end_time >= Time.now
|
14
|
+
else
|
15
|
+
true
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
class User < ActiveRecord::Base
|
2
|
+
has_one :note
|
3
|
+
has_many :tasks
|
4
|
+
has_many :projects
|
5
|
+
has_many :locations
|
6
|
+
|
7
|
+
validates_length_of :login, :maximum => 10
|
8
|
+
|
9
|
+
def full_name
|
10
|
+
"#{first_name} #{last_name}"
|
11
|
+
end
|
12
|
+
|
13
|
+
def has_nothing_to_do
|
14
|
+
tasks.all? {|task| task.completed}
|
15
|
+
end
|
16
|
+
|
17
|
+
def email_host
|
18
|
+
email.split('@').last
|
19
|
+
end
|
20
|
+
end
|
@@ -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
|
data/test/rails/test.swf
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
This is used for the ruboss_helper_test.rb test suite.
|
@@ -0,0 +1,36 @@
|
|
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 < ActiveRecord::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(:methods => :is_active)
|
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(:methods => :has_nothing_to_do)
|
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(:methods => :is_active, :include => :tasks)
|
34
|
+
assert_xml_select 'user tasks task is_active'
|
35
|
+
end
|
36
|
+
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 RailsIntegrationFunctionalTest < ActiveRecord::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,35 @@
|
|
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 < ActiveRecord::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(:methods => [:has_nothing_to_do, :full_name])
|
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(:methods => [:has_nothing_to_do, :full_name])
|
31
|
+
set_response_to users(:ludwig).to_fxml(:methods => [:has_nothing_to_do, :full_name])
|
32
|
+
assert_xml_select 'user full_name', 'Ludwig van Beethoven'
|
33
|
+
assert_xml_select 'user has_nothing_to_do'
|
34
|
+
end
|
35
|
+
end
|