resource_inclusion 0.0.1

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.
@@ -0,0 +1,35 @@
1
+ App::Application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb
3
+
4
+ # The test environment is used exclusively to run your application's
5
+ # test suite. You never need to work with it otherwise. Remember that
6
+ # your test database is "scratch space" for the test suite and is wiped
7
+ # and recreated between test runs. Don't rely on the data there!
8
+ config.cache_classes = true
9
+
10
+ # Log error messages when you accidentally call methods on nil.
11
+ config.whiny_nils = true
12
+
13
+ # Show full error reports and disable caching
14
+ config.consider_all_requests_local = true
15
+ config.action_controller.perform_caching = false
16
+
17
+ # Raise exceptions instead of rendering exception templates
18
+ config.action_dispatch.show_exceptions = false
19
+
20
+ # Disable request forgery protection in test environment
21
+ config.action_controller.allow_forgery_protection = false
22
+
23
+ # Tell Action Mailer not to deliver emails to the real world.
24
+ # The :test delivery method accumulates sent emails in the
25
+ # ActionMailer::Base.deliveries array.
26
+ config.action_mailer.delivery_method = :test
27
+
28
+ # Use SQL instead of Active Record's schema dumper when creating the test database.
29
+ # This is necessary if your schema can't be completely dumped by the schema dumper,
30
+ # like if you have constraints or database-specific column types
31
+ # config.active_record.schema_format = :sql
32
+
33
+ # Print deprecation notices to the stderr
34
+ config.active_support.deprecation = :stderr
35
+ end
@@ -0,0 +1,3 @@
1
+ App::Application.routes.draw do
2
+ resources :comments
3
+ end
@@ -0,0 +1,4 @@
1
+ # This file is used by Rack-based servers to start the application.
2
+
3
+ require ::File.expand_path('../config/environment', __FILE__)
4
+ run App::Application
Binary file
@@ -0,0 +1,22 @@
1
+ class InitialTest < ActiveRecord::Migration
2
+ def self.up
3
+
4
+ create_table :users do |t|
5
+ t.string :login_id
6
+ t.string :display_name
7
+ t.string :email
8
+ end
9
+
10
+ create_table :comments do |t|
11
+ t.text :text
12
+ t.references :user
13
+ end
14
+
15
+ end
16
+
17
+ def self.down
18
+ drop_table :users
19
+ drop_table :comments
20
+ end
21
+
22
+ end
Binary file
@@ -0,0 +1,288 @@
1
+ SQL (0.4ms)  SELECT name
2
+ FROM sqlite_master
3
+ WHERE type = 'table' AND NOT name = 'sqlite_sequence'
4
+ 
5
+ SQL (0.1ms) SELECT name
6
+ FROM sqlite_master
7
+ WHERE type = 'table' AND NOT name = 'sqlite_sequence'
8
+ SQL (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations"
9
+ SQL (0.1ms) select sqlite_version(*)
10
+ SQL (0.2ms)  SELECT name
11
+ FROM sqlite_master
12
+ WHERE type = 'table' AND NOT name = 'sqlite_sequence'
13
+ 
14
+ SQL (3.2ms) CREATE TABLE "comments" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "text" text, "user_id" integer)
15
+ SQL (0.1ms)  SELECT name
16
+ FROM sqlite_master
17
+ WHERE type = 'table' AND NOT name = 'sqlite_sequence'
18
+ 
19
+ SQL (1.8ms) CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "login_id" varchar(255), "display_name" varchar(255), "email" varchar(255))
20
+ SQL (0.1ms)  SELECT name
21
+ FROM sqlite_master
22
+ WHERE type = 'table' AND NOT name = 'sqlite_sequence'
23
+ 
24
+ SQL (2.2ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
25
+ SQL (0.0ms) PRAGMA index_list("schema_migrations")
26
+ SQL (1.8ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
27
+ SQL (0.1ms)  SELECT name
28
+ FROM sqlite_master
29
+ WHERE type = 'table' AND NOT name = 'sqlite_sequence'
30
+ 
31
+ SQL (0.1ms) SELECT version FROM "schema_migrations"
32
+ SQL (3.0ms) INSERT INTO "schema_migrations" (version) VALUES ('20110111090943')
33
+ SQL (0.4ms)  SELECT name
34
+ FROM sqlite_master
35
+ WHERE type = 'table' AND NOT name = 'sqlite_sequence'
36
+ 
37
+ SQL (0.1ms) SELECT name
38
+ FROM sqlite_master
39
+ WHERE type = 'table' AND NOT name = 'sqlite_sequence'
40
+ SQL (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations"
41
+ SQL (0.1ms) select sqlite_version(*)
42
+ SQL (0.2ms)  SELECT name
43
+ FROM sqlite_master
44
+ WHERE type = 'table' AND NOT name = 'sqlite_sequence'
45
+ 
46
+ SQL (3.0ms) CREATE TABLE "comments" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "text" text, "user_id" integer)
47
+ SQL (0.1ms)  SELECT name
48
+ FROM sqlite_master
49
+ WHERE type = 'table' AND NOT name = 'sqlite_sequence'
50
+ 
51
+ SQL (1.8ms) CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "login_id" varchar(255), "display_name" varchar(255), "email" varchar(255))
52
+ SQL (0.1ms)  SELECT name
53
+ FROM sqlite_master
54
+ WHERE type = 'table' AND NOT name = 'sqlite_sequence'
55
+ 
56
+ SQL (2.3ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
57
+ SQL (0.1ms) PRAGMA index_list("schema_migrations")
58
+ SQL (2.2ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
59
+ SQL (0.2ms)  SELECT name
60
+ FROM sqlite_master
61
+ WHERE type = 'table' AND NOT name = 'sqlite_sequence'
62
+ 
63
+ SQL (0.1ms) SELECT version FROM "schema_migrations"
64
+ SQL (4.5ms) INSERT INTO "schema_migrations" (version) VALUES ('20110111090943')
65
+ SQL (0.4ms)  SELECT name
66
+ FROM sqlite_master
67
+ WHERE type = 'table' AND NOT name = 'sqlite_sequence'
68
+ 
69
+ SQL (0.1ms) SELECT name
70
+ FROM sqlite_master
71
+ WHERE type = 'table' AND NOT name = 'sqlite_sequence'
72
+ SQL (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations"
73
+ SQL (0.1ms) select sqlite_version(*)
74
+ SQL (0.2ms)  SELECT name
75
+ FROM sqlite_master
76
+ WHERE type = 'table' AND NOT name = 'sqlite_sequence'
77
+ 
78
+ SQL (3.0ms) CREATE TABLE "comments" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "text" text, "user_id" integer)
79
+ SQL (0.1ms)  SELECT name
80
+ FROM sqlite_master
81
+ WHERE type = 'table' AND NOT name = 'sqlite_sequence'
82
+ 
83
+ SQL (1.8ms) CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "login_id" varchar(255), "display_name" varchar(255), "email" varchar(255))
84
+ SQL (0.1ms)  SELECT name
85
+ FROM sqlite_master
86
+ WHERE type = 'table' AND NOT name = 'sqlite_sequence'
87
+ 
88
+ SQL (2.3ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
89
+ SQL (0.1ms) PRAGMA index_list("schema_migrations")
90
+ SQL (2.6ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
91
+ SQL (0.2ms)  SELECT name
92
+ FROM sqlite_master
93
+ WHERE type = 'table' AND NOT name = 'sqlite_sequence'
94
+ 
95
+ SQL (0.1ms) SELECT version FROM "schema_migrations"
96
+ SQL (2.4ms) INSERT INTO "schema_migrations" (version) VALUES ('20110111090943')
97
+ SQL (0.4ms)  SELECT name
98
+ FROM sqlite_master
99
+ WHERE type = 'table' AND NOT name = 'sqlite_sequence'
100
+ 
101
+ SQL (0.1ms) SELECT name
102
+ FROM sqlite_master
103
+ WHERE type = 'table' AND NOT name = 'sqlite_sequence'
104
+ SQL (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations"
105
+ SQL (0.1ms) select sqlite_version(*)
106
+ SQL (0.2ms)  SELECT name
107
+ FROM sqlite_master
108
+ WHERE type = 'table' AND NOT name = 'sqlite_sequence'
109
+ 
110
+ SQL (4.0ms) CREATE TABLE "comments" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "text" text, "user_id" integer)
111
+ SQL (0.2ms)  SELECT name
112
+ FROM sqlite_master
113
+ WHERE type = 'table' AND NOT name = 'sqlite_sequence'
114
+ 
115
+ SQL (2.0ms) CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "login_id" varchar(255), "display_name" varchar(255), "email" varchar(255))
116
+ SQL (0.1ms)  SELECT name
117
+ FROM sqlite_master
118
+ WHERE type = 'table' AND NOT name = 'sqlite_sequence'
119
+ 
120
+ SQL (2.2ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
121
+ SQL (0.0ms) PRAGMA index_list("schema_migrations")
122
+ SQL (1.8ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
123
+ SQL (0.1ms)  SELECT name
124
+ FROM sqlite_master
125
+ WHERE type = 'table' AND NOT name = 'sqlite_sequence'
126
+ 
127
+ SQL (0.1ms) SELECT version FROM "schema_migrations"
128
+ SQL (2.0ms) INSERT INTO "schema_migrations" (version) VALUES ('20110111090943')
129
+ SQL (0.5ms)  SELECT name
130
+ FROM sqlite_master
131
+ WHERE type = 'table' AND NOT name = 'sqlite_sequence'
132
+ 
133
+ SQL (0.1ms) SELECT name
134
+ FROM sqlite_master
135
+ WHERE type = 'table' AND NOT name = 'sqlite_sequence'
136
+ SQL (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations"
137
+ SQL (0.1ms) select sqlite_version(*)
138
+ SQL (0.2ms)  SELECT name
139
+ FROM sqlite_master
140
+ WHERE type = 'table' AND NOT name = 'sqlite_sequence'
141
+ 
142
+ SQL (3.3ms) CREATE TABLE "comments" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "text" text, "user_id" integer)
143
+ SQL (0.1ms)  SELECT name
144
+ FROM sqlite_master
145
+ WHERE type = 'table' AND NOT name = 'sqlite_sequence'
146
+ 
147
+ SQL (1.8ms) CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "login_id" varchar(255), "display_name" varchar(255), "email" varchar(255))
148
+ SQL (0.1ms)  SELECT name
149
+ FROM sqlite_master
150
+ WHERE type = 'table' AND NOT name = 'sqlite_sequence'
151
+ 
152
+ SQL (2.5ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
153
+ SQL (0.1ms) PRAGMA index_list("schema_migrations")
154
+ SQL (2.0ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
155
+ SQL (0.2ms)  SELECT name
156
+ FROM sqlite_master
157
+ WHERE type = 'table' AND NOT name = 'sqlite_sequence'
158
+ 
159
+ SQL (0.1ms) SELECT version FROM "schema_migrations"
160
+ SQL (2.4ms) INSERT INTO "schema_migrations" (version) VALUES ('20110111090943')
161
+ SQL (0.5ms)  SELECT name
162
+ FROM sqlite_master
163
+ WHERE type = 'table' AND NOT name = 'sqlite_sequence'
164
+ 
165
+ SQL (0.1ms) SELECT name
166
+ FROM sqlite_master
167
+ WHERE type = 'table' AND NOT name = 'sqlite_sequence'
168
+ SQL (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations"
169
+ SQL (0.1ms) select sqlite_version(*)
170
+ SQL (0.2ms)  SELECT name
171
+ FROM sqlite_master
172
+ WHERE type = 'table' AND NOT name = 'sqlite_sequence'
173
+ 
174
+ SQL (3.1ms) CREATE TABLE "comments" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "text" text, "user_id" integer)
175
+ SQL (0.1ms)  SELECT name
176
+ FROM sqlite_master
177
+ WHERE type = 'table' AND NOT name = 'sqlite_sequence'
178
+ 
179
+ SQL (1.9ms) CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "login_id" varchar(255), "display_name" varchar(255), "email" varchar(255))
180
+ SQL (0.1ms)  SELECT name
181
+ FROM sqlite_master
182
+ WHERE type = 'table' AND NOT name = 'sqlite_sequence'
183
+ 
184
+ SQL (2.4ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
185
+ SQL (0.0ms) PRAGMA index_list("schema_migrations")
186
+ SQL (1.8ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
187
+ SQL (0.2ms)  SELECT name
188
+ FROM sqlite_master
189
+ WHERE type = 'table' AND NOT name = 'sqlite_sequence'
190
+ 
191
+ SQL (0.1ms) SELECT version FROM "schema_migrations"
192
+ SQL (2.3ms) INSERT INTO "schema_migrations" (version) VALUES ('20110111090943')
193
+ SQL (0.4ms)  SELECT name
194
+ FROM sqlite_master
195
+ WHERE type = 'table' AND NOT name = 'sqlite_sequence'
196
+ 
197
+ SQL (0.1ms) SELECT name
198
+ FROM sqlite_master
199
+ WHERE type = 'table' AND NOT name = 'sqlite_sequence'
200
+ SQL (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations"
201
+ SQL (0.1ms) select sqlite_version(*)
202
+ SQL (0.1ms)  SELECT name
203
+ FROM sqlite_master
204
+ WHERE type = 'table' AND NOT name = 'sqlite_sequence'
205
+ 
206
+ SQL (3.1ms) CREATE TABLE "comments" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "text" text, "user_id" integer)
207
+ SQL (0.1ms)  SELECT name
208
+ FROM sqlite_master
209
+ WHERE type = 'table' AND NOT name = 'sqlite_sequence'
210
+ 
211
+ SQL (1.8ms) CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "login_id" varchar(255), "display_name" varchar(255), "email" varchar(255))
212
+ SQL (0.1ms)  SELECT name
213
+ FROM sqlite_master
214
+ WHERE type = 'table' AND NOT name = 'sqlite_sequence'
215
+ 
216
+ SQL (2.4ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
217
+ SQL (0.1ms) PRAGMA index_list("schema_migrations")
218
+ SQL (2.1ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
219
+ SQL (0.2ms)  SELECT name
220
+ FROM sqlite_master
221
+ WHERE type = 'table' AND NOT name = 'sqlite_sequence'
222
+ 
223
+ SQL (0.1ms) SELECT version FROM "schema_migrations"
224
+ SQL (2.3ms) INSERT INTO "schema_migrations" (version) VALUES ('20110111090943')
225
+ SQL (0.4ms)  SELECT name
226
+ FROM sqlite_master
227
+ WHERE type = 'table' AND NOT name = 'sqlite_sequence'
228
+ 
229
+ SQL (0.1ms) SELECT name
230
+ FROM sqlite_master
231
+ WHERE type = 'table' AND NOT name = 'sqlite_sequence'
232
+ SQL (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations"
233
+ SQL (0.1ms) select sqlite_version(*)
234
+ SQL (0.2ms)  SELECT name
235
+ FROM sqlite_master
236
+ WHERE type = 'table' AND NOT name = 'sqlite_sequence'
237
+ 
238
+ SQL (3.2ms) CREATE TABLE "comments" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "text" text, "user_id" integer)
239
+ SQL (0.2ms)  SELECT name
240
+ FROM sqlite_master
241
+ WHERE type = 'table' AND NOT name = 'sqlite_sequence'
242
+ 
243
+ SQL (1.9ms) CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "login_id" varchar(255), "display_name" varchar(255), "email" varchar(255))
244
+ SQL (0.1ms)  SELECT name
245
+ FROM sqlite_master
246
+ WHERE type = 'table' AND NOT name = 'sqlite_sequence'
247
+ 
248
+ SQL (2.2ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
249
+ SQL (0.0ms) PRAGMA index_list("schema_migrations")
250
+ SQL (1.8ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
251
+ SQL (0.1ms)  SELECT name
252
+ FROM sqlite_master
253
+ WHERE type = 'table' AND NOT name = 'sqlite_sequence'
254
+ 
255
+ SQL (0.1ms) SELECT version FROM "schema_migrations"
256
+ SQL (2.1ms) INSERT INTO "schema_migrations" (version) VALUES ('20110111090943')
257
+ SQL (0.4ms)  SELECT name
258
+ FROM sqlite_master
259
+ WHERE type = 'table' AND NOT name = 'sqlite_sequence'
260
+ 
261
+ SQL (0.1ms) SELECT name
262
+ FROM sqlite_master
263
+ WHERE type = 'table' AND NOT name = 'sqlite_sequence'
264
+ SQL (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations"
265
+ SQL (0.1ms) select sqlite_version(*)
266
+ SQL (0.2ms)  SELECT name
267
+ FROM sqlite_master
268
+ WHERE type = 'table' AND NOT name = 'sqlite_sequence'
269
+ 
270
+ SQL (4.0ms) CREATE TABLE "comments" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "text" text, "user_id" integer)
271
+ SQL (0.1ms)  SELECT name
272
+ FROM sqlite_master
273
+ WHERE type = 'table' AND NOT name = 'sqlite_sequence'
274
+ 
275
+ SQL (1.8ms) CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "login_id" varchar(255), "display_name" varchar(255), "email" varchar(255))
276
+ SQL (0.1ms)  SELECT name
277
+ FROM sqlite_master
278
+ WHERE type = 'table' AND NOT name = 'sqlite_sequence'
279
+ 
280
+ SQL (2.2ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
281
+ SQL (0.1ms) PRAGMA index_list("schema_migrations")
282
+ SQL (3.3ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
283
+ SQL (0.4ms)  SELECT name
284
+ FROM sqlite_master
285
+ WHERE type = 'table' AND NOT name = 'sqlite_sequence'
286
+ 
287
+ SQL (0.2ms) SELECT version FROM "schema_migrations"
288
+ SQL (3.9ms) INSERT INTO "schema_migrations" (version) VALUES ('20110111090943')
@@ -0,0 +1,90 @@
1
+ Processing by CommentsController#index as XML
2
+ Completed 200 OK in 23ms (Views: 17.6ms | ActiveRecord: 0.0ms)
3
+ Processing by CommentsController#index as JSON
4
+ Completed 200 OK in 59ms (Views: 55.8ms | ActiveRecord: 0.0ms)
5
+ Processing by CommentsController#show as XML
6
+ Parameters: {"id"=>"1"}
7
+ Completed 200 OK in 3ms (Views: 1.3ms | ActiveRecord: 0.0ms)
8
+ Processing by CommentsController#show as JSON
9
+ Parameters: {"id"=>"1"}
10
+ Completed 200 OK in 2ms (Views: 0.9ms | ActiveRecord: 0.0ms)
11
+ Processing by CommentsController#index as XML
12
+ Completed 200 OK in 22ms (Views: 17.4ms | ActiveRecord: 0.0ms)
13
+ Processing by CommentsController#index as JSON
14
+ Completed 200 OK in 4ms (Views: 0.9ms | ActiveRecord: 0.0ms)
15
+ Processing by CommentsController#show as XML
16
+ Parameters: {"id"=>"1"}
17
+ Completed 200 OK in 3ms (Views: 1.3ms | ActiveRecord: 0.0ms)
18
+ Processing by CommentsController#show as JSON
19
+ Parameters: {"id"=>"1"}
20
+ Completed 200 OK in 2ms (Views: 0.9ms | ActiveRecord: 0.0ms)
21
+ Processing by CommentsController#index as XML
22
+ Completed 200 OK in 22ms (Views: 17.4ms | ActiveRecord: 0.0ms)
23
+ Processing by CommentsController#index as JSON
24
+ Completed 200 OK in 4ms (Views: 0.9ms | ActiveRecord: 0.0ms)
25
+ Processing by CommentsController#show as XML
26
+ Parameters: {"id"=>"1"}
27
+ Completed 200 OK in 3ms (Views: 1.3ms | ActiveRecord: 0.0ms)
28
+ Processing by CommentsController#show as JSON
29
+ Parameters: {"id"=>"1"}
30
+ Completed 200 OK in 3ms (Views: 1.0ms | ActiveRecord: 0.0ms)
31
+ Processing by CommentsController#index as XML
32
+ Completed 200 OK in 22ms (Views: 17.5ms | ActiveRecord: 0.0ms)
33
+ Processing by CommentsController#index as JSON
34
+ Completed 200 OK in 4ms (Views: 0.9ms | ActiveRecord: 0.0ms)
35
+ Processing by CommentsController#show as XML
36
+ Parameters: {"id"=>"1"}
37
+ Completed 200 OK in 3ms (Views: 1.3ms | ActiveRecord: 0.0ms)
38
+ Processing by CommentsController#show as JSON
39
+ Parameters: {"id"=>"1"}
40
+ Completed 200 OK in 2ms (Views: 0.8ms | ActiveRecord: 0.0ms)
41
+ Processing by CommentsController#index as XML
42
+ Completed 200 OK in 22ms (Views: 17.2ms | ActiveRecord: 0.0ms)
43
+ Processing by CommentsController#index as JSON
44
+ Completed 200 OK in 4ms (Views: 0.9ms | ActiveRecord: 0.0ms)
45
+ Processing by CommentsController#show as XML
46
+ Parameters: {"id"=>"1"}
47
+ Completed 200 OK in 3ms (Views: 1.3ms | ActiveRecord: 0.0ms)
48
+ Processing by CommentsController#show as JSON
49
+ Parameters: {"id"=>"1"}
50
+ Completed 200 OK in 2ms (Views: 0.9ms | ActiveRecord: 0.0ms)
51
+ Processing by CommentsController#index as XML
52
+ Completed 200 OK in 21ms (Views: 15.8ms | ActiveRecord: 0.0ms)
53
+ Processing by CommentsController#index as JSON
54
+ Completed 200 OK in 4ms (Views: 0.9ms | ActiveRecord: 0.0ms)
55
+ Processing by CommentsController#show as XML
56
+ Parameters: {"id"=>"1"}
57
+ Completed 200 OK in 3ms (Views: 1.2ms | ActiveRecord: 0.0ms)
58
+ Processing by CommentsController#show as JSON
59
+ Parameters: {"id"=>"1"}
60
+ Completed 200 OK in 2ms (Views: 0.8ms | ActiveRecord: 0.0ms)
61
+ Processing by CommentsController#index as XML
62
+ Completed 200 OK in 21ms (Views: 16.0ms | ActiveRecord: 0.0ms)
63
+ Processing by CommentsController#index as JSON
64
+ Completed 200 OK in 4ms (Views: 0.9ms | ActiveRecord: 0.0ms)
65
+ Processing by CommentsController#show as XML
66
+ Parameters: {"id"=>"1"}
67
+ Completed 200 OK in 3ms (Views: 1.3ms | ActiveRecord: 0.0ms)
68
+ Processing by CommentsController#show as JSON
69
+ Parameters: {"id"=>"1"}
70
+ Completed 200 OK in 2ms (Views: 0.8ms | ActiveRecord: 0.0ms)
71
+ Processing by CommentsController#index as XML
72
+ Completed 200 OK in 21ms (Views: 16.3ms | ActiveRecord: 0.0ms)
73
+ Processing by CommentsController#index as JSON
74
+ Completed 200 OK in 4ms (Views: 0.9ms | ActiveRecord: 0.0ms)
75
+ Processing by CommentsController#show as XML
76
+ Parameters: {"id"=>"1"}
77
+ Completed 200 OK in 3ms (Views: 1.3ms | ActiveRecord: 0.0ms)
78
+ Processing by CommentsController#show as JSON
79
+ Parameters: {"id"=>"1"}
80
+ Completed 200 OK in 2ms (Views: 0.8ms | ActiveRecord: 0.0ms)
81
+ Processing by CommentsController#index as XML
82
+ Completed 200 OK in 21ms (Views: 15.9ms | ActiveRecord: 0.0ms)
83
+ Processing by CommentsController#index as JSON
84
+ Completed 200 OK in 4ms (Views: 0.9ms | ActiveRecord: 0.0ms)
85
+ Processing by CommentsController#show as XML
86
+ Parameters: {"id"=>"1"}
87
+ Completed 200 OK in 3ms (Views: 1.2ms | ActiveRecord: 0.0ms)
88
+ Processing by CommentsController#show as JSON
89
+ Parameters: {"id"=>"1"}
90
+ Completed 200 OK in 2ms (Views: 0.7ms | ActiveRecord: 0.0ms)
@@ -0,0 +1,53 @@
1
+ require File.expand_path("../../spec_helper", __FILE__)
2
+
3
+ describe CommentsController do
4
+
5
+ before :each do
6
+
7
+ @comment = Comment.new(
8
+ :text => 'my comment',
9
+ :user => User.new(
10
+ :login_id => 'ping',
11
+ :display_name => 'Ping the Duck',
12
+ :email => 'ping@yellow-river.tld'
13
+ ))
14
+
15
+ end
16
+
17
+ describe "GET index" do
18
+
19
+ before :each do
20
+ Comment.should_receive(:all).and_return( [@comment] )
21
+ end
22
+
23
+ it "includes user in the xml" do
24
+ get :index, :format => 'xml'
25
+ response.body.should have_xpath("/comments/comment/user/display-name")
26
+ end
27
+
28
+ it "includes user in the json" do
29
+ get :index, :format => 'json'
30
+ response.body.should == [@comment].to_json(:include => :user )
31
+ end
32
+ end
33
+
34
+ describe "GET show" do
35
+
36
+ before :each do
37
+ Comment.should_receive(:find).and_return( @comment )
38
+ end
39
+
40
+ it "includes user in the xml" do
41
+ get :show, {:id => '1', :format => 'xml'}
42
+ response.body.should have_xpath("/comment/user/display-name")
43
+ end
44
+
45
+ it "includes user in the json" do
46
+ get :show, {:id => '1', :format => 'json'}
47
+ response.body.should == @comment.to_json( :include => :user )
48
+ end
49
+
50
+ end
51
+
52
+
53
+ end
@@ -0,0 +1,27 @@
1
+ # This file is copied to spec/ when you run 'rails generate rspec:install'
2
+ ENV["RAILS_ENV"] ||= 'test'
3
+ require File.expand_path("../../config/environment", __FILE__)
4
+ require 'rspec/rails'
5
+
6
+ # Requires supporting ruby files with custom matchers and macros, etc,
7
+ # in spec/support/ and its subdirectories.
8
+ Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
9
+
10
+ RSpec.configure do |config|
11
+ # == Mock Framework
12
+ #
13
+ # If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
14
+ #
15
+ # config.mock_with :mocha
16
+ # config.mock_with :flexmock
17
+ # config.mock_with :rr
18
+ config.mock_with :rspec
19
+
20
+ # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
21
+ config.fixture_path = "#{::Rails.root}/spec/fixtures"
22
+
23
+ # If you're not using ActiveRecord, or you'd prefer not to run each of your
24
+ # examples within a transaction, remove the following line or assign false
25
+ # instead of true.
26
+ config.use_transactional_fixtures = true
27
+ end
@@ -0,0 +1,108 @@
1
+ # Thanks to Jim Morris. http://blog.wolfman.com/articles/2008/1/2/xpath-matchers-for-rspec
2
+ require 'rexml/document'
3
+ require 'rexml/element'
4
+
5
+ module RSpec
6
+ module Matchers
7
+ # check if the xpath exists one or more times
8
+ class HaveXpath
9
+ def initialize(xpath)
10
+ @xpath = xpath
11
+ end
12
+
13
+ def matches?(response)
14
+ @response = response
15
+ doc = response.is_a?(REXML::Document) ? response : REXML::Document.new(@response)
16
+ match = REXML::XPath.match(doc, @xpath)
17
+ not match.empty?
18
+ end
19
+
20
+ def failure_message
21
+ "Did not find expected xpath #{@xpath}"
22
+ end
23
+
24
+ def negative_failure_message
25
+ "Did find unexpected xpath #{@xpath}"
26
+ end
27
+
28
+ def description
29
+ "match the xpath expression #{@xpath}"
30
+ end
31
+ end
32
+
33
+ def have_xpath(xpath)
34
+ HaveXpath.new(xpath)
35
+ end
36
+
37
+ # check if the xpath has the specified value
38
+ # value is a string and there must be a single result to match its
39
+ # equality against
40
+ class MatchXpath
41
+ def initialize(xpath, val)
42
+ @xpath = xpath
43
+ @val= val
44
+ end
45
+
46
+ def matches?(response)
47
+ @response = response
48
+ doc = response.is_a?(REXML::Document) ? response : REXML::Document.new(@response)
49
+ ok= true
50
+ REXML::XPath.each(doc, @xpath) do |e|
51
+ @actual_val= case e
52
+ when REXML::Attribute
53
+ e.to_s
54
+ when REXML::Element
55
+ e.text
56
+ else
57
+ e.to_s
58
+ end
59
+ return false unless @val == @actual_val
60
+ end
61
+ return ok
62
+ end
63
+
64
+ def failure_message
65
+ "The xpath #{@xpath} did not have the value '#{@val}'
66
+ It was '#{@actual_val}'"
67
+ end
68
+
69
+ def description
70
+ "match the xpath expression #{@xpath} with #{@val}"
71
+ end
72
+ end
73
+
74
+ def match_xpath(xpath, val)
75
+ MatchXpath.new(xpath, val)
76
+ end
77
+
78
+ # checks if the given xpath occurs num times
79
+ class HaveNodes #:nodoc:
80
+ def initialize(xpath, num)
81
+ @xpath= xpath
82
+ @num = num
83
+ end
84
+
85
+ def matches?(response)
86
+ @response = response
87
+ doc = response.is_a?(REXML::Document) ? response : REXML::Document.new(@response)
88
+ match = REXML::XPath.match(doc, @xpath)
89
+ @num_found= match.size
90
+ @num_found == @num
91
+ end
92
+
93
+ def failure_message
94
+ "Did not find expected number of nodes #{@num} in xpath #{@xpath}
95
+ Found #{@num_found}"
96
+ end
97
+
98
+ def description
99
+ "match the number of nodes #{@num}"
100
+ end
101
+ end
102
+
103
+ def have_nodes(xpath, num)
104
+ HaveNodes.new(xpath, num)
105
+ end
106
+
107
+ end
108
+ end