mechanize_store 0.0.5 → 0.0.6
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 +8 -8
- data/app/controllers/mechanize_store/products_controller.rb +1 -1
- data/app/models/mechanize_store/flag.rb +1 -0
- data/app/models/mechanize_store/order.rb +2 -0
- data/app/models/mechanize_store/order_item.rb +2 -0
- data/app/models/mechanize_store/payment.rb +7 -1
- data/app/models/mechanize_store/payment_status.rb +2 -1
- data/app/models/mechanize_store/payment_type.rb +1 -1
- data/app/models/mechanize_store/product.rb +2 -0
- data/app/models/mechanize_store/product_category.rb +2 -0
- data/app/models/mechanize_store/product_photo.rb +1 -1
- data/lib/mechanize_store/version.rb +1 -1
- data/spec/controllers/mechanize_store/orders_controller_spec.rb +4 -2
- data/spec/controllers/mechanize_store/products_controller_spec.rb +1 -1
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/log/development.log +85 -0
- data/spec/dummy/log/test.log +21721 -0
- data/spec/dummy/public/photos/1/medium.png +0 -0
- data/spec/dummy/public/photos/1/thumb.png +0 -0
- data/spec/factories/{store_freights.rb → mechanize_store_freights.rb} +1 -0
- data/spec/factories/store_flags.rb +1 -1
- metadata +6 -4
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZGQ3NmJmNmExMDhhYjlmZjdkYTMyZjM2NWYyNDdjMTAzMTk2MmIyMA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NDIyY2Y2ZGU2NWNiYmVhY2NhOTZmZDE5NGZhMTFhYjBmM2U4ZDQzYg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZDU4ZTI4ZWY3MGNkYmY0OTAyMjhjZjI0OTE4YjI4NmNmMjEzNmJkNGFjZjQx
|
10
|
+
NTNhMDUxYmQ3YzhhZGZhNWQ5ZjE4NjYwOTg1YWNiNGFjOGFhZjAwMDExMjhj
|
11
|
+
MTY2ZGI5MmYyNTQ2ZmNkNDk3MTc1Zjc1NzhjZmExZWVhNDM3OGM=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MDI1M2E0Y2ViNTg4NmE2MjI1MGM0ZWNkOWMyYjU5ZTVlZTVkZGFkZWUyMjU0
|
14
|
+
MTNjMzY2ZTAwYTc4ODBkZmJlNzczZDEzOWI4MzAwZDRjZDlmYWYyNmI5YmU1
|
15
|
+
ZGI0YjJmNGY4MzU1YWUwNjVkYzVkYjM4ZTZhNTY3ZmY1ODZlMTA=
|
@@ -71,7 +71,7 @@ module MechanizeStore
|
|
71
71
|
|
72
72
|
# Only allow a trusted parameter "white list" through.
|
73
73
|
def product_params
|
74
|
-
params.require(:product).permit(:name, :description, :short_description, :price, :weight, :length, :height, :product_category_id)
|
74
|
+
params.require(:product).permit(:name, :description, :short_description, :width, :price, :weight, :length, :height, :product_category_id)
|
75
75
|
end
|
76
76
|
end
|
77
77
|
end
|
@@ -5,6 +5,12 @@ module MechanizeStore
|
|
5
5
|
belongs_to :payment_type
|
6
6
|
belongs_to :flag
|
7
7
|
|
8
|
-
|
8
|
+
validates :payment_type_id, :flag_id, presence: true
|
9
|
+
|
10
|
+
before_create :before_create
|
11
|
+
|
12
|
+
def before_create
|
13
|
+
self.payment_status_id = PaymentStatus::AWAITING
|
14
|
+
end
|
9
15
|
end
|
10
16
|
end
|
@@ -3,6 +3,8 @@ module MechanizeStore
|
|
3
3
|
belongs_to :product_category, class_name: MechanizeStore::ProductCategory
|
4
4
|
has_many :product_photos, class_name: MechanizeStore::ProductPhoto
|
5
5
|
|
6
|
+
validates :name, :price, :description, :short_description, :weight, :length, :width, :height, presence: true
|
7
|
+
|
6
8
|
def first_photo
|
7
9
|
return nil if self.product_photos.empty?
|
8
10
|
return self.product_photos.first
|
@@ -6,7 +6,7 @@ module MechanizeStore
|
|
6
6
|
:styles => { :medium => "300x300>", :thumb => "100x100>" },
|
7
7
|
:default_url => "/images/:style/missing.png",
|
8
8
|
path: "#{Rails.root}/public/photos/:id/:style.:extension",
|
9
|
-
url: "/photos/:id/:style.:extension"
|
9
|
+
url: "/photos/:id/:style.:extension"
|
10
10
|
# storage: :s3,
|
11
11
|
# s3_credentials: "#{Rails.root}/config/amazon_s3.yml"
|
12
12
|
|
@@ -6,9 +6,11 @@ module MechanizeStore
|
|
6
6
|
|
7
7
|
before do
|
8
8
|
@payment_type = FactoryGirl.create(:mechanize_store_payment_type)
|
9
|
-
@
|
9
|
+
@flag = FactoryGirl.create(:mechanize_store_flag)
|
10
|
+
@payment = FactoryGirl.build(:mechanize_store_payment, payment_type: @payment_type, flag: @flag)
|
10
11
|
@order_status = FactoryGirl.create(:mechanize_store_order_status)
|
11
|
-
@
|
12
|
+
@freight = FactoryGirl.create(:mechanize_store_freight)
|
13
|
+
@order = FactoryGirl.create(:mechanize_store_order, payment: @payment, order_status: @order_status, freight: @freight)
|
12
14
|
end
|
13
15
|
|
14
16
|
let(:valid_session) { {} }
|
@@ -5,7 +5,7 @@ module MechanizeStore
|
|
5
5
|
|
6
6
|
routes { MechanizeStore::Engine.routes }
|
7
7
|
|
8
|
-
let(:valid_attributes) { { "name" => "MyString" } }
|
8
|
+
let(:valid_attributes) { { "name" => "MyString", price: 10, width: 1, height: 2, length: 2, weight: 1, description: "Product description", short_description: "Short" } }
|
9
9
|
let(:valid_session) { {} }
|
10
10
|
|
11
11
|
describe "GET index" do
|
Binary file
|
@@ -25409,3 +25409,88 @@ Processing by MechanizeStore::ProductsController#new as HTML
|
|
25409
25409
|
Rendered /Users/wilbert/apps/mechanize_store/app/views/mechanize_store/products/_form.html.erb (218.5ms)
|
25410
25410
|
Rendered /Users/wilbert/apps/mechanize_store/app/views/mechanize_store/products/new.html.erb (242.4ms)
|
25411
25411
|
Completed 200 OK in 285ms (Views: 256.7ms | ActiveRecord: 0.8ms)
|
25412
|
+
[1m[36m (7.5ms)[0m [1mCREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) [0m
|
25413
|
+
[1m[35m (0.9ms)[0m CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
|
25414
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.2ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
25415
|
+
Migrating to CreateMechanizeStoreFreights (20140508135827)
|
25416
|
+
[1m[35m (0.1ms)[0m begin transaction
|
25417
|
+
[1m[36m (0.4ms)[0m [1mCREATE TABLE "mechanize_store_freights" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "value" float, "service" varchar(255), "order_id" integer, "zipcode" varchar(255), "created_at" datetime, "updated_at" datetime) [0m
|
25418
|
+
[1m[35m (0.1ms)[0m CREATE INDEX "index_mechanize_store_freights_on_order_id" ON "mechanize_store_freights" ("order_id")
|
25419
|
+
[1m[36mSQL (3.1ms)[0m [1mINSERT INTO "schema_migrations" ("version") VALUES (?)[0m [["version", "20140508135827"]]
|
25420
|
+
[1m[35m (0.8ms)[0m commit transaction
|
25421
|
+
Migrating to CreateMechanizeStoreOrderStatuses (20140508135828)
|
25422
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
25423
|
+
[1m[35m (0.4ms)[0m CREATE TABLE "mechanize_store_order_statuses" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "created_at" datetime, "updated_at" datetime)
|
25424
|
+
[1m[36mSQL (0.1ms)[0m [1mINSERT INTO "schema_migrations" ("version") VALUES (?)[0m [["version", "20140508135828"]]
|
25425
|
+
[1m[35m (0.7ms)[0m commit transaction
|
25426
|
+
Migrating to CreateMechanizeStorePaymentStatuses (20140508135829)
|
25427
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
25428
|
+
[1m[35m (0.4ms)[0m CREATE TABLE "mechanize_store_payment_statuses" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "created_at" datetime, "updated_at" datetime)
|
25429
|
+
[1m[36mSQL (0.2ms)[0m [1mINSERT INTO "schema_migrations" ("version") VALUES (?)[0m [["version", "20140508135829"]]
|
25430
|
+
[1m[35m (0.7ms)[0m commit transaction
|
25431
|
+
Migrating to CreateMechanizeStorePaymentTypes (20140508135830)
|
25432
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
25433
|
+
[1m[35m (0.3ms)[0m CREATE TABLE "mechanize_store_payment_types" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "created_at" datetime, "updated_at" datetime)
|
25434
|
+
[1m[36mSQL (0.3ms)[0m [1mINSERT INTO "schema_migrations" ("version") VALUES (?)[0m [["version", "20140508135830"]]
|
25435
|
+
[1m[35m (0.6ms)[0m commit transaction
|
25436
|
+
Migrating to CreateMechanizeStorePayments (20140508135831)
|
25437
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
25438
|
+
[1m[35m (0.3ms)[0m CREATE TABLE "mechanize_store_payments" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "order_id" integer, "payment_status_id" integer, "value" float, "paid_value" float, "paid_in" datetime, "plot" integer, "flag_id" integer, "created_at" datetime, "updated_at" datetime)
|
25439
|
+
[1m[36m (0.1ms)[0m [1mCREATE INDEX "index_mechanize_store_payments_on_payment_status_id" ON "mechanize_store_payments" ("payment_status_id")[0m
|
25440
|
+
[1m[35m (0.1ms)[0m CREATE INDEX "index_mechanize_store_payments_on_flag_id" ON "mechanize_store_payments" ("flag_id")
|
25441
|
+
[1m[36mSQL (0.1ms)[0m [1mINSERT INTO "schema_migrations" ("version") VALUES (?)[0m [["version", "20140508135831"]]
|
25442
|
+
[1m[35m (0.8ms)[0m commit transaction
|
25443
|
+
Migrating to CreateMechanizeStoreFlags (20140508135832)
|
25444
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
25445
|
+
[1m[35m (0.3ms)[0m CREATE TABLE "mechanize_store_flags" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "created_at" datetime, "updated_at" datetime)
|
25446
|
+
[1m[36mSQL (0.1ms)[0m [1mINSERT INTO "schema_migrations" ("version") VALUES (?)[0m [["version", "20140508135832"]]
|
25447
|
+
[1m[35m (0.7ms)[0m commit transaction
|
25448
|
+
Migrating to CreateMechanizeStoreProducts (20140508135833)
|
25449
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
25450
|
+
[1m[35m (0.4ms)[0m CREATE TABLE "mechanize_store_products" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "description" text, "short_description" varchar(255), "price" float, "weight" float, "length" float, "height" float, "product_category_id" integer, "created_at" datetime, "updated_at" datetime)
|
25451
|
+
[1m[36m (0.3ms)[0m [1mCREATE INDEX "index_mechanize_store_products_on_product_category_id" ON "mechanize_store_products" ("product_category_id")[0m
|
25452
|
+
[1m[35mSQL (0.1ms)[0m INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20140508135833"]]
|
25453
|
+
[1m[36m (0.6ms)[0m [1mcommit transaction[0m
|
25454
|
+
Migrating to CreateMechanizeStoreProductPhotos (20140508135834)
|
25455
|
+
[1m[35m (0.1ms)[0m begin transaction
|
25456
|
+
[1m[36m (0.3ms)[0m [1mCREATE TABLE "mechanize_store_product_photos" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "file_file_name" varchar(255), "file_content_type" varchar(255), "file_file_size" integer, "file_updated_at" datetime, "product_id" integer, "created_at" datetime, "updated_at" datetime) [0m
|
25457
|
+
[1m[35m (0.1ms)[0m CREATE INDEX "index_mechanize_store_product_photos_on_product_id" ON "mechanize_store_product_photos" ("product_id")
|
25458
|
+
[1m[36mSQL (0.1ms)[0m [1mINSERT INTO "schema_migrations" ("version") VALUES (?)[0m [["version", "20140508135834"]]
|
25459
|
+
[1m[35m (0.7ms)[0m commit transaction
|
25460
|
+
Migrating to CreateMechanizeStoreOrders (20140508135835)
|
25461
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
25462
|
+
[1m[35m (0.4ms)[0m CREATE TABLE "mechanize_store_orders" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "order_status_id" integer, "store_id" integer, "delivery_date" datetime, "created_at" datetime, "updated_at" datetime)
|
25463
|
+
[1m[36m (0.1ms)[0m [1mCREATE INDEX "index_mechanize_store_orders_on_order_status_id" ON "mechanize_store_orders" ("order_status_id")[0m
|
25464
|
+
[1m[35m (0.1ms)[0m CREATE INDEX "index_mechanize_store_orders_on_store_id" ON "mechanize_store_orders" ("store_id")
|
25465
|
+
[1m[36mSQL (0.1ms)[0m [1mINSERT INTO "schema_migrations" ("version") VALUES (?)[0m [["version", "20140508135835"]]
|
25466
|
+
[1m[35m (0.8ms)[0m commit transaction
|
25467
|
+
Migrating to CreateMechanizeStoreProductCategories (20140508135836)
|
25468
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
25469
|
+
[1m[35m (0.3ms)[0m CREATE TABLE "mechanize_store_product_categories" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "product_category_id" integer, "created_at" datetime, "updated_at" datetime)
|
25470
|
+
[1m[36mSQL (0.1ms)[0m [1mINSERT INTO "schema_migrations" ("version") VALUES (?)[0m [["version", "20140508135836"]]
|
25471
|
+
[1m[35m (0.8ms)[0m commit transaction
|
25472
|
+
Migrating to AddWidthToMechanizeStoreProduct (20140508135837)
|
25473
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
25474
|
+
[1m[35m (0.3ms)[0m ALTER TABLE "mechanize_store_products" ADD "width" float
|
25475
|
+
[1m[36mSQL (0.2ms)[0m [1mINSERT INTO "schema_migrations" ("version") VALUES (?)[0m [["version", "20140508135837"]]
|
25476
|
+
[1m[35m (0.7ms)[0m commit transaction
|
25477
|
+
Migrating to CreateMechanizeStoreOrderItems (20140508135838)
|
25478
|
+
[1m[36m (0.2ms)[0m [1mbegin transaction[0m
|
25479
|
+
[1m[35m (0.5ms)[0m CREATE TABLE "mechanize_store_order_items" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "quantity" integer, "price" float, "order_id" integer, "product_id" integer, "created_at" datetime, "updated_at" datetime)
|
25480
|
+
[1m[36m (0.1ms)[0m [1mCREATE INDEX "index_mechanize_store_order_items_on_order_id" ON "mechanize_store_order_items" ("order_id")[0m
|
25481
|
+
[1m[35m (0.1ms)[0m CREATE INDEX "index_mechanize_store_order_items_on_product_id" ON "mechanize_store_order_items" ("product_id")
|
25482
|
+
[1m[36mSQL (0.2ms)[0m [1mINSERT INTO "schema_migrations" ("version") VALUES (?)[0m [["version", "20140508135838"]]
|
25483
|
+
[1m[35m (0.9ms)[0m commit transaction
|
25484
|
+
Migrating to AddPaymentTypeIdToPayment (20140508135839)
|
25485
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
25486
|
+
[1m[35m (0.5ms)[0m ALTER TABLE "mechanize_store_payments" ADD "payment_type_id" integer
|
25487
|
+
[1m[36m (0.2ms)[0m [1mCREATE INDEX "index_mechanize_store_payments_on_payment_type_id" ON "mechanize_store_payments" ("payment_type_id")[0m
|
25488
|
+
[1m[35mSQL (0.2ms)[0m INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20140508135839"]]
|
25489
|
+
[1m[36m (0.8ms)[0m [1mcommit transaction[0m
|
25490
|
+
Migrating to AddTimeToFreight (20140508135840)
|
25491
|
+
[1m[35m (0.1ms)[0m begin transaction
|
25492
|
+
[1m[36m (0.4ms)[0m [1mALTER TABLE "mechanize_store_freights" ADD "delivery_time" integer[0m
|
25493
|
+
[1m[35mSQL (0.2ms)[0m INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20140508135840"]]
|
25494
|
+
[1m[36m (0.7ms)[0m [1mcommit transaction[0m
|
25495
|
+
[1m[35mActiveRecord::SchemaMigration Load (0.1ms)[0m SELECT "schema_migrations".* FROM "schema_migrations"
|
25496
|
+
[1m[36mMechanizeStore::Product Load (0.3ms)[0m [1mSELECT "mechanize_store_products".* FROM "mechanize_store_products" ORDER BY "mechanize_store_products"."id" ASC LIMIT 1[0m
|