wrest 0.0.9-java → 0.1.0-java
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.
- data/CHANGELOG +34 -0
- data/README.rdoc +16 -10
- data/Rakefile +362 -124
- data/VERSION.yml +2 -2
- data/examples/delicious.rb +17 -7
- data/examples/facebook.rb +101 -0
- data/examples/keep_alive.rb +37 -0
- data/examples/twitter.rb +3 -3
- data/examples/twitter_public_timeline.rb +11 -4
- data/examples/wow_realm_status.rb +8 -2
- data/{spec/functional/sample_rails_app/public/favicon.ico → init.rb} +0 -0
- data/lib/wrest/components/{attributes_container → container}/alias_accessors.rb +4 -4
- data/lib/wrest/components/{attributes_container → container}/typecaster.rb +1 -1
- data/lib/wrest/components/{attributes_container.rb → container.rb} +46 -16
- data/lib/wrest/components/mutators.rb +4 -4
- data/lib/wrest/components/translators/json.rb +2 -2
- data/lib/wrest/components/translators/xml.rb +3 -2
- data/lib/wrest/components/translators.rb +3 -3
- data/lib/wrest/components.rb +3 -3
- data/lib/wrest/core_ext/hash.rb +1 -1
- data/lib/wrest/core_ext/string.rb +1 -1
- data/lib/wrest/curl/delete.rb +23 -0
- data/lib/wrest/curl/get.rb +23 -0
- data/lib/wrest/curl/options.rb +16 -0
- data/lib/wrest/curl/post.rb +23 -0
- data/lib/wrest/curl/put.rb +23 -0
- data/lib/wrest/curl/request.rb +95 -0
- data/lib/wrest/curl/response.rb +63 -0
- data/lib/wrest/curl/session.rb +57 -0
- data/lib/wrest/curl.rb +49 -0
- data/lib/wrest/exceptions.rb +16 -1
- data/lib/wrest/http_shared/headers.rb +350 -0
- data/lib/wrest/http_shared/standard_headers.rb +21 -0
- data/lib/wrest/http_shared/standard_tokens.rb +18 -0
- data/lib/wrest/http_shared.rb +24 -0
- data/lib/wrest/native/connection_factory.rb +23 -0
- data/lib/wrest/{http → native}/delete.rb +1 -1
- data/lib/wrest/{http → native}/get.rb +1 -1
- data/lib/wrest/{http → native}/options.rb +1 -1
- data/lib/wrest/{http → native}/post.rb +1 -1
- data/lib/wrest/{http → native}/put.rb +1 -1
- data/lib/wrest/{http → native}/redirection.rb +4 -1
- data/lib/wrest/{http → native}/request.rb +32 -20
- data/lib/wrest/{http → native}/response.rb +12 -4
- data/lib/wrest/native/session.rb +57 -0
- data/lib/wrest/native.rb +32 -0
- data/lib/wrest/resource/base.rb +1 -1
- data/lib/wrest/resource.rb +1 -1
- data/lib/wrest/test/request_patches.rb +5 -0
- data/lib/wrest/test.rb +1 -0
- data/lib/wrest/uri.rb +31 -3
- data/lib/wrest/version.rb +2 -2
- data/lib/wrest.rb +52 -16
- data/spec/unit/spec_helper.rb +12 -3
- data/spec/unit/wrest/components/attributes_container/alias_accessors_spec.rb +2 -2
- data/spec/unit/wrest/components/attributes_container/typecaster_spec.rb +6 -6
- data/spec/unit/wrest/components/attributes_container_spec.rb +44 -12
- data/spec/unit/wrest/components/translators/xml_spec.rb +7 -3
- data/spec/unit/wrest/curl/request_spec.rb +19 -0
- data/spec/unit/wrest/curl/response_spec.rb +16 -0
- data/spec/unit/wrest/http/response_spec.rb +17 -38
- data/spec/unit/wrest/{http → native}/redirection_spec.rb +5 -5
- data/spec/unit/wrest/{http → native}/request_spec.rb +15 -14
- data/spec/unit/wrest/native/response_spec.rb +72 -0
- data/spec/unit/wrest/native/session_spec.rb +74 -0
- data/spec/unit/wrest/resource/base_spec.rb +2 -2
- data/spec/unit/wrest/uri_spec.rb +51 -11
- data/wrest.gemspec +168 -0
- metadata +60 -164
- data/lib/wrest/http.rb +0 -25
- data/spec/functional/sample_rails_app/README +0 -3
- data/spec/functional/sample_rails_app/Rakefile +0 -10
- data/spec/functional/sample_rails_app/app/controllers/application_controller.rb +0 -10
- data/spec/functional/sample_rails_app/app/controllers/lead_bottles_controller.rb +0 -7
- data/spec/functional/sample_rails_app/app/helpers/application_helper.rb +0 -3
- data/spec/functional/sample_rails_app/app/models/bottle.rb +0 -3
- data/spec/functional/sample_rails_app/app/models/glass_bottle.rb +0 -3
- data/spec/functional/sample_rails_app/app/models/lead_bottle.rb +0 -3
- data/spec/functional/sample_rails_app/config/boot.rb +0 -110
- data/spec/functional/sample_rails_app/config/database.yml +0 -16
- data/spec/functional/sample_rails_app/config/environment.rb +0 -42
- data/spec/functional/sample_rails_app/config/environments/development.rb +0 -17
- data/spec/functional/sample_rails_app/config/environments/production.rb +0 -28
- data/spec/functional/sample_rails_app/config/environments/test.rb +0 -28
- data/spec/functional/sample_rails_app/config/initializers/backtrace_silencers.rb +0 -7
- data/spec/functional/sample_rails_app/config/initializers/inflections.rb +0 -10
- data/spec/functional/sample_rails_app/config/initializers/mime_types.rb +0 -5
- data/spec/functional/sample_rails_app/config/initializers/new_rails_defaults.rb +0 -19
- data/spec/functional/sample_rails_app/config/initializers/session_store.rb +0 -15
- data/spec/functional/sample_rails_app/config/locales/en.yml +0 -5
- data/spec/functional/sample_rails_app/config/routes.rb +0 -3
- data/spec/functional/sample_rails_app/db/development.sqlite3 +0 -0
- data/spec/functional/sample_rails_app/db/migrate/20090319115628_create_bottle.rb +0 -13
- data/spec/functional/sample_rails_app/db/schema.rb +0 -20
- data/spec/functional/sample_rails_app/db/test.sqlite3 +0 -0
- data/spec/functional/sample_rails_app/log/development.log +0 -1
- data/spec/functional/sample_rails_app/public/404.html +0 -30
- data/spec/functional/sample_rails_app/public/422.html +0 -30
- data/spec/functional/sample_rails_app/public/500.html +0 -30
- data/spec/functional/sample_rails_app/public/images/rails.png +0 -0
- data/spec/functional/sample_rails_app/public/index.html +0 -275
- data/spec/functional/sample_rails_app/public/robots.txt +0 -5
- data/spec/functional/sample_rails_app/script/about +0 -4
- data/spec/functional/sample_rails_app/script/autospec +0 -6
- data/spec/functional/sample_rails_app/script/console +0 -3
- data/spec/functional/sample_rails_app/script/dbconsole +0 -3
- data/spec/functional/sample_rails_app/script/destroy +0 -3
- data/spec/functional/sample_rails_app/script/generate +0 -3
- data/spec/functional/sample_rails_app/script/performance/benchmarker +0 -3
- data/spec/functional/sample_rails_app/script/performance/profiler +0 -3
- data/spec/functional/sample_rails_app/script/plugin +0 -3
- data/spec/functional/sample_rails_app/script/runner +0 -3
- data/spec/functional/sample_rails_app/script/server +0 -3
- data/spec/functional/sample_rails_app/script/spec +0 -10
- data/spec/functional/sample_rails_app/script/spec_server +0 -9
- data/spec/functional/sample_rails_app/test/performance/browsing_test.rb +0 -9
- data/spec/functional/sample_rails_app/test/test_helper.rb +0 -38
- data/spec/functional/sample_rails_app/tmtags +0 -2559
- data/spec/functional/sample_rails_app/vendor/plugins/resource_full/MIT-LICENSE +0 -20
- data/spec/functional/sample_rails_app/vendor/plugins/resource_full/README.rdoc +0 -100
- data/spec/functional/sample_rails_app/vendor/plugins/resource_full/Rakefile +0 -18
- data/spec/functional/sample_rails_app/vendor/plugins/resource_full/init.rb +0 -5
- data/spec/functional/sample_rails_app/vendor/plugins/resource_full/install.rb +0 -1
- data/spec/functional/sample_rails_app/vendor/plugins/resource_full/lib/resource_full/base.rb +0 -140
- data/spec/functional/sample_rails_app/vendor/plugins/resource_full/lib/resource_full/controllers/resources.rb +0 -16
- data/spec/functional/sample_rails_app/vendor/plugins/resource_full/lib/resource_full/controllers/resources_controller.rb +0 -26
- data/spec/functional/sample_rails_app/vendor/plugins/resource_full/lib/resource_full/controllers/routes_controller.rb +0 -16
- data/spec/functional/sample_rails_app/vendor/plugins/resource_full/lib/resource_full/core_extensions/api.rb +0 -26
- data/spec/functional/sample_rails_app/vendor/plugins/resource_full/lib/resource_full/core_extensions/exception.rb +0 -23
- data/spec/functional/sample_rails_app/vendor/plugins/resource_full/lib/resource_full/core_extensions/from_json.rb +0 -15
- data/spec/functional/sample_rails_app/vendor/plugins/resource_full/lib/resource_full/dispatch.rb +0 -235
- data/spec/functional/sample_rails_app/vendor/plugins/resource_full/lib/resource_full/models/resourced_route.rb +0 -84
- data/spec/functional/sample_rails_app/vendor/plugins/resource_full/lib/resource_full/query.rb +0 -337
- data/spec/functional/sample_rails_app/vendor/plugins/resource_full/lib/resource_full/render/html.rb +0 -50
- data/spec/functional/sample_rails_app/vendor/plugins/resource_full/lib/resource_full/render/json.rb +0 -75
- data/spec/functional/sample_rails_app/vendor/plugins/resource_full/lib/resource_full/render/xml.rb +0 -65
- data/spec/functional/sample_rails_app/vendor/plugins/resource_full/lib/resource_full/render.rb +0 -63
- data/spec/functional/sample_rails_app/vendor/plugins/resource_full/lib/resource_full/retrieve.rb +0 -74
- data/spec/functional/sample_rails_app/vendor/plugins/resource_full/lib/resource_full/version.rb +0 -9
- data/spec/functional/sample_rails_app/vendor/plugins/resource_full/lib/resource_full.rb +0 -14
- data/spec/functional/sample_rails_app/vendor/plugins/resource_full/spec/resource_full/base_spec.rb +0 -88
- data/spec/functional/sample_rails_app/vendor/plugins/resource_full/spec/resource_full/controllers/resources_spec.rb +0 -29
- data/spec/functional/sample_rails_app/vendor/plugins/resource_full/spec/resource_full/dispatch_spec.rb +0 -262
- data/spec/functional/sample_rails_app/vendor/plugins/resource_full/spec/resource_full/models/resourced_route_spec.rb +0 -62
- data/spec/functional/sample_rails_app/vendor/plugins/resource_full/spec/resource_full/query/parameter_spec.rb +0 -57
- data/spec/functional/sample_rails_app/vendor/plugins/resource_full/spec/resource_full/query_spec.rb +0 -462
- data/spec/functional/sample_rails_app/vendor/plugins/resource_full/spec/resource_full/render/html_spec.rb +0 -4
- data/spec/functional/sample_rails_app/vendor/plugins/resource_full/spec/resource_full/render/json_spec.rb +0 -107
- data/spec/functional/sample_rails_app/vendor/plugins/resource_full/spec/resource_full/render/xml_spec.rb +0 -98
- data/spec/functional/sample_rails_app/vendor/plugins/resource_full/spec/resource_full/render_spec.rb +0 -5
- data/spec/functional/sample_rails_app/vendor/plugins/resource_full/spec/resource_full/retrieve_spec.rb +0 -173
- data/spec/functional/sample_rails_app/vendor/plugins/resource_full/spec/spec_helper.rb +0 -98
- data/spec/functional/sample_rails_app/vendor/plugins/resource_full/uninstall.rb +0 -1
- data/spec/functional/spec_helper.rb +0 -0
|
@@ -1,173 +0,0 @@
|
|
|
1
|
-
require File.dirname(__FILE__) + '/../spec_helper'
|
|
2
|
-
|
|
3
|
-
describe "ResourceFull::Retrieve", :type => :controller do
|
|
4
|
-
controller_name "resource_full_mock_users"
|
|
5
|
-
|
|
6
|
-
before :each do
|
|
7
|
-
ResourceFullMockUser.delete_all
|
|
8
|
-
ResourceFullMockUsersController.resource_identifier = :id
|
|
9
|
-
ResourceFullMockUsersController.queryable_params = []
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
it "defines custom methods based on the class name" do
|
|
13
|
-
controller.should respond_to(
|
|
14
|
-
:find_resource_full_mock_user,
|
|
15
|
-
:find_all_resource_full_mock_users,
|
|
16
|
-
:update_resource_full_mock_user,
|
|
17
|
-
:destroy_resource_full_mock_user,
|
|
18
|
-
:new_resource_full_mock_user
|
|
19
|
-
)
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
it "changes the custom methods if the model name is changed" do
|
|
23
|
-
controller.class.exposes ResourceFullMock
|
|
24
|
-
controller.should respond_to(:find_resource_full_mock)
|
|
25
|
-
controller.should_not respond_to(:find_resource_full_mock_user)
|
|
26
|
-
controller.class.exposes ResourceFullMockUser # cleanup
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
it "finds the requested model object" do
|
|
30
|
-
user = ResourceFullMockUser.create!
|
|
31
|
-
get :show, :id => user.id
|
|
32
|
-
assigns(:resource_full_mock_user).should == user
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
describe "resource_identifier and identified_by" do
|
|
36
|
-
controller_name "resource_full_mock_users"
|
|
37
|
-
|
|
38
|
-
before :each do
|
|
39
|
-
ResourceFullMockUser.delete_all
|
|
40
|
-
ResourceFullMockUsersController.resource_identifier = :id
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
def get_should_retrieve_by_first_name
|
|
44
|
-
eustace = ResourceFullMockUser.create! :first_name => "eustace"
|
|
45
|
-
eustace_noise = ResourceFullMockUser.create! :first_name => eustace.id
|
|
46
|
-
get :show, :id => "eustace"
|
|
47
|
-
assigns(:resource_full_mock_user).should == eustace
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
def get_should_retrieve_by_id
|
|
51
|
-
jimbo = ResourceFullMockUser.create! :first_name => "jimbo"
|
|
52
|
-
jimbo_noise = ResourceFullMockUser.create! :first_name => jimbo.id
|
|
53
|
-
get :show, :id => jimbo.id
|
|
54
|
-
assigns(:resource_full_mock_user).should == jimbo
|
|
55
|
-
end
|
|
56
|
-
|
|
57
|
-
it "finds the requested model object using the correct column if the resource_identifier attribute has been overridden" do
|
|
58
|
-
ResourceFullMockUsersController.resource_identifier = :first_name
|
|
59
|
-
get_should_retrieve_by_first_name
|
|
60
|
-
end
|
|
61
|
-
|
|
62
|
-
it "doesn't find the requested model object if there are none to find" do
|
|
63
|
-
ResourceFullMockUsersController.resource_identifier = :first_name
|
|
64
|
-
get :show, :id => "eustace"
|
|
65
|
-
assigns(:resource_full_mock_user).should be_nil
|
|
66
|
-
end
|
|
67
|
-
|
|
68
|
-
it "finds the requested model object using the correct column if a block is provided to resource_identifier" do
|
|
69
|
-
ResourceFullMockUsersController.resource_identifier = lambda do |id|
|
|
70
|
-
if id =~ /[0-9]+/
|
|
71
|
-
:id
|
|
72
|
-
else :first_name end
|
|
73
|
-
end
|
|
74
|
-
get_should_retrieve_by_first_name
|
|
75
|
-
get_should_retrieve_by_id
|
|
76
|
-
end
|
|
77
|
-
|
|
78
|
-
it "finds the requested model object only if the optional block provided to identifed_by is true" do
|
|
79
|
-
ResourceFullMockUsersController.identified_by :first_name, :if => lambda { |id| id =~ /[a-zA-Z]+/ }
|
|
80
|
-
get_should_retrieve_by_first_name
|
|
81
|
-
get_should_retrieve_by_id
|
|
82
|
-
end
|
|
83
|
-
|
|
84
|
-
it "finds the requested model object unless the optional block provided to identifed_by is true" do
|
|
85
|
-
ResourceFullMockUsersController.identified_by :first_name, :unless => lambda { |id| id =~ /[0-9]+/ }
|
|
86
|
-
get_should_retrieve_by_first_name
|
|
87
|
-
get_should_retrieve_by_id
|
|
88
|
-
end
|
|
89
|
-
|
|
90
|
-
it "finds the requested model object unless it requests a fallback to a numeric id" do
|
|
91
|
-
ResourceFullMockUsersController.identified_by :first_name, :unless => :id_numeric
|
|
92
|
-
get_should_retrieve_by_first_name
|
|
93
|
-
get_should_retrieve_by_id
|
|
94
|
-
end
|
|
95
|
-
end
|
|
96
|
-
|
|
97
|
-
it "updates the requested model object based on the given parameters" do
|
|
98
|
-
user = ResourceFullMockUser.create! :last_name => "threepwood"
|
|
99
|
-
post :update, :id => user.id, :resource_full_mock_user => { :last_name => "guybrush" }
|
|
100
|
-
user.reload.last_name.should == "guybrush"
|
|
101
|
-
end
|
|
102
|
-
|
|
103
|
-
it "updates the requested model object using the correct column if the resource_identifier attribute has been overridden" do
|
|
104
|
-
ResourceFullMockUsersController.resource_identifier = :first_name
|
|
105
|
-
user = ResourceFullMockUser.create! :first_name => "guybrush"
|
|
106
|
-
post :update, :id => "guybrush", :resource_full_mock_user => { :last_name => "threepwood" }
|
|
107
|
-
user.reload.last_name.should == "threepwood"
|
|
108
|
-
end
|
|
109
|
-
|
|
110
|
-
it "creates a new model object based on the given parameters" do
|
|
111
|
-
put :create, :resource_full_mock_user => { :first_name => "guybrush", :last_name => "threepwood" }
|
|
112
|
-
ResourceFullMockUser.count.should == 1
|
|
113
|
-
ResourceFullMockUser.find(:first).first_name.should == "guybrush"
|
|
114
|
-
end
|
|
115
|
-
|
|
116
|
-
it "creates a new model object appropriately if a creational parameter is queryable but not placed in the model object params, as with a nested route" do
|
|
117
|
-
ResourceFullMockUsersController.queryable_with :first_name
|
|
118
|
-
put :create, :first_name => "guybrush", :resource_full_mock_user => { :last_name => "threepwood" }
|
|
119
|
-
ResourceFullMockUser.count.should == 1
|
|
120
|
-
user = ResourceFullMockUser.find :first
|
|
121
|
-
user.first_name.should == "guybrush"
|
|
122
|
-
user.last_name.should == "threepwood"
|
|
123
|
-
end
|
|
124
|
-
|
|
125
|
-
it "deletes the requested model object" do
|
|
126
|
-
user = ResourceFullMockUser.create!
|
|
127
|
-
delete :destroy, :id => user.id
|
|
128
|
-
ResourceFullMockUser.exists?(user.id).should be_false
|
|
129
|
-
end
|
|
130
|
-
|
|
131
|
-
it "deletes the requested model object using the correct column if the resource_identifier attribute has been overridden" do
|
|
132
|
-
ResourceFullMockUsersController.resource_identifier = :first_name
|
|
133
|
-
user = ResourceFullMockUser.create! :first_name => "guybrush"
|
|
134
|
-
delete :destroy, :id => "guybrush"
|
|
135
|
-
ResourceFullMockUser.exists?(user.id).should be_false
|
|
136
|
-
end
|
|
137
|
-
|
|
138
|
-
describe "with pagination" do
|
|
139
|
-
controller_name "resource_full_mock_users"
|
|
140
|
-
|
|
141
|
-
before :each do
|
|
142
|
-
ResourceFullMockUser.delete_all
|
|
143
|
-
@users = (1..6).collect { ResourceFullMockUser.create! }
|
|
144
|
-
end
|
|
145
|
-
|
|
146
|
-
after :all do
|
|
147
|
-
ResourceFullMockUser.delete_all
|
|
148
|
-
end
|
|
149
|
-
|
|
150
|
-
it "limits the query to the correct number of records given that parameter" do
|
|
151
|
-
ResourceFullMockUsersController.queryable_with :limit, :scope => lambda {|limit| { :limit => limit }}
|
|
152
|
-
get :index, :limit => 2
|
|
153
|
-
assigns(:resource_full_mock_users).should == @users[0..1]
|
|
154
|
-
end
|
|
155
|
-
|
|
156
|
-
it "offsets the query by the correct number of records" do
|
|
157
|
-
ResourceFullMockUsersController.queryable_with :limit, :scope => lambda {|limit| { :limit => limit }}
|
|
158
|
-
ResourceFullMockUsersController.queryable_with :offset, :scope => lambda {|offset| { :offset => offset }}
|
|
159
|
-
get :index, :offset => 4, :limit => 2
|
|
160
|
-
assigns(:resource_full_mock_users).should == @users[4..5]
|
|
161
|
-
end
|
|
162
|
-
|
|
163
|
-
xit "doesn't attempt to paginate if pagination is disabled" do
|
|
164
|
-
ResourceFullMockUsersController.queryable_with :limit, :scope => lambda {|limit| { :limit => limit }}
|
|
165
|
-
ResourceFullMockUsersController.queryable_with :offset, :scope => lambda {|offset| { :offset => offset }}
|
|
166
|
-
ResourceFullMockUsersController.paginatable = false
|
|
167
|
-
get :index, :offset => 4, :limit => 2
|
|
168
|
-
assigns(:resource_full_mock_users).should == @users
|
|
169
|
-
ResourceFullMockUsersController.paginatable = true # cleanup
|
|
170
|
-
end
|
|
171
|
-
end
|
|
172
|
-
|
|
173
|
-
end
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
# This file is copied to ~/spec when you run 'ruby script/generate rspec'
|
|
2
|
-
# from the project root directory.
|
|
3
|
-
ENV["RAILS_ENV"] = "test"
|
|
4
|
-
|
|
5
|
-
require File.expand_path(File.dirname(__FILE__) + '/../../../../config/environment')
|
|
6
|
-
require 'spec'
|
|
7
|
-
require 'spec/rails'
|
|
8
|
-
require 'resource_full/core_extensions/from_json'
|
|
9
|
-
|
|
10
|
-
Spec::Runner.configure do |config|
|
|
11
|
-
# If you're not using ActiveRecord you should remove these
|
|
12
|
-
# lines, delete config/database.yml and disable :active_record
|
|
13
|
-
# in your config/boot.rb
|
|
14
|
-
config.use_transactional_fixtures = true
|
|
15
|
-
config.use_instantiated_fixtures = false
|
|
16
|
-
config.fixture_path = RAILS_ROOT + '/vendor/plugins/resource_full/spec/fixtures/'
|
|
17
|
-
config.mock_with :mocha
|
|
18
|
-
|
|
19
|
-
config.before(:all) do
|
|
20
|
-
ActiveRecord::Base.connection.create_table "resource_full_mock_addresses", :force => true do |t|
|
|
21
|
-
t.string "street"
|
|
22
|
-
t.string "city"
|
|
23
|
-
t.string "state_code"
|
|
24
|
-
t.integer "zip"
|
|
25
|
-
t.integer "resource_full_mock_user_id"
|
|
26
|
-
t.timestamps
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
ActiveRecord::Base.connection.create_table "resource_full_mock_users", :force => true do |t|
|
|
30
|
-
t.string "first_name"
|
|
31
|
-
t.string "last_name"
|
|
32
|
-
t.date "birthdate"
|
|
33
|
-
t.string "email"
|
|
34
|
-
t.string "join_date"
|
|
35
|
-
t.integer "income"
|
|
36
|
-
t.integer "resource_full_mock_employer_id"
|
|
37
|
-
t.timestamps
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
ActiveRecord::Base.connection.create_table "resource_full_mock_employers", :force => true do |t|
|
|
41
|
-
t.string "name"
|
|
42
|
-
t.string "email"
|
|
43
|
-
t.timestamps
|
|
44
|
-
end
|
|
45
|
-
end
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
ActionController::Routing::Routes.draw do |map|
|
|
49
|
-
map.foo '/foo', :controller => 'resource_full_mocks', :action => 'foo'
|
|
50
|
-
map.resources :resource_full_mocks, :resource_full_sub_mocks, :resource_full_mock_addresses
|
|
51
|
-
map.resources :resource_full_mock_users, :collection => {:count => :get} do |users|
|
|
52
|
-
users.resources :resource_full_mock_addresses
|
|
53
|
-
end
|
|
54
|
-
map.resources :resources, :controller => 'resource_full/controllers/resources' do |resource|
|
|
55
|
-
resource.resources :routes, :controller => 'resource_full/controllers/routes'
|
|
56
|
-
end
|
|
57
|
-
end
|
|
58
|
-
|
|
59
|
-
class ResourceFullMock
|
|
60
|
-
def self.table_name; "mock"; end
|
|
61
|
-
end
|
|
62
|
-
class ResourceFullSubMock < ResourceFullMock; end
|
|
63
|
-
|
|
64
|
-
# TODO Remove these or find a better way to handle ActiveRecord dependencies.
|
|
65
|
-
class ResourceFullMockEmployer < ActiveRecord::Base
|
|
66
|
-
has_many :resource_full_mock_users
|
|
67
|
-
end
|
|
68
|
-
|
|
69
|
-
class ResourceFullMockUser < ActiveRecord::Base
|
|
70
|
-
belongs_to :resource_full_mock_employer
|
|
71
|
-
has_many :resource_full_mock_addresses
|
|
72
|
-
end
|
|
73
|
-
|
|
74
|
-
class ResourceFullMockAddress < ActiveRecord::Base
|
|
75
|
-
belongs_to :resource_full_mock_user
|
|
76
|
-
end
|
|
77
|
-
|
|
78
|
-
class ResourceFullMocksController < ResourceFull::Base
|
|
79
|
-
# dispatch_spec custom methods spec, approx. line 98
|
|
80
|
-
def foo
|
|
81
|
-
render :xml => { :foo => "bar" }.to_xml
|
|
82
|
-
end
|
|
83
|
-
end
|
|
84
|
-
class ResourceFullSubMocksController < ResourceFullMocksController; end
|
|
85
|
-
class ResourceFullMockUsersController < ResourceFull::Base; end
|
|
86
|
-
class ResourceFullMockAddressesController < ResourceFull::Base; end
|
|
87
|
-
|
|
88
|
-
ActionController::Routing.use_controllers! %w{
|
|
89
|
-
resource_full_mock_users
|
|
90
|
-
resource_full_mock_addresses
|
|
91
|
-
resource_full_mocks
|
|
92
|
-
resource_full_sub_mocks
|
|
93
|
-
resource_full/controllers/routes
|
|
94
|
-
resource_full/controllers/resources
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
def putsh(stuff); puts ERB::Util.h(stuff) + "<br/>"; end
|
|
98
|
-
def ph(stuff); puts ERB::Util.h(stuff.inspect) + "<br/>"; end
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
# Uninstall hook code here
|
|
File without changes
|