render_variant 0.1.0 → 0.1.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 637163a35218f50bd9adfa16c3a8d5f8e023e1c3
4
- data.tar.gz: 39f509c9004357eea65036d0db2d49a7c9bfc434
3
+ metadata.gz: 57748c63e6408eff7bc9eeb1ce2a4c9078038811
4
+ data.tar.gz: e3a75c5096213ba72386d7a2d79b782552cf1a06
5
5
  SHA512:
6
- metadata.gz: 8f7b18b988808842c35c62a5739cad4ac38aafc518907c2a9541a65b74e657e04f3e4981ddd6cda81585411d9381e601f30e2e3be736566e7893d21efe67af66
7
- data.tar.gz: 2363d23d91735e5f06c33b96f3c673077a865ebc18ac3c791bebed06d0d4dc525a300139e4bff6d44c224a561f9273558d734a42dc2b0fed042a47c72a3ede58
6
+ metadata.gz: fd4611e0eb9570665dce4926bffef6484bfb6926b65f8a81adb4e3ff1b594b9c945241a746839aead21d4a2626dd74a2b0af030a6d195014a5d0cfb40691710c
7
+ data.tar.gz: b5c3987274bef336ea52c34e2997d3134766442d958f12c5773e8c2006578b7ffa71bf4ea2a6a55ea1fd26d1d4331dc15b383a0d5c733544c37ccff1a4b25531
@@ -1,3 +1,3 @@
1
1
  module RenderVariant
2
- VERSION = "0.0.9"
2
+ VERSION = "0.1.1"
3
3
  end
@@ -0,0 +1,10 @@
1
+ class VariantObjectsController < ApplicationController
2
+
3
+ def index
4
+ @variant_objects = VariantObject.all
5
+
6
+ if(params[:variant])
7
+ @variant = params[:variant]
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,2 @@
1
+ class VariantObject < ActiveRecord::Base
2
+ end
@@ -0,0 +1 @@
1
+ <h1 class="default_template"><%= variant_object.name %></h1>
@@ -0,0 +1 @@
1
+ <h2 class="medium_template"><%= variant_object.name %></h2>
@@ -0,0 +1 @@
1
+ <h3 class="small_template"><%= variant_object.name %></h3>
@@ -0,0 +1,21 @@
1
+ <div id="test_disp_container">
2
+ <% if @variant %>
3
+
4
+ <%= render @variant_objects, :variant => @variant %>
5
+ <hr/>
6
+ <% @variant_objects.each do |variant_object| %>
7
+ <%= render :partial=> variant_object, :variant => @variant %>
8
+ <br/>
9
+ <%= render variant_object, :variant => @variant %>
10
+ <% end %>
11
+
12
+ <% else %>
13
+ <%= render @variant_objects %>
14
+ <hr/>
15
+ <% @variant_objects.each do |variant_object| %>
16
+ <%= render :partial=> variant_object %>
17
+ <br/>
18
+ <%= render variant_object %>
19
+ <% end %>
20
+ <% end %>
21
+ </div>
@@ -1,5 +1,5 @@
1
1
  Dummy::Application.routes.draw do
2
- resources :test_objs
2
+ resources :variant_objects
3
3
 
4
4
  # The priority is based upon order of creation: first created -> highest priority.
5
5
  # See how all your routes lay out with "rake routes".
Binary file
@@ -0,0 +1,9 @@
1
+ class CreateVariantObjects < ActiveRecord::Migration
2
+ def change
3
+ create_table :variant_objects do |t|
4
+ t.string :name
5
+ t.string :desc
6
+ t.timestamps
7
+ end
8
+ end
9
+ end
@@ -13,7 +13,7 @@
13
13
 
14
14
  ActiveRecord::Schema.define(version: 20131206162427) do
15
15
 
16
- create_table "test_objs", force: true do |t|
16
+ create_table "variant_objects", force: true do |t|
17
17
  t.string "name"
18
18
  t.string "desc"
19
19
  t.datetime "created_at"
Binary file
@@ -13,3 +13,28 @@ Migrating to CreateTestObjs (20131206162427)
13
13
   (0.1ms) SELECT version FROM "schema_migrations"
14
14
   (0.6ms) INSERT INTO "schema_migrations" (version) VALUES ('20131206162427')
15
15
  ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
16
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
17
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
18
+  (1.7ms) CREATE TABLE "test_objs" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "desc" varchar(255), "created_at" datetime, "updated_at" datetime) 
19
+  (0.8ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
20
+  (0.6ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
21
+  (0.1ms) SELECT version FROM "schema_migrations"
22
+  (0.7ms) INSERT INTO "schema_migrations" (version) VALUES ('20131206162427')
23
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
24
+  (1.8ms) CREATE TABLE "test_objs" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "desc" varchar(255), "created_at" datetime, "updated_at" datetime) 
25
+  (0.9ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
26
+  (0.9ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
27
+  (0.1ms) SELECT version FROM "schema_migrations"
28
+  (0.7ms) INSERT INTO "schema_migrations" (version) VALUES ('20131206162427')
29
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
30
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
31
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
32
+  (1.4ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
33
+  (0.8ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
34
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
35
+ Migrating to CreateVariantObjects (20131206162427)
36
+  (0.0ms) begin transaction
37
+  (0.2ms) CREATE TABLE "variant_objects" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "desc" varchar(255), "created_at" datetime, "updated_at" datetime) 
38
+ SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20131206162427"]]
39
+  (0.7ms) commit transaction
40
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
@@ -313,3 +313,209 @@ Processing by TestObjsController#index as HTML
313
313
  Completed 200 OK in 3ms (Views: 2.3ms | ActiveRecord: 0.1ms)
314
314
   (0.0ms) SELECT COUNT(*) FROM "test_objs"
315
315
   (0.0ms) rollback transaction
316
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
317
+  (0.1ms) begin transaction
318
+  (0.0ms) rollback transaction
319
+  (0.0ms) begin transaction
320
+  (0.0ms) rollback transaction
321
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
322
+  (0.0ms) begin transaction
323
+  (0.0ms) rollback transaction
324
+  (0.0ms) begin transaction
325
+  (0.0ms) rollback transaction
326
+  (1.9ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
327
+  (0.8ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
328
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
329
+ Migrating to CreateVariantObjects (20131206162427)
330
+  (0.1ms) begin transaction
331
+  (0.3ms) CREATE TABLE "variant_objects" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "desc" varchar(255), "created_at" datetime, "updated_at" datetime) 
332
+ SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20131206162427"]]
333
+  (0.7ms) commit transaction
334
+  (0.0ms) begin transaction
335
+ Fixture Delete (0.1ms) DELETE FROM "variant_objects"
336
+ Fixture Insert (0.1ms) INSERT INTO "variant_objects" ("name", "desc", "created_at", "updated_at", "id") VALUES ('Test1', 'test1 description', '2013-12-09 20:57:50', '2013-12-09 20:57:50', 980190962)
337
+ Fixture Insert (0.0ms) INSERT INTO "variant_objects" ("name", "desc", "created_at", "updated_at", "id") VALUES ('Test2', 'test2 description', '2013-12-09 20:57:50', '2013-12-09 20:57:50', 298486374)
338
+  (0.7ms) commit transaction
339
+  (0.0ms) begin transaction
340
+ ------------------------------------------------------
341
+ VariantObjectControllerTest: test_renders_with_variant
342
+ ------------------------------------------------------
343
+  (0.0ms) rollback transaction
344
+  (0.0ms) begin transaction
345
+ ---------------------------------------------------------
346
+ VariantObjectControllerTest: test_renders_without_variant
347
+ ---------------------------------------------------------
348
+  (0.0ms) rollback transaction
349
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
350
+  (0.0ms) begin transaction
351
+ Fixture Delete (0.3ms) DELETE FROM "variant_objects"
352
+ Fixture Insert (0.1ms) INSERT INTO "variant_objects" ("name", "desc", "created_at", "updated_at", "id") VALUES ('Test1', 'test1 description', '2013-12-09 20:59:01', '2013-12-09 20:59:01', 980190962)
353
+ Fixture Insert (0.0ms) INSERT INTO "variant_objects" ("name", "desc", "created_at", "updated_at", "id") VALUES ('Test2', 'test2 description', '2013-12-09 20:59:01', '2013-12-09 20:59:01', 298486374)
354
+  (1.1ms) commit transaction
355
+  (0.0ms) begin transaction
356
+ ------------------------------------------------------
357
+ VariantObjectControllerTest: test_renders_with_variant
358
+ ------------------------------------------------------
359
+ Started GET "/variant_objects?variant=medium" for 127.0.0.1 at 2013-12-09 12:59:01 -0800
360
+  (0.1ms) rollback transaction
361
+  (0.1ms) begin transaction
362
+ ---------------------------------------------------------
363
+ VariantObjectControllerTest: test_renders_without_variant
364
+ ---------------------------------------------------------
365
+  (0.0ms) rollback transaction
366
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
367
+  (0.1ms) begin transaction
368
+ Fixture Delete (0.2ms) DELETE FROM "variant_objects"
369
+ Fixture Insert (0.1ms) INSERT INTO "variant_objects" ("name", "desc", "created_at", "updated_at", "id") VALUES ('Test1', 'test1 description', '2013-12-09 20:59:17', '2013-12-09 20:59:17', 980190962)
370
+ Fixture Insert (0.0ms) INSERT INTO "variant_objects" ("name", "desc", "created_at", "updated_at", "id") VALUES ('Test2', 'test2 description', '2013-12-09 20:59:17', '2013-12-09 20:59:17', 298486374)
371
+  (0.5ms) commit transaction
372
+  (0.0ms) begin transaction
373
+ ------------------------------------------------------
374
+ VariantObjectControllerTest: test_renders_with_variant
375
+ ------------------------------------------------------
376
+ Started GET "/variant_objects?variant=medium" for 127.0.0.1 at 2013-12-09 12:59:17 -0800
377
+  (0.1ms) rollback transaction
378
+  (0.0ms) begin transaction
379
+ ---------------------------------------------------------
380
+ VariantObjectControllerTest: test_renders_without_variant
381
+ ---------------------------------------------------------
382
+ Started GET "/variant_objects" for 127.0.0.1 at 2013-12-09 12:59:17 -0800
383
+  (0.0ms) rollback transaction
384
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
385
+  (0.1ms) begin transaction
386
+ Fixture Delete (0.2ms) DELETE FROM "variant_objects"
387
+ Fixture Insert (0.1ms) INSERT INTO "variant_objects" ("name", "desc", "created_at", "updated_at", "id") VALUES ('Test1', 'test1 description', '2013-12-09 20:59:48', '2013-12-09 20:59:48', 980190962)
388
+ Fixture Insert (0.0ms) INSERT INTO "variant_objects" ("name", "desc", "created_at", "updated_at", "id") VALUES ('Test2', 'test2 description', '2013-12-09 20:59:48', '2013-12-09 20:59:48', 298486374)
389
+  (1.0ms) commit transaction
390
+  (0.0ms) begin transaction
391
+ ------------------------------------------------------
392
+ VariantObjectControllerTest: test_renders_with_variant
393
+ ------------------------------------------------------
394
+ Started GET "/variant_objects?variant=medium" for 127.0.0.1 at 2013-12-09 12:59:48 -0800
395
+ Processing by VariantObjectsController#index as HTML
396
+ Parameters: {"variant"=>"medium"}
397
+ VariantObject Load (0.1ms) SELECT "variant_objects".* FROM "variant_objects"
398
+ Rendered variant_objects/_variant_object_medium.html.erb (7.0ms)
399
+ Rendered variant_objects/index.html.erb within layouts/application (11.6ms)
400
+ Completed 500 Internal Server Error in 14ms
401
+  (0.1ms) rollback transaction
402
+  (0.0ms) begin transaction
403
+ ---------------------------------------------------------
404
+ VariantObjectControllerTest: test_renders_without_variant
405
+ ---------------------------------------------------------
406
+ Started GET "/variant_objects" for 127.0.0.1 at 2013-12-09 12:59:48 -0800
407
+ Processing by VariantObjectsController#index as HTML
408
+ VariantObject Load (0.1ms) SELECT "variant_objects".* FROM "variant_objects"
409
+ Rendered variant_objects/_variant_object.html.erb (26.5ms)
410
+ Completed 500 Internal Server Error in 28ms
411
+  (0.1ms) rollback transaction
412
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
413
+  (0.1ms) begin transaction
414
+ Fixture Delete (0.2ms) DELETE FROM "variant_objects"
415
+ Fixture Insert (0.1ms) INSERT INTO "variant_objects" ("name", "desc", "created_at", "updated_at", "id") VALUES ('Test1', 'test1 description', '2013-12-09 21:00:40', '2013-12-09 21:00:40', 980190962)
416
+ Fixture Insert (0.1ms) INSERT INTO "variant_objects" ("name", "desc", "created_at", "updated_at", "id") VALUES ('Test2', 'test2 description', '2013-12-09 21:00:40', '2013-12-09 21:00:40', 298486374)
417
+  (1.4ms) commit transaction
418
+  (0.1ms) begin transaction
419
+ ------------------------------------------------------
420
+ VariantObjectControllerTest: test_renders_with_variant
421
+ ------------------------------------------------------
422
+ Started GET "/variant_objects?variant=medium" for 127.0.0.1 at 2013-12-09 13:00:40 -0800
423
+ Processing by VariantObjectsController#index as HTML
424
+ Parameters: {"variant"=>"medium"}
425
+ Rendered variant_objects/index.html.erb within layouts/application (1.9ms)
426
+ Completed 500 Internal Server Error in 4ms
427
+  (0.1ms) rollback transaction
428
+  (0.0ms) begin transaction
429
+ ---------------------------------------------------------
430
+ VariantObjectControllerTest: test_renders_without_variant
431
+ ---------------------------------------------------------
432
+ Started GET "/variant_objects" for 127.0.0.1 at 2013-12-09 13:00:40 -0800
433
+ Processing by VariantObjectsController#index as HTML
434
+ Completed 500 Internal Server Error in 1ms
435
+  (0.0ms) rollback transaction
436
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
437
+  (0.0ms) begin transaction
438
+ Fixture Delete (0.2ms) DELETE FROM "variant_objects"
439
+ Fixture Insert (0.1ms) INSERT INTO "variant_objects" ("name", "desc", "created_at", "updated_at", "id") VALUES ('Test1', 'test1 description', '2013-12-09 21:01:23', '2013-12-09 21:01:23', 980190962)
440
+ Fixture Insert (0.0ms) INSERT INTO "variant_objects" ("name", "desc", "created_at", "updated_at", "id") VALUES ('Test2', 'test2 description', '2013-12-09 21:01:23', '2013-12-09 21:01:23', 298486374)
441
+  (1.1ms) commit transaction
442
+  (0.0ms) begin transaction
443
+ ------------------------------------------------------
444
+ VariantObjectControllerTest: test_renders_with_variant
445
+ ------------------------------------------------------
446
+ Started GET "/variant_objects?variant=medium" for 127.0.0.1 at 2013-12-09 13:01:23 -0800
447
+ Processing by VariantObjectsController#index as HTML
448
+ Parameters: {"variant"=>"medium"}
449
+ VariantObject Load (0.2ms) SELECT "variant_objects".* FROM "variant_objects"
450
+ Rendered variant_objects/_variant_object_medium.html.erb (0.4ms)
451
+ Rendered variant_objects/_variant_object_medium.html.erb (0.2ms)
452
+ Rendered variant_objects/_variant_object_medium.html.erb (0.2ms)
453
+ Rendered variant_objects/_variant_object_medium.html.erb (0.1ms)
454
+ Rendered variant_objects/_variant_object_medium.html.erb (0.0ms)
455
+ Rendered variant_objects/index.html.erb within layouts/application (6.9ms)
456
+ Completed 200 OK in 10ms (Views: 9.4ms | ActiveRecord: 0.2ms)
457
+  (0.1ms) rollback transaction
458
+  (0.0ms) begin transaction
459
+ ---------------------------------------------------------
460
+ VariantObjectControllerTest: test_renders_without_variant
461
+ ---------------------------------------------------------
462
+ Started GET "/variant_objects" for 127.0.0.1 at 2013-12-09 13:01:23 -0800
463
+ Processing by VariantObjectsController#index as HTML
464
+ VariantObject Load (0.1ms) SELECT "variant_objects".* FROM "variant_objects"
465
+ Rendered variant_objects/_variant_object.html.erb (0.4ms)
466
+ Rendered variant_objects/_variant_object.html.erb (0.3ms)
467
+ Rendered variant_objects/_variant_object.html.erb (0.0ms)
468
+ Rendered variant_objects/_variant_object.html.erb (0.0ms)
469
+ Rendered variant_objects/_variant_object.html.erb (0.0ms)
470
+ Completed 200 OK in 3ms (Views: 2.4ms | ActiveRecord: 0.1ms)
471
+  (0.1ms) rollback transaction
472
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
473
+  (0.1ms) begin transaction
474
+ Fixture Delete (0.2ms) DELETE FROM "variant_objects"
475
+ Fixture Insert (0.1ms) INSERT INTO "variant_objects" ("name", "desc", "created_at", "updated_at", "id") VALUES ('Test1', 'test1 description', '2013-12-09 21:01:43', '2013-12-09 21:01:43', 980190962)
476
+ Fixture Insert (0.0ms) INSERT INTO "variant_objects" ("name", "desc", "created_at", "updated_at", "id") VALUES ('Test2', 'test2 description', '2013-12-09 21:01:43', '2013-12-09 21:01:43', 298486374)
477
+  (1.0ms) commit transaction
478
+  (0.0ms) begin transaction
479
+ ------------------------------------------------------
480
+ VariantObjectControllerTest: test_renders_with_variant
481
+ ------------------------------------------------------
482
+ Started GET "/variant_objects?variant=medium" for 127.0.0.1 at 2013-12-09 13:01:43 -0800
483
+ Processing by VariantObjectsController#index as HTML
484
+ Parameters: {"variant"=>"medium"}
485
+ VariantObject Load (0.1ms) SELECT "variant_objects".* FROM "variant_objects"
486
+ Rendered variant_objects/_variant_object_medium.html.erb (0.4ms)
487
+ Rendered variant_objects/_variant_object_medium.html.erb (0.2ms)
488
+ Rendered variant_objects/_variant_object_medium.html.erb (0.2ms)
489
+ Rendered variant_objects/_variant_object_medium.html.erb (0.0ms)
490
+ Rendered variant_objects/_variant_object_medium.html.erb (0.0ms)
491
+ Rendered variant_objects/index.html.erb within layouts/application (6.6ms)
492
+ Completed 200 OK in 9ms (Views: 9.0ms | ActiveRecord: 0.1ms)
493
+  (0.1ms) SELECT COUNT(*) FROM "variant_objects"
494
+ Started GET "/variant_objects?variant=small" for 127.0.0.1 at 2013-12-09 13:01:43 -0800
495
+ Processing by VariantObjectsController#index as HTML
496
+ Parameters: {"variant"=>"small"}
497
+ VariantObject Load (0.1ms) SELECT "variant_objects".* FROM "variant_objects"
498
+ Rendered variant_objects/_variant_object_small.html.erb (0.3ms)
499
+ Rendered variant_objects/_variant_object_small.html.erb (0.2ms)
500
+ Rendered variant_objects/_variant_object_small.html.erb (0.3ms)
501
+ Rendered variant_objects/_variant_object_small.html.erb (0.0ms)
502
+ Rendered variant_objects/_variant_object_small.html.erb (0.0ms)
503
+ Rendered variant_objects/index.html.erb within layouts/application (3.2ms)
504
+ Completed 200 OK in 4ms (Views: 3.5ms | ActiveRecord: 0.1ms)
505
+  (0.1ms) SELECT COUNT(*) FROM "variant_objects"
506
+  (0.1ms) rollback transaction
507
+  (0.0ms) begin transaction
508
+ ---------------------------------------------------------
509
+ VariantObjectControllerTest: test_renders_without_variant
510
+ ---------------------------------------------------------
511
+ Started GET "/variant_objects" for 127.0.0.1 at 2013-12-09 13:01:43 -0800
512
+ Processing by VariantObjectsController#index as HTML
513
+ VariantObject Load (0.1ms) SELECT "variant_objects".* FROM "variant_objects"
514
+ Rendered variant_objects/_variant_object.html.erb (0.5ms)
515
+ Rendered variant_objects/_variant_object.html.erb (0.3ms)
516
+ Rendered variant_objects/_variant_object.html.erb (0.0ms)
517
+ Rendered variant_objects/_variant_object.html.erb (0.0ms)
518
+ Rendered variant_objects/_variant_object.html.erb (0.0ms)
519
+ Completed 200 OK in 3ms (Views: 3.0ms | ActiveRecord: 0.1ms)
520
+  (0.1ms) SELECT COUNT(*) FROM "variant_objects"
521
+  (0.0ms) rollback transaction
@@ -11,4 +11,4 @@ one:
11
11
  #
12
12
  two:
13
13
  name: "Test2"
14
- desc: "test2 description"
14
+ desc: "test2 description"
@@ -1,18 +1,18 @@
1
1
  require 'test_helper'
2
2
 
3
- class TestObjsControllerTest < ActionDispatch::IntegrationTest
3
+ class VariantObjectControllerTest < ActionDispatch::IntegrationTest
4
4
  fixtures :all
5
5
 
6
6
  #instead of loading individual partials, attempt to render the entire collection with and without variants
7
7
  test "renders without variant" do
8
- get test_objs_path
8
+ get variant_objects_path
9
9
  assert_response :success
10
10
  assert_select ".default_template", :count=> expected_render_count
11
11
  end
12
12
 
13
13
  test "renders with variant" do
14
- test_variants.each do |name|
15
- get test_objs_path(:variant => name)
14
+ variants_for_test.each do |name|
15
+ get variant_objects_path(:variant => name)
16
16
  assert_response :success
17
17
  assert_select ".#{name}_template", :count=> expected_render_count
18
18
  end
data/test/test_helper.rb CHANGED
@@ -16,11 +16,11 @@ if ActiveSupport::TestCase.method_defined?(:fixture_path=)
16
16
  ActiveSupport::TestCase.fixture_path = File.expand_path("../fixtures", __FILE__)
17
17
  end
18
18
 
19
- def test_variants
19
+ def variants_for_test
20
20
  [:medium, :small]
21
21
  end
22
22
 
23
23
  #How many time we should expect to see the item rendered in index.
24
24
  def expected_render_count
25
- TestObj.count * 3
25
+ VariantObject.count * 3
26
26
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: render_variant
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - alex
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-06 00:00:00.000000000 Z
11
+ date: 2013-12-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -56,14 +56,14 @@ files:
56
56
  - test/dummy/app/assets/javascripts/application.js
57
57
  - test/dummy/app/assets/stylesheets/application.css
58
58
  - test/dummy/app/controllers/application_controller.rb
59
- - test/dummy/app/controllers/test_objs_controller.rb
59
+ - test/dummy/app/controllers/variant_objects_controller.rb
60
60
  - test/dummy/app/helpers/application_helper.rb
61
- - test/dummy/app/models/test_obj.rb
61
+ - test/dummy/app/models/variant_object.rb
62
62
  - test/dummy/app/views/layouts/application.html.erb
63
- - test/dummy/app/views/test_objs/_test_obj.html.erb
64
- - test/dummy/app/views/test_objs/_test_obj_medium.html.erb
65
- - test/dummy/app/views/test_objs/_test_obj_small.html.erb
66
- - test/dummy/app/views/test_objs/index.html.erb
63
+ - test/dummy/app/views/variant_objects/_variant_object.html.erb
64
+ - test/dummy/app/views/variant_objects/_variant_object_medium.html.erb
65
+ - test/dummy/app/views/variant_objects/_variant_object_small.html.erb
66
+ - test/dummy/app/views/variant_objects/index.html.erb
67
67
  - test/dummy/bin/bundle
68
68
  - test/dummy/bin/rails
69
69
  - test/dummy/bin/rake
@@ -85,7 +85,7 @@ files:
85
85
  - test/dummy/config/routes.rb
86
86
  - test/dummy/config.ru
87
87
  - test/dummy/db/development.sqlite3
88
- - test/dummy/db/migrate/20131206162427_create_test_objs.rb
88
+ - test/dummy/db/migrate/20131206162427_create_variant_objects.rb
89
89
  - test/dummy/db/schema.rb
90
90
  - test/dummy/db/test.sqlite3
91
91
  - test/dummy/log/development.log
@@ -96,10 +96,10 @@ files:
96
96
  - test/dummy/public/favicon.ico
97
97
  - test/dummy/Rakefile
98
98
  - test/dummy/README.rdoc
99
- - test/dummy/test/fixtures/test_objs.yml
100
- - test/integration/test_objs_controller_test.rb
99
+ - test/dummy/test/fixtures/variant_objects.yml
100
+ - test/integration/variant_object_controller_test.rb
101
101
  - test/test_helper.rb
102
- homepage: http://www.avvo.com
102
+ homepage: http://github.com/alexanderross/render_variant
103
103
  licenses: []
104
104
  metadata: {}
105
105
  post_install_message:
@@ -126,14 +126,14 @@ test_files:
126
126
  - test/dummy/app/assets/javascripts/application.js
127
127
  - test/dummy/app/assets/stylesheets/application.css
128
128
  - test/dummy/app/controllers/application_controller.rb
129
- - test/dummy/app/controllers/test_objs_controller.rb
129
+ - test/dummy/app/controllers/variant_objects_controller.rb
130
130
  - test/dummy/app/helpers/application_helper.rb
131
- - test/dummy/app/models/test_obj.rb
131
+ - test/dummy/app/models/variant_object.rb
132
132
  - test/dummy/app/views/layouts/application.html.erb
133
- - test/dummy/app/views/test_objs/_test_obj.html.erb
134
- - test/dummy/app/views/test_objs/_test_obj_medium.html.erb
135
- - test/dummy/app/views/test_objs/_test_obj_small.html.erb
136
- - test/dummy/app/views/test_objs/index.html.erb
133
+ - test/dummy/app/views/variant_objects/_variant_object.html.erb
134
+ - test/dummy/app/views/variant_objects/_variant_object_medium.html.erb
135
+ - test/dummy/app/views/variant_objects/_variant_object_small.html.erb
136
+ - test/dummy/app/views/variant_objects/index.html.erb
137
137
  - test/dummy/bin/bundle
138
138
  - test/dummy/bin/rails
139
139
  - test/dummy/bin/rake
@@ -155,7 +155,7 @@ test_files:
155
155
  - test/dummy/config/routes.rb
156
156
  - test/dummy/config.ru
157
157
  - test/dummy/db/development.sqlite3
158
- - test/dummy/db/migrate/20131206162427_create_test_objs.rb
158
+ - test/dummy/db/migrate/20131206162427_create_variant_objects.rb
159
159
  - test/dummy/db/schema.rb
160
160
  - test/dummy/db/test.sqlite3
161
161
  - test/dummy/log/development.log
@@ -166,6 +166,6 @@ test_files:
166
166
  - test/dummy/public/favicon.ico
167
167
  - test/dummy/Rakefile
168
168
  - test/dummy/README.rdoc
169
- - test/dummy/test/fixtures/test_objs.yml
170
- - test/integration/test_objs_controller_test.rb
169
+ - test/dummy/test/fixtures/variant_objects.yml
170
+ - test/integration/variant_object_controller_test.rb
171
171
  - test/test_helper.rb
@@ -1,10 +0,0 @@
1
- class TestObjsController < ApplicationController
2
-
3
- def index
4
- @test_objs = TestObj.all
5
-
6
- if(params[:variant])
7
- @variant = params[:variant]
8
- end
9
- end
10
- end
@@ -1,2 +0,0 @@
1
- class TestObj < ActiveRecord::Base
2
- end
@@ -1 +0,0 @@
1
- <h1 class="default_template"><%= test_obj.name %></h1>
@@ -1 +0,0 @@
1
- <h2 class="medium_template"><%= test_obj.name %></h2>
@@ -1 +0,0 @@
1
- <h3 class="small_template"><%= test_obj.name %></h3>
@@ -1,21 +0,0 @@
1
- <div id="test_disp_container">
2
- <% if @variant %>
3
-
4
- <%= render @test_objs, :variant => @variant %>
5
- <hr/>
6
- <% @test_objs.each do |test_obj| %>
7
- <%= render :partial=> test_obj, :variant => @variant %>
8
- <br/>
9
- <%= render test_obj, :variant => @variant %>
10
- <% end %>
11
-
12
- <% else %>
13
- <%= render @test_objs %>
14
- <hr/>
15
- <% @test_objs.each do |test_obj| %>
16
- <%= render :partial=> test_obj %>
17
- <br/>
18
- <%= render test_obj %>
19
- <% end %>
20
- <% end %>
21
- </div>
@@ -1,9 +0,0 @@
1
- class CreateTestObjs < ActiveRecord::Migration
2
- def change
3
- create_table :test_objs do |t|
4
- t.string :name
5
- t.string :desc
6
- t.timestamps
7
- end
8
- end
9
- end