mechanize_store 0.0.8 → 0.0.10

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.
Files changed (81) hide show
  1. checksums.yaml +8 -8
  2. data/README.rdoc +3 -11
  3. data/app/controllers/mechanize_store/orders_controller.rb +2 -2
  4. data/app/models/mechanize_store/order.rb +24 -3
  5. data/app/models/mechanize_store/payment.rb +67 -4
  6. data/app/models/mechanize_store/payment_type.rb +2 -0
  7. data/app/views/mechanize_store/orders/index.html.erb +4 -4
  8. data/config/locales/mechanize_store.pt-BR.yml +28 -8
  9. data/db/migrate/20140602124615_rename_columns.rb +7 -0
  10. data/lib/mechanize_store/version.rb +1 -1
  11. data/spec/controllers/mechanize_store/orders_controller_spec.rb +2 -4
  12. data/spec/dummy/db/development.sqlite3 +0 -0
  13. data/spec/dummy/db/schema.rb +7 -25
  14. data/spec/dummy/db/test.sqlite3 +0 -0
  15. data/spec/dummy/log/development.log +124 -0
  16. data/spec/dummy/log/test.log +4733 -0
  17. data/spec/dummy/public/photos/1/medium.png +0 -0
  18. data/spec/dummy/public/photos/1/thumb.png +0 -0
  19. data/spec/factories/{store_flags.rb → mechanize_store_flags.rb} +0 -0
  20. data/spec/factories/{store_payments.rb → mechanize_store_payments.rb} +0 -0
  21. data/spec/factories/{store_product_categories.rb → mechanize_store_product_categories.rb} +0 -0
  22. data/spec/factories/{store_product_photos.rb → mechanize_store_product_photos.rb} +0 -0
  23. data/spec/factories/{store_stores.rb → mechanize_store_stores.rb} +0 -0
  24. data/spec/models/{store → mechanize_store}/flag_spec.rb +0 -0
  25. data/spec/models/{store → mechanize_store}/freight_spec.rb +0 -0
  26. data/spec/models/{store → mechanize_store}/order_spec.rb +0 -0
  27. data/spec/models/{store → mechanize_store}/payment_spec.rb +0 -0
  28. data/spec/models/{store → mechanize_store}/product_category_spec.rb +0 -0
  29. data/spec/models/{store → mechanize_store}/product_photo_spec.rb +0 -0
  30. data/spec/models/{store → mechanize_store}/product_spec.rb +0 -0
  31. data/spec/models/{store → mechanize_store}/store_spec.rb +0 -0
  32. metadata +29 -103
  33. data/app/controllers/mechanize_store/order_statuses_controller.rb +0 -77
  34. data/app/controllers/mechanize_store/payment_statuses_controller.rb +0 -77
  35. data/app/controllers/mechanize_store/payment_types_controller.rb +0 -77
  36. data/app/models/mechanize_store/order_status.rb +0 -10
  37. data/app/models/mechanize_store/payment_status.rb +0 -20
  38. data/app/views/mechanize_store/order_statuses/_form.html.erb +0 -11
  39. data/app/views/mechanize_store/order_statuses/edit.html.erb +0 -12
  40. data/app/views/mechanize_store/order_statuses/index.html.erb +0 -46
  41. data/app/views/mechanize_store/order_statuses/new.html.erb +0 -9
  42. data/app/views/mechanize_store/order_statuses/show.html.erb +0 -15
  43. data/app/views/mechanize_store/payment_statuses/_form.html.erb +0 -11
  44. data/app/views/mechanize_store/payment_statuses/edit.html.erb +0 -12
  45. data/app/views/mechanize_store/payment_statuses/index.html.erb +0 -46
  46. data/app/views/mechanize_store/payment_statuses/new.html.erb +0 -9
  47. data/app/views/mechanize_store/payment_statuses/show.html.erb +0 -15
  48. data/app/views/mechanize_store/payment_types/_form.html.erb +0 -11
  49. data/app/views/mechanize_store/payment_types/edit.html.erb +0 -12
  50. data/app/views/mechanize_store/payment_types/index.html.erb +0 -46
  51. data/app/views/mechanize_store/payment_types/new.html.erb +0 -9
  52. data/app/views/mechanize_store/payment_types/show.html.erb +0 -15
  53. data/db/migrate/20140401203246_create_mechanize_store_order_statuses.rb +0 -9
  54. data/db/migrate/20140402140318_create_mechanize_store_payment_statuses.rb +0 -9
  55. data/db/migrate/20140402140325_create_mechanize_store_payment_types.rb +0 -9
  56. data/spec/controllers/mechanize_store/order_statuses_controller_spec.rb +0 -138
  57. data/spec/controllers/mechanize_store/payment_statuses_controller_spec.rb +0 -139
  58. data/spec/controllers/mechanize_store/payment_types_controller_spec.rb +0 -139
  59. data/spec/dummy/db/migrate/20140508135827_create_mechanize_store_freights.mechanize_store.rb +0 -13
  60. data/spec/dummy/db/migrate/20140508135828_create_mechanize_store_order_statuses.mechanize_store.rb +0 -10
  61. data/spec/dummy/db/migrate/20140508135829_create_mechanize_store_payment_statuses.mechanize_store.rb +0 -10
  62. data/spec/dummy/db/migrate/20140508135830_create_mechanize_store_payment_types.mechanize_store.rb +0 -10
  63. data/spec/dummy/db/migrate/20140508135831_create_mechanize_store_payments.mechanize_store.rb +0 -16
  64. data/spec/dummy/db/migrate/20140508135832_create_mechanize_store_flags.mechanize_store.rb +0 -10
  65. data/spec/dummy/db/migrate/20140508135833_create_mechanize_store_products.mechanize_store.rb +0 -17
  66. data/spec/dummy/db/migrate/20140508135834_create_mechanize_store_product_photos.mechanize_store.rb +0 -11
  67. data/spec/dummy/db/migrate/20140508135835_create_mechanize_store_orders.mechanize_store.rb +0 -12
  68. data/spec/dummy/db/migrate/20140508135836_create_mechanize_store_product_categories.mechanize_store.rb +0 -11
  69. data/spec/dummy/db/migrate/20140508135837_add_width_to_mechanize_store_product.mechanize_store.rb +0 -7
  70. data/spec/dummy/db/migrate/20140508135838_create_mechanize_store_order_items.mechanize_store.rb +0 -13
  71. data/spec/dummy/db/migrate/20140508135839_add_payment_type_id_to_payment.mechanize_store.rb +0 -7
  72. data/spec/dummy/db/migrate/20140508135840_add_time_to_freight.mechanize_store.rb +0 -6
  73. data/spec/factories/mechanize_store_payment_types.rb +0 -7
  74. data/spec/factories/store_order_statuses.rb +0 -7
  75. data/spec/factories/store_payment_statuses.rb +0 -7
  76. data/spec/models/store/order_status_spec.rb +0 -7
  77. data/spec/models/store/payment_status_spec.rb +0 -7
  78. data/spec/models/store/payment_type_spec.rb +0 -7
  79. data/spec/routing/store/order_statuses_routing_spec.rb +0 -39
  80. data/spec/routing/store/payment_statuses_routing_spec.rb +0 -38
  81. data/spec/routing/store/payment_types_routing_spec.rb +0 -38
@@ -1,139 +0,0 @@
1
- require 'spec_helper'
2
-
3
- module MechanizeStore
4
- describe PaymentStatusesController do
5
-
6
- routes { MechanizeStore::Engine.routes }
7
-
8
- let(:valid_attributes) {{ "name" => "MyString" }}
9
- let(:valid_session) {{ }}
10
-
11
- describe "GET index" do
12
- it "assigns all payment_statuses as @payment_statuses" do
13
- payment_status = PaymentStatus.create! valid_attributes
14
- get :index, {}, valid_session
15
- assigns(:payment_statuses).should eq([payment_status])
16
- end
17
- end
18
-
19
- describe "GET show" do
20
- it "assigns the requested payment_status as @payment_status" do
21
- payment_status = PaymentStatus.create! valid_attributes
22
- get :show, {:id => payment_status.to_param}, valid_session
23
- assigns(:payment_status).should eq(payment_status)
24
- end
25
- end
26
-
27
- describe "GET new" do
28
- it "assigns a new payment_status as @payment_status" do
29
- get :new, {}, valid_session
30
- assigns(:payment_status).should be_a_new(PaymentStatus)
31
- end
32
- end
33
-
34
- describe "GET edit" do
35
- it "assigns the requested payment_status as @payment_status" do
36
- payment_status = PaymentStatus.create! valid_attributes
37
- get :edit, {:id => payment_status.to_param}, valid_session
38
- assigns(:payment_status).should eq(payment_status)
39
- end
40
- end
41
-
42
- describe "POST create" do
43
- describe "with valid params" do
44
- it "creates a new PaymentStatus" do
45
- expect {
46
- post :create, {:payment_status => valid_attributes}, valid_session
47
- }.to change(PaymentStatus, :count).by(1)
48
- end
49
-
50
- it "assigns a newly created payment_status as @payment_status" do
51
- post :create, {:payment_status => valid_attributes}, valid_session
52
- assigns(:payment_status).should be_a(PaymentStatus)
53
- assigns(:payment_status).should be_persisted
54
- end
55
-
56
- it "redirects to the created payment_status" do
57
- post :create, {:payment_status => valid_attributes}, valid_session
58
- response.should redirect_to(PaymentStatus.last)
59
- end
60
- end
61
-
62
- describe "with invalid params" do
63
- it "assigns a newly created but unsaved payment_status as @payment_status" do
64
- # Trigger the behavior that occurs when invalid params are submitted
65
- PaymentStatus.any_instance.stub(:save).and_return(false)
66
- post :create, {:payment_status => { "name" => "invalid value" }}, valid_session
67
- assigns(:payment_status).should be_a_new(PaymentStatus)
68
- end
69
-
70
- it "re-renders the 'new' template" do
71
- # Trigger the behavior that occurs when invalid params are submitted
72
- PaymentStatus.any_instance.stub(:save).and_return(false)
73
- post :create, {:payment_status => { "name" => "invalid value" }}, valid_session
74
- response.should render_template("new")
75
- end
76
- end
77
- end
78
-
79
- describe "PUT update" do
80
- describe "with valid params" do
81
- it "updates the requested payment_status" do
82
- payment_status = PaymentStatus.create! valid_attributes
83
- # Assuming there are no other payment_statuses in the database, this
84
- # specifies that the PaymentStatus created on the previous line
85
- # receives the :update_attributes message with whatever params are
86
- # submitted in the request.
87
- PaymentStatus.any_instance.should_receive(:update).with({ "name" => "MyString" })
88
- put :update, {:id => payment_status.to_param, :payment_status => { "name" => "MyString" }}, valid_session
89
- end
90
-
91
- it "assigns the requested payment_status as @payment_status" do
92
- payment_status = PaymentStatus.create! valid_attributes
93
- put :update, {:id => payment_status.to_param, :payment_status => valid_attributes}, valid_session
94
- assigns(:payment_status).should eq(payment_status)
95
- end
96
-
97
- it "redirects to the payment_status" do
98
- payment_status = PaymentStatus.create! valid_attributes
99
- put :update, {:id => payment_status.to_param, :payment_status => valid_attributes}, valid_session
100
- response.should redirect_to(payment_status)
101
- end
102
- end
103
-
104
- describe "with invalid params" do
105
- it "assigns the payment_status as @payment_status" do
106
- payment_status = PaymentStatus.create! valid_attributes
107
- # Trigger the behavior that occurs when invalid params are submitted
108
- PaymentStatus.any_instance.stub(:save).and_return(false)
109
- put :update, {:id => payment_status.to_param, :payment_status => { "name" => "invalid value" }}, valid_session
110
- assigns(:payment_status).should eq(payment_status)
111
- end
112
-
113
- it "re-renders the 'edit' template" do
114
- payment_status = PaymentStatus.create! valid_attributes
115
- # Trigger the behavior that occurs when invalid params are submitted
116
- PaymentStatus.any_instance.stub(:save).and_return(false)
117
- put :update, {:id => payment_status.to_param, :payment_status => { "name" => "invalid value" }}, valid_session
118
- response.should render_template("edit")
119
- end
120
- end
121
- end
122
-
123
- describe "DELETE destroy" do
124
- it "destroys the requested payment_status" do
125
- payment_status = PaymentStatus.create! valid_attributes
126
- expect {
127
- delete :destroy, {:id => payment_status.to_param}, valid_session
128
- }.to change(PaymentStatus, :count).by(-1)
129
- end
130
-
131
- it "redirects to the payment_statuses list" do
132
- payment_status = PaymentStatus.create! valid_attributes
133
- delete :destroy, {:id => payment_status.to_param}, valid_session
134
- response.should redirect_to(payment_statuses_url)
135
- end
136
- end
137
-
138
- end
139
- end
@@ -1,139 +0,0 @@
1
- require 'spec_helper'
2
-
3
- module MechanizeStore
4
- describe PaymentTypesController do
5
-
6
- routes { MechanizeStore::Engine.routes }
7
-
8
- let(:valid_attributes) { { "name" => "MyString" } }
9
- let(:valid_session) { {} }
10
-
11
- describe "GET index" do
12
- it "assigns all payment_types as @payment_types" do
13
- payment_type = PaymentType.create! valid_attributes
14
- get :index, {}, valid_session
15
- assigns(:payment_types).should eq([payment_type])
16
- end
17
- end
18
-
19
- describe "GET show" do
20
- it "assigns the requested payment_type as @payment_type" do
21
- payment_type = PaymentType.create! valid_attributes
22
- get :show, {:id => payment_type.to_param}, valid_session
23
- assigns(:payment_type).should eq(payment_type)
24
- end
25
- end
26
-
27
- describe "GET new" do
28
- it "assigns a new payment_type as @payment_type" do
29
- get :new, {}, valid_session
30
- assigns(:payment_type).should be_a_new(PaymentType)
31
- end
32
- end
33
-
34
- describe "GET edit" do
35
- it "assigns the requested payment_type as @payment_type" do
36
- payment_type = PaymentType.create! valid_attributes
37
- get :edit, {:id => payment_type.to_param}, valid_session
38
- assigns(:payment_type).should eq(payment_type)
39
- end
40
- end
41
-
42
- describe "POST create" do
43
- describe "with valid params" do
44
- it "creates a new PaymentType" do
45
- expect {
46
- post :create, {:payment_type => valid_attributes}, valid_session
47
- }.to change(PaymentType, :count).by(1)
48
- end
49
-
50
- it "assigns a newly created payment_type as @payment_type" do
51
- post :create, {:payment_type => valid_attributes}, valid_session
52
- assigns(:payment_type).should be_a(PaymentType)
53
- assigns(:payment_type).should be_persisted
54
- end
55
-
56
- it "redirects to the created payment_type" do
57
- post :create, {:payment_type => valid_attributes}, valid_session
58
- response.should redirect_to(PaymentType.last)
59
- end
60
- end
61
-
62
- describe "with invalid params" do
63
- it "assigns a newly created but unsaved payment_type as @payment_type" do
64
- # Trigger the behavior that occurs when invalid params are submitted
65
- PaymentType.any_instance.stub(:save).and_return(false)
66
- post :create, {:payment_type => { "name" => "invalid value" }}, valid_session
67
- assigns(:payment_type).should be_a_new(PaymentType)
68
- end
69
-
70
- it "re-renders the 'new' template" do
71
- # Trigger the behavior that occurs when invalid params are submitted
72
- PaymentType.any_instance.stub(:save).and_return(false)
73
- post :create, {:payment_type => { "name" => "invalid value" }}, valid_session
74
- response.should render_template("new")
75
- end
76
- end
77
- end
78
-
79
- describe "PUT update" do
80
- describe "with valid params" do
81
- it "updates the requested payment_type" do
82
- payment_type = PaymentType.create! valid_attributes
83
- # Assuming there are no other payment_types in the database, this
84
- # specifies that the PaymentType created on the previous line
85
- # receives the :update_attributes message with whatever params are
86
- # submitted in the request.
87
- PaymentType.any_instance.should_receive(:update).with({ "name" => "MyString" })
88
- put :update, {:id => payment_type.to_param, :payment_type => { "name" => "MyString" }}, valid_session
89
- end
90
-
91
- it "assigns the requested payment_type as @payment_type" do
92
- payment_type = PaymentType.create! valid_attributes
93
- put :update, {:id => payment_type.to_param, :payment_type => valid_attributes}, valid_session
94
- assigns(:payment_type).should eq(payment_type)
95
- end
96
-
97
- it "redirects to the payment_type" do
98
- payment_type = PaymentType.create! valid_attributes
99
- put :update, {:id => payment_type.to_param, :payment_type => valid_attributes}, valid_session
100
- response.should redirect_to(payment_type)
101
- end
102
- end
103
-
104
- describe "with invalid params" do
105
- it "assigns the payment_type as @payment_type" do
106
- payment_type = PaymentType.create! valid_attributes
107
- # Trigger the behavior that occurs when invalid params are submitted
108
- PaymentType.any_instance.stub(:save).and_return(false)
109
- put :update, {:id => payment_type.to_param, :payment_type => { "name" => "invalid value" }}, valid_session
110
- assigns(:payment_type).should eq(payment_type)
111
- end
112
-
113
- it "re-renders the 'edit' template" do
114
- payment_type = PaymentType.create! valid_attributes
115
- # Trigger the behavior that occurs when invalid params are submitted
116
- PaymentType.any_instance.stub(:save).and_return(false)
117
- put :update, {:id => payment_type.to_param, :payment_type => { "name" => "invalid value" }}, valid_session
118
- response.should render_template("edit")
119
- end
120
- end
121
- end
122
-
123
- describe "DELETE destroy" do
124
- it "destroys the requested payment_type" do
125
- payment_type = PaymentType.create! valid_attributes
126
- expect {
127
- delete :destroy, {:id => payment_type.to_param}, valid_session
128
- }.to change(PaymentType, :count).by(-1)
129
- end
130
-
131
- it "redirects to the payment_types list" do
132
- payment_type = PaymentType.create! valid_attributes
133
- delete :destroy, {:id => payment_type.to_param}, valid_session
134
- response.should redirect_to(payment_types_url)
135
- end
136
- end
137
-
138
- end
139
- end
@@ -1,13 +0,0 @@
1
- # This migration comes from mechanize_store (originally 20140401203200)
2
- class CreateMechanizeStoreFreights < ActiveRecord::Migration
3
- def change
4
- create_table :mechanize_store_freights do |t|
5
- t.float :value
6
- t.string :service
7
- t.references :order, index: true
8
- t.string :zipcode
9
-
10
- t.timestamps
11
- end
12
- end
13
- end
@@ -1,10 +0,0 @@
1
- # This migration comes from mechanize_store (originally 20140401203246)
2
- class CreateMechanizeStoreOrderStatuses < ActiveRecord::Migration
3
- def change
4
- create_table :mechanize_store_order_statuses do |t|
5
- t.string :name
6
-
7
- t.timestamps
8
- end
9
- end
10
- end
@@ -1,10 +0,0 @@
1
- # This migration comes from mechanize_store (originally 20140402140318)
2
- class CreateMechanizeStorePaymentStatuses < ActiveRecord::Migration
3
- def change
4
- create_table :mechanize_store_payment_statuses do |t|
5
- t.string :name
6
-
7
- t.timestamps
8
- end
9
- end
10
- end
@@ -1,10 +0,0 @@
1
- # This migration comes from mechanize_store (originally 20140402140325)
2
- class CreateMechanizeStorePaymentTypes < ActiveRecord::Migration
3
- def change
4
- create_table :mechanize_store_payment_types do |t|
5
- t.string :name
6
-
7
- t.timestamps
8
- end
9
- end
10
- end
@@ -1,16 +0,0 @@
1
- # This migration comes from mechanize_store (originally 20140402140539)
2
- class CreateMechanizeStorePayments < ActiveRecord::Migration
3
- def change
4
- create_table :mechanize_store_payments do |t|
5
- t.integer :order_id, index: true
6
- t.references :payment_status, index: true
7
- t.float :value
8
- t.float :paid_value
9
- t.datetime :paid_in
10
- t.integer :plot
11
- t.references :flag, index: true
12
-
13
- t.timestamps
14
- end
15
- end
16
- end
@@ -1,10 +0,0 @@
1
- # This migration comes from mechanize_store (originally 20140402140549)
2
- class CreateMechanizeStoreFlags < ActiveRecord::Migration
3
- def change
4
- create_table :mechanize_store_flags do |t|
5
- t.string :name
6
-
7
- t.timestamps
8
- end
9
- end
10
- end
@@ -1,17 +0,0 @@
1
- # This migration comes from mechanize_store (originally 20140402140832)
2
- class CreateMechanizeStoreProducts < ActiveRecord::Migration
3
- def change
4
- create_table :mechanize_store_products do |t|
5
- t.string :name
6
- t.text :description
7
- t.string :short_description
8
- t.float :price
9
- t.float :weight
10
- t.float :length
11
- t.float :height
12
- t.references :product_category, index: true
13
-
14
- t.timestamps
15
- end
16
- end
17
- end
@@ -1,11 +0,0 @@
1
- # This migration comes from mechanize_store (originally 20140402140942)
2
- class CreateMechanizeStoreProductPhotos < ActiveRecord::Migration
3
- def change
4
- create_table :mechanize_store_product_photos do |t|
5
- t.attachment :file
6
- t.references :product, index: true
7
-
8
- t.timestamps
9
- end
10
- end
11
- end
@@ -1,12 +0,0 @@
1
- # This migration comes from mechanize_store (originally 20140402153139)
2
- class CreateMechanizeStoreOrders < ActiveRecord::Migration
3
- def change
4
- create_table :mechanize_store_orders do |t|
5
- t.references :order_status, index: true
6
- t.references :store, index: true
7
- t.datetime :delivery_date
8
-
9
- t.timestamps
10
- end
11
- end
12
- end
@@ -1,11 +0,0 @@
1
- # This migration comes from mechanize_store (originally 20140402192058)
2
- class CreateMechanizeStoreProductCategories < ActiveRecord::Migration
3
- def change
4
- create_table :mechanize_store_product_categories do |t|
5
- t.string :name
6
- t.references :product_category
7
-
8
- t.timestamps
9
- end
10
- end
11
- end
@@ -1,7 +0,0 @@
1
- # This migration comes from mechanize_store (originally 20140407193412)
2
- # This migration comes from mechanize_store (originally 20140407193412)
3
- class AddWidthToMechanizeStoreProduct < ActiveRecord::Migration
4
- def change
5
- add_column :mechanize_store_products, :width, :float
6
- end
7
- end
@@ -1,13 +0,0 @@
1
- # This migration comes from mechanize_store (originally 20140409191426)
2
- class CreateMechanizeStoreOrderItems < ActiveRecord::Migration
3
- def change
4
- create_table :mechanize_store_order_items do |t|
5
- t.integer :quantity
6
- t.float :price
7
- t.references :order, index: true
8
- t.references :product, index: true
9
-
10
- t.timestamps
11
- end
12
- end
13
- end
@@ -1,7 +0,0 @@
1
- # This migration comes from mechanize_store (originally 20140416123100)
2
- class AddPaymentTypeIdToPayment < ActiveRecord::Migration
3
- def change
4
- add_column :mechanize_store_payments, :payment_type_id, :integer
5
- add_index :mechanize_store_payments, :payment_type_id
6
- end
7
- end