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,10 +0,0 @@
1
- module MechanizeStore
2
- class OrderStatus < ActiveRecord::Base
3
- validates :name, presence: true
4
-
5
- ACCOMPLISHED = 1
6
- SUBMITTED = 2
7
- DELIVERED = 3
8
- CANCELED = 4
9
- end
10
- end
@@ -1,20 +0,0 @@
1
- module MechanizeStore
2
- class PaymentStatus < ActiveRecord::Base
3
- validates :name, presence: true
4
-
5
- #ids inseridos na base de dados
6
- ACCOMPLISHED = 1
7
- IN_ANALISIS = 2
8
- AWAITING = 3
9
- CANCELED = 4
10
- UNAUHTORIZED = 5
11
- NEEDS_AUTHORIZATION = 6
12
-
13
- def label_str
14
- return "success" if self.id == ACCOMPLISHED
15
- return "warning" if self.id == AWAITING or self.id == IN_ANALISIS
16
- return "info" if self.id == CANCELED
17
- return "danger" if self.id == NEEDS_AUTHORIZATION or self.id = UNAUHTORIZED
18
- end
19
- end
20
- end
@@ -1,11 +0,0 @@
1
- <%= simple_form_for(@order_status) do |f| %>
2
- <%= f.error_notification %>
3
-
4
- <div class="form-group">
5
- <%= f.input :name %>
6
- </div>
7
-
8
- <div class="form-actions">
9
- <%= f.button :submit, t(:create, model: t(:order_status, scope: "activerecord.models.mechanize_store"), scope: "helpers.submit"), class: "btn btn-primary" %>
10
- </div>
11
- <% end %>
@@ -1,12 +0,0 @@
1
- <%= title t(:editing, model: t("order_status", scope: "activerecord.models")) %>
2
-
3
- <% content_for :right do -%>
4
- <li class="active">
5
- <%= link_to t(:details), @order_status %>
6
- </li>
7
- <li class="active">
8
- <%= link_to t(:back), order_statuses_path %>
9
- </li>
10
- <% end -%>
11
-
12
- <%= render 'form' %>
@@ -1,46 +0,0 @@
1
- <%= title t("order_status", scope: "activerecord.models.mechanize_store").pluralize %>
2
-
3
- <% content_for :right do -%>
4
- <li class="active">
5
- <%= link_to t("new_order_status"), new_order_status_path %>
6
- </li>
7
- <% end -%>
8
-
9
- <table class="table table-striped">
10
- <thead>
11
- <tr>
12
- <th><%= sort_link @search, :id, t(:id, scope: "activerecord.attributes.mechanize_store") %></th>
13
- <th><%= sort_link @search, :name, t(:name, scope: "activerecord.attributes.mechanize_store.order_status") %></th>
14
- <th colspan="3"></th>
15
- </tr>
16
- </thead>
17
-
18
- <tbody>
19
-
20
- <% @order_statuses.each do |order_status| %>
21
- <tr>
22
- <td><%= order_status.id %></td>
23
- <td><%= order_status.name %></td>
24
- <td>
25
- <%= link_to order_status do %>
26
- <i class="fa fa-file"></i>
27
- <% end -%>
28
- </td>
29
- <td>
30
- <%= link_to edit_order_status_path(order_status) do %>
31
- <i class="fa fa-edit"></i>
32
- <% end -%>
33
- </td>
34
- <td>
35
- <%= link_to order_status, method: :delete, data: { confirm: t(:are_you_sure) } do %>
36
- <i class="fa fa-trash"></i>
37
- <% end -%>
38
- </td>
39
- </tr>
40
- <% end %>
41
- </tbody>
42
- </table>
43
-
44
- <br>
45
-
46
- <%= will_paginate @order_statuses %>
@@ -1,9 +0,0 @@
1
- <%= title t("new_order_status") %>
2
-
3
- <% content_for :right do -%>
4
- <li class="active">
5
- <%= link_to t(:back), order_statuses_path %>
6
- </li>
7
- <% end -%>
8
-
9
- <%= render 'form' %>
@@ -1,15 +0,0 @@
1
- <%= title t("order_status") %>
2
-
3
- <% content_for :right do -%>
4
- <li class="active">
5
- <%= link_to t(:edit), edit_order_status_path(@order_status) %>
6
- </li>
7
- <li class="active">
8
- <%= link_to t(:back), order_statuses_path %>
9
- </li>
10
- <% end -%>
11
-
12
- <p>
13
- <small><%= t(:name, scope: "activerecord.attributes.order_status") %>:</small>
14
- <h3><%= @order_status.name %></h3>
15
- </p>
@@ -1,11 +0,0 @@
1
- <%= simple_form_for(@payment_status) do |f| %>
2
- <%= f.error_notification %>
3
-
4
- <div class="form-group">
5
- <%= f.input :name %>
6
- </div>
7
-
8
- <div class="form-actions">
9
- <%= f.button :submit, t(:create, model: t(:payment_status, scope: "activerecord.models.mechanize_store"), scope: "helpers.submit"), class: "btn btn-primary" %>
10
- </div>
11
- <% end %>
@@ -1,12 +0,0 @@
1
- <%= title t(:editing, model: t("payment_status", scope: "activerecord.models")) %>
2
-
3
- <% content_for :right do -%>
4
- <li class="active">
5
- <%= link_to t(:details), @payment_status %>
6
- </li>
7
- <li class="active">
8
- <%= link_to t(:back), payment_statuses_path %>
9
- </li>
10
- <% end -%>
11
-
12
- <%= render 'form' %>
@@ -1,46 +0,0 @@
1
- <%= title t("payment_status", scope: "activerecord.models.mechanize_store").pluralize %>
2
-
3
- <% content_for :right do -%>
4
- <li class="active">
5
- <%= link_to t("new_payment_status"), new_payment_status_path %>
6
- </li>
7
- <% end -%>
8
-
9
- <table class="table table-striped">
10
- <thead>
11
- <tr>
12
- <th><%= sort_link @search, :id, t(:id, scope: "activerecord.attributes.mechanize_store") %></th>
13
- <th><%= sort_link @search, :name, t(:name, scope: "activerecord.attributes.mechanize_store.payment_status") %></th>
14
- <th colspan="3"></th>
15
- </tr>
16
- </thead>
17
-
18
- <tbody>
19
-
20
- <% @payment_statuses.each do |payment_status| %>
21
- <tr>
22
- <td><%= payment_status.id %></td>
23
- <td><%= payment_status.name %></td>
24
- <td>
25
- <%= link_to payment_status do %>
26
- <i class="fa fa-file"></i>
27
- <% end -%>
28
- </td>
29
- <td>
30
- <%= link_to edit_payment_status_path(payment_status) do %>
31
- <i class="fa fa-edit"></i>
32
- <% end -%>
33
- </td>
34
- <td>
35
- <%= link_to payment_status, method: :delete, data: { confirm: t(:are_you_sure) } do %>
36
- <i class="fa fa-trash"></i>
37
- <% end -%>
38
- </td>
39
- </tr>
40
- <% end %>
41
- </tbody>
42
- </table>
43
-
44
- <br>
45
-
46
- <%= will_paginate @payment_statuses %>
@@ -1,9 +0,0 @@
1
- <%= title t("new_payment_status") %>
2
-
3
- <% content_for :right do -%>
4
- <li class="active">
5
- <%= link_to t(:back), payment_statuses_path %>
6
- </li>
7
- <% end -%>
8
-
9
- <%= render 'form' %>
@@ -1,15 +0,0 @@
1
- <%= title t("payment_status") %>
2
-
3
- <% content_for :right do -%>
4
- <li class="active">
5
- <%= link_to t(:edit), edit_payment_status_path(@payment_status) %>
6
- </li>
7
- <li class="active">
8
- <%= link_to t(:back), payment_statuses_path %>
9
- </li>
10
- <% end -%>
11
-
12
- <p>
13
- <small><%= t(:name, scope: "activerecord.attributes.payment_status") %>:</small>
14
- <h3><%= @payment_status.name %></h3>
15
- </p>
@@ -1,11 +0,0 @@
1
- <%= simple_form_for(@payment_type) do |f| %>
2
- <%= f.error_notification %>
3
-
4
- <div class="form-group">
5
- <%= f.input :name %>
6
- </div>
7
-
8
- <div class="form-actions">
9
- <%= f.button :submit, t(:create, model: t(:order_status, scope: "activerecord.models.mechanize_store"), scope: "helpers.submit"), class: "btn btn-primary" %>
10
- </div>
11
- <% end %>
@@ -1,12 +0,0 @@
1
- <%= title t(:editing, model: t("payment_type", scope: "activerecord.models")) %>
2
-
3
- <% content_for :right do -%>
4
- <li class="active">
5
- <%= link_to t(:details), @payment_type %>
6
- </li>
7
- <li class="active">
8
- <%= link_to t(:back), payment_types_path %>
9
- </li>
10
- <% end -%>
11
-
12
- <%= render 'form' %>
@@ -1,46 +0,0 @@
1
- <%= title t("payment_type", scope: "activerecord.models.mechanize_store").pluralize %>
2
-
3
- <% content_for :right do -%>
4
- <li class="active">
5
- <%= link_to t("new_payment_type"), new_payment_type_path %>
6
- </li>
7
- <% end -%>
8
-
9
- <table class="table table-striped">
10
- <thead>
11
- <tr>
12
- <th><%= sort_link @search, :id, t(:id, scope: "activerecord.attributes") %></th>
13
- <th><%= sort_link @search, :name, t(:name, scope: "activerecord.attributes.mechanize_store/payment_type") %></th>
14
- <th colspan="3"></th>
15
- </tr>
16
- </thead>
17
-
18
- <tbody>
19
-
20
- <% @payment_types.each do |payment_type| %>
21
- <tr>
22
- <td><%= payment_type.id %></td>
23
- <td><%= payment_type.name %></td>
24
- <td>
25
- <%= link_to payment_type do %>
26
- <i class="fa fa-file"></i>
27
- <% end -%>
28
- </td>
29
- <td>
30
- <%= link_to edit_payment_type_path(payment_type) do %>
31
- <i class="fa fa-edit"></i>
32
- <% end -%>
33
- </td>
34
- <td>
35
- <%= link_to payment_type, method: :delete, data: { confirm: t(:are_you_sure) } do %>
36
- <i class="fa fa-trash"></i>
37
- <% end -%>
38
- </td>
39
- </tr>
40
- <% end %>
41
- </tbody>
42
- </table>
43
-
44
- <br>
45
-
46
- <%= will_paginate @payment_types %>
@@ -1,9 +0,0 @@
1
- <%= title t("new_payment_type") %>
2
-
3
- <% content_for :right do -%>
4
- <li class="active">
5
- <%= link_to t(:back), payment_types_path %>
6
- </li>
7
- <% end -%>
8
-
9
- <%= render 'form' %>
@@ -1,15 +0,0 @@
1
- <%= title t("payment_type") %>
2
-
3
- <% content_for :right do -%>
4
- <li class="active">
5
- <%= link_to t(:edit), edit_payment_type_path(@payment_type) %>
6
- </li>
7
- <li class="active">
8
- <%= link_to t(:back), payment_types_path %>
9
- </li>
10
- <% end -%>
11
-
12
- <p>
13
- <small><%= t(:name, scope: "activerecord.attributes.payment_type") %>:</small>
14
- <h3><%= @payment_type.name %></h3>
15
- </p>
@@ -1,9 +0,0 @@
1
- class CreateMechanizeStoreOrderStatuses < ActiveRecord::Migration
2
- def change
3
- create_table :mechanize_store_order_statuses do |t|
4
- t.string :name
5
-
6
- t.timestamps
7
- end
8
- end
9
- end
@@ -1,9 +0,0 @@
1
- class CreateMechanizeStorePaymentStatuses < ActiveRecord::Migration
2
- def change
3
- create_table :mechanize_store_payment_statuses do |t|
4
- t.string :name
5
-
6
- t.timestamps
7
- end
8
- end
9
- end
@@ -1,9 +0,0 @@
1
- class CreateMechanizeStorePaymentTypes < ActiveRecord::Migration
2
- def change
3
- create_table :mechanize_store_payment_types do |t|
4
- t.string :name
5
-
6
- t.timestamps
7
- end
8
- end
9
- end
@@ -1,138 +0,0 @@
1
- require 'spec_helper'
2
-
3
- module MechanizeStore
4
- describe OrderStatusesController do
5
- routes { MechanizeStore::Engine.routes }
6
-
7
- let(:valid_attributes) { { "name" => "MyString" } }
8
- let(:valid_session) { {} }
9
-
10
- describe "GET index" do
11
- it "assigns all order_statuses as @order_statuses" do
12
- order_status = OrderStatus.create! valid_attributes
13
- get :index, {}, valid_session
14
- assigns(:order_statuses).should eq([order_status])
15
- end
16
- end
17
-
18
- describe "GET show" do
19
- it "assigns the requested order_status as @order_status" do
20
- order_status = OrderStatus.create! valid_attributes
21
- get :show, {:id => order_status.to_param}, valid_session
22
- assigns(:order_status).should eq(order_status)
23
- end
24
- end
25
-
26
- describe "GET new" do
27
- it "assigns a new order_status as @order_status" do
28
- get :new, {}, valid_session
29
- assigns(:order_status).should be_a_new(OrderStatus)
30
- end
31
- end
32
-
33
- describe "GET edit" do
34
- it "assigns the requested order_status as @order_status" do
35
- order_status = OrderStatus.create! valid_attributes
36
- get :edit, {:id => order_status.to_param}, valid_session
37
- assigns(:order_status).should eq(order_status)
38
- end
39
- end
40
-
41
- describe "POST create" do
42
- describe "with valid params" do
43
- it "creates a new OrderStatus" do
44
- expect {
45
- post :create, {:order_status => valid_attributes}, valid_session
46
- }.to change(OrderStatus, :count).by(1)
47
- end
48
-
49
- it "assigns a newly created order_status as @order_status" do
50
- post :create, {:order_status => valid_attributes}, valid_session
51
- assigns(:order_status).should be_a(OrderStatus)
52
- assigns(:order_status).should be_persisted
53
- end
54
-
55
- it "redirects to the created order_status" do
56
- post :create, {:order_status => valid_attributes}, valid_session
57
- response.should redirect_to(OrderStatus.last)
58
- end
59
- end
60
-
61
- describe "with invalid params" do
62
- it "assigns a newly created but unsaved order_status as @order_status" do
63
- # Trigger the behavior that occurs when invalid params are submitted
64
- OrderStatus.any_instance.stub(:save).and_return(false)
65
- post :create, {:order_status => { "name" => nil }}, valid_session
66
- assigns(:order_status).should be_a_new(OrderStatus)
67
- end
68
-
69
- it "re-renders the 'new' template" do
70
- # Trigger the behavior that occurs when invalid params are submitted
71
- OrderStatus.any_instance.stub(:save).and_return(false)
72
- post :create, { :order_status => { "name" => nil } }, valid_session
73
- response.should render_template("new")
74
- end
75
- end
76
- end
77
-
78
- describe "PUT update" do
79
- describe "with valid params" do
80
- it "updates the requested order_status" do
81
- order_status = OrderStatus.create! valid_attributes
82
- # Assuming there are no other order_statuses in the database, this
83
- # specifies that the OrderStatus created on the previous line
84
- # receives the :update_attributes message with whatever params are
85
- # submitted in the request.
86
- OrderStatus.any_instance.should_receive(:update).with({ "name" => "MyString" })
87
- put :update, {:id => order_status.to_param, :order_status => { "name" => "MyString" }}, valid_session
88
- end
89
-
90
- it "assigns the requested order_status as @order_status" do
91
- order_status = OrderStatus.create! valid_attributes
92
- put :update, {:id => order_status.to_param, :order_status => valid_attributes}, valid_session
93
- assigns(:order_status).should eq(order_status)
94
- end
95
-
96
- it "redirects to the order_status" do
97
- order_status = OrderStatus.create! valid_attributes
98
- put :update, {:id => order_status.to_param, :order_status => valid_attributes}, valid_session
99
- response.should redirect_to(order_status)
100
- end
101
- end
102
-
103
- describe "with invalid params" do
104
- it "assigns the order_status as @order_status" do
105
- order_status = OrderStatus.create! valid_attributes
106
- # Trigger the behavior that occurs when invalid params are submitted
107
- OrderStatus.any_instance.stub(:save).and_return(false)
108
- put :update, {:id => order_status.to_param, :order_status => { "name" => nil }}, valid_session
109
- assigns(:order_status).should eq(order_status)
110
- end
111
-
112
- it "re-renders the 'edit' template" do
113
- order_status = OrderStatus.create! valid_attributes
114
- # Trigger the behavior that occurs when invalid params are submitted
115
- OrderStatus.any_instance.stub(:save).and_return(false)
116
- put :update, {:id => order_status.to_param, :order_status => { "name" => nil }}, valid_session
117
- response.should render_template("edit")
118
- end
119
- end
120
- end
121
-
122
- describe "DELETE destroy" do
123
- it "destroys the requested order_status" do
124
- order_status = OrderStatus.create! valid_attributes
125
- expect {
126
- delete :destroy, {:id => order_status.to_param}, valid_session
127
- }.to change(OrderStatus, :count).by(-1)
128
- end
129
-
130
- it "redirects to the order_statuses list" do
131
- order_status = OrderStatus.create! valid_attributes
132
- delete :destroy, {:id => order_status.to_param}, valid_session
133
- response.should redirect_to(order_statuses_url)
134
- end
135
- end
136
-
137
- end
138
- end