spree_suppliers 0.1.0 → 0.60.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README +46 -0
- data/Rakefile +137 -0
- data/app/controllers/admin/pickup_locations_controller.rb +52 -0
- data/app/controllers/admin/pickups_controller.rb +84 -0
- data/app/controllers/admin/shipping_options_controller.rb +32 -0
- data/app/controllers/admin/supplier_taxons_controller.rb +65 -0
- data/app/controllers/admin/suppliers_controller.rb +203 -0
- data/app/controllers/admin/vendor_overview_controller.rb +18 -0
- data/app/controllers/dash/base_controller.rb +10 -0
- data/app/controllers/dash/overview_controller.rb +6 -0
- data/app/controllers/dash/pickup_locations_controller.rb +27 -0
- data/app/controllers/dash/pickups_controller.rb +40 -0
- data/app/controllers/dash/products_controller.rb +15 -0
- data/app/controllers/messages_controller.rb +17 -0
- data/app/controllers/suppliers_controller.rb +19 -0
- data/app/controllers/user_sessions_decorator.rb +39 -0
- data/app/helpers/admin/suppliers_helper.rb +21 -0
- data/app/helpers/cities_helper.rb +2 -0
- data/app/helpers/dragonfly_helper.rb +16 -0
- data/app/helpers/messages_helper.rb +2 -0
- data/app/helpers/suppliers_helper.rb +16 -0
- data/app/mailers/supplier_mailer.rb +11 -0
- data/app/models/ability_decorator.rb +19 -0
- data/app/models/delivery.rb +6 -0
- data/app/models/hour.rb +4 -0
- data/app/models/item.rb +5 -0
- data/app/models/message.rb +3 -0
- data/app/models/pickup.rb +10 -0
- data/app/models/pickup_date.rb +3 -0
- data/app/models/pickup_location.rb +7 -0
- data/app/models/supplier.rb +33 -0
- data/app/models/supplier_invoice.rb +5 -0
- data/app/views/admin/orders/index.html.erb +107 -0
- data/app/views/admin/orders/show.html.erb +35 -0
- data/app/views/admin/orders/user.html.erb +19 -0
- data/app/views/admin/pickup_locations/_pickup_location.html.erb +10 -0
- data/app/views/admin/pickup_locations/edit.html.erb +44 -0
- data/app/views/admin/pickup_locations/new.html.erb +48 -0
- data/app/views/admin/pickup_locations/show.html.erb +1 -0
- data/app/views/admin/pickups/_pickup.erb +0 -0
- data/app/views/admin/pickups/index.html.erb +44 -0
- data/app/views/admin/pickups/new.html.erb +33 -0
- data/app/views/admin/pickups/show.html.erb +42 -0
- data/app/views/admin/products/_suppliers_form.html.erb +5 -0
- data/app/views/admin/shared/_order_tabs_decide.html.erb +5 -0
- data/app/views/admin/shared/_vendor_order_tabs.html.erb +39 -0
- data/app/views/admin/shipping_options/edit.html.erb +38 -0
- data/app/views/admin/supplier_taxons/_form.html.erb +23 -0
- data/app/views/admin/supplier_taxons/_taxon_table.html.erb +23 -0
- data/app/views/admin/supplier_taxons/available.js.erb +33 -0
- data/app/views/admin/supplier_taxons/edit.html.erb +11 -0
- data/app/views/admin/supplier_taxons/remove.html.erb +1 -0
- data/app/views/admin/supplier_taxons/select.js.erb +2 -0
- data/app/views/admin/supplier_taxons/selected.html.erb +51 -0
- data/app/views/admin/suppliers/_edit_form.html.erb +75 -0
- data/app/views/admin/suppliers/_edit_hours_form.html.erb +18 -0
- data/app/views/admin/suppliers/_form.html.erb +72 -0
- data/app/views/admin/suppliers/_hours_form.html.erb +11 -0
- data/app/views/admin/suppliers/_image_form.html.erb +40 -0
- data/app/views/admin/suppliers/_supplier.html.erb +37 -0
- data/app/views/admin/suppliers/_supplier_tabs.html.erb +18 -0
- data/app/views/admin/suppliers/_suppliers_table.html.erb +25 -0
- data/app/views/admin/suppliers/_upload_image.html.erb +14 -0
- data/app/views/admin/suppliers/available.js.erb +34 -0
- data/app/views/admin/suppliers/edit.html.erb +20 -0
- data/app/views/admin/suppliers/index.html.erb +102 -0
- data/app/views/admin/suppliers/line_items.html.erb +20 -0
- data/app/views/admin/suppliers/new.html.erb +22 -0
- data/app/views/admin/suppliers/remove.html.erb +1 -0
- data/app/views/admin/suppliers/select.html.erb +1 -0
- data/app/views/admin/suppliers/selected.html.erb +40 -0
- data/app/views/admin/suppliers/show.html.erb +2 -0
- data/app/views/admin/users/_form.html.erb +40 -0
- data/app/views/admin/vendor_overview/index.html.erb +1 -0
- data/app/views/checkout/_delivery.html.erb +5 -0
- data/app/views/dash/overview/index.html.erb +58 -0
- data/app/views/dash/pickup_locations/_pickup_location.html.erb +3 -0
- data/app/views/dash/pickup_locations/new.html.erb +47 -0
- data/app/views/dash/pickups/_pickup.erb +3 -0
- data/app/views/dash/pickups/new.html.erb +24 -0
- data/app/views/dash/products/new.html.erb +38 -0
- data/app/views/layouts/admin.html.erb +81 -0
- data/app/views/messages/_message_form.html.erb +17 -0
- data/app/views/messages/create.html.erb +2 -0
- data/app/views/messages/destroy.html.erb +2 -0
- data/app/views/messages/new.html.erb +2 -0
- data/app/views/shared/_deliveries.html.erb +113 -0
- data/app/views/shared/_hours.html.erb +21 -0
- data/app/views/shared/_products_vendor.html.erb +49 -0
- data/app/views/shared/_supplier_invoices.html.erb +67 -0
- data/app/views/supplier_mailer/invoice_email.html.erb +72 -0
- data/app/views/suppliers/_supplier.html.erb +7 -0
- data/app/views/suppliers/_supplier_list.erb +20 -0
- data/app/views/suppliers/index.html.erb +17 -0
- data/app/views/suppliers/show.html.erb +106 -0
- data/app/views/suppliers/supplier_list.erb +14 -0
- data/config/initializers/dragonfly.rb +8 -0
- data/config/initializers/supplier_invoice_mailer.rb +10 -0
- data/config/locales/en-US.yml +13 -0
- data/config/routes.rb +48 -0
- data/db/migrate/20091209201716_supplier_setup.rb +36 -0
- data/db/migrate/20110922213437_create_messages.rb +18 -0
- data/db/migrate/20110928203155_create_hours.rb +21 -0
- data/db/migrate/20111006185052_create_pickups.rb +17 -0
- data/db/migrate/20111010191125_add_location_to_addresses.rb +9 -0
- data/db/migrate/20111010214313_create_pickup_dates.rb +14 -0
- data/db/migrate/20111011180211_add_supplier_id_to_user.rb +9 -0
- data/db/migrate/20111012211422_create_pickup_locations.rb +21 -0
- data/db/migrate/20111013155257_create_supplier_invoices.rb +16 -0
- data/db/migrate/20111013161225_create_items.rb +18 -0
- data/db/migrate/20111018133543_add_attributes_to_products.rb +17 -0
- data/db/migrate/20111028190454_add_attributes_to_assets.rb +11 -0
- data/db/migrate/20111029230805_create_suppliers_taxons.rb +16 -0
- data/db/migrate/20111101165933_create_deliveries.rb +17 -0
- data/db/migrate/20111108213108_create_shipping_methods_suppliers.rb +16 -0
- data/db/seeds.rb +14 -0
- data/lib/spree_suppliers.rb +411 -0
- data/lib/spree_suppliers_hooks.rb +40 -0
- data/lib/tasks/spree_suppliers.rake +27 -0
- data/public/javascripts/jquery-ui.js +312 -0
- data/public/javascripts/jquery-ui.multidatespicker.js +398 -0
- data/public/javascripts/jquery.ui.datepicker.js +1791 -0
- data/public/stylesheets/suppliers.css +676 -0
- data/spec/controllers/cities_controller_spec.rb +157 -0
- data/spec/controllers/shipping_options_controller_spec.rb +12 -0
- data/spec/helpers/cities_helper_spec.rb +15 -0
- data/spec/models/city_spec.rb +5 -0
- data/spec/models/comment_spec.rb +64 -0
- data/spec/models/item_spec.rb +5 -0
- data/spec/models/message_spec.rb +5 -0
- data/spec/models/pickup_date_spec.rb +5 -0
- data/spec/models/pickup_location_spec.rb +5 -0
- data/spec/models/pickup_spec.rb +5 -0
- data/spec/models/rating_spec.rb +24 -0
- data/spec/models/supplier_invoice_spec.rb +5 -0
- data/spec/models/supplier_spec.rb +11 -0
- data/spec/requests/cities_spec.rb +11 -0
- data/spec/routing/cities_routing_spec.rb +35 -0
- data/spec/spec.opts +6 -0
- data/spec/spec_helper.rb +37 -0
- data/spec/views/cities/edit.html.erb_spec.rb +22 -0
- data/spec/views/cities/index.html.erb_spec.rb +28 -0
- data/spec/views/cities/new.html.erb_spec.rb +22 -0
- data/spec/views/cities/show.html.erb_spec.rb +21 -0
- data/spec/views/shipping_options/edit.html.erb_spec.rb +5 -0
- data/spree_suppliers.gemspec +24 -0
- metadata +181 -14
@@ -0,0 +1,157 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
# This spec was generated by rspec-rails when you ran the scaffold generator.
|
4
|
+
# It demonstrates how one might use RSpec to specify the controller code that
|
5
|
+
# was generated by Rails when you ran the scaffold generator.
|
6
|
+
#
|
7
|
+
# It assumes that the implementation code is generated by the rails scaffold
|
8
|
+
# generator. If you are using any extension libraries to generate different
|
9
|
+
# controller code, this generated spec may or may not pass.
|
10
|
+
#
|
11
|
+
# It only uses APIs available in rails and/or rspec-rails. There are a number
|
12
|
+
# of tools you can use to make these specs even more expressive, but we're
|
13
|
+
# sticking to rails and rspec-rails APIs to keep things simple and stable.
|
14
|
+
#
|
15
|
+
# Compared to earlier versions of this generator, there is very limited use of
|
16
|
+
# stubs and message expectations in this spec. Stubs are only used when there
|
17
|
+
# is no simpler way to get a handle on the object needed for the example.
|
18
|
+
# Message expectations are only used when there is no simpler way to specify
|
19
|
+
# that an instance is receiving a specific message.
|
20
|
+
|
21
|
+
describe CitiesController do
|
22
|
+
|
23
|
+
# This should return the minimal set of attributes required to create a valid
|
24
|
+
# City. As you add validations to City, be sure to
|
25
|
+
# update the return value of this method accordingly.
|
26
|
+
def valid_attributes
|
27
|
+
{}
|
28
|
+
end
|
29
|
+
|
30
|
+
describe "GET index" do
|
31
|
+
it "assigns all cities as @cities" do
|
32
|
+
city = City.create! valid_attributes
|
33
|
+
get :index
|
34
|
+
assigns(:cities).should eq([city])
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
describe "GET show" do
|
39
|
+
it "assigns the requested city as @city" do
|
40
|
+
city = City.create! valid_attributes
|
41
|
+
get :show, :id => city.id.to_s
|
42
|
+
assigns(:city).should eq(city)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
describe "GET new" do
|
47
|
+
it "assigns a new city as @city" do
|
48
|
+
get :new
|
49
|
+
assigns(:city).should be_a_new(City)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
describe "GET edit" do
|
54
|
+
it "assigns the requested city as @city" do
|
55
|
+
city = City.create! valid_attributes
|
56
|
+
get :edit, :id => city.id.to_s
|
57
|
+
assigns(:city).should eq(city)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
describe "POST create" do
|
62
|
+
describe "with valid params" do
|
63
|
+
it "creates a new City" do
|
64
|
+
expect {
|
65
|
+
post :create, :city => valid_attributes
|
66
|
+
}.to change(City, :count).by(1)
|
67
|
+
end
|
68
|
+
|
69
|
+
it "assigns a newly created city as @city" do
|
70
|
+
post :create, :city => valid_attributes
|
71
|
+
assigns(:city).should be_a(City)
|
72
|
+
assigns(:city).should be_persisted
|
73
|
+
end
|
74
|
+
|
75
|
+
it "redirects to the created city" do
|
76
|
+
post :create, :city => valid_attributes
|
77
|
+
response.should redirect_to(City.last)
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
describe "with invalid params" do
|
82
|
+
it "assigns a newly created but unsaved city as @city" do
|
83
|
+
# Trigger the behavior that occurs when invalid params are submitted
|
84
|
+
City.any_instance.stub(:save).and_return(false)
|
85
|
+
post :create, :city => {}
|
86
|
+
assigns(:city).should be_a_new(City)
|
87
|
+
end
|
88
|
+
|
89
|
+
it "re-renders the 'new' template" do
|
90
|
+
# Trigger the behavior that occurs when invalid params are submitted
|
91
|
+
City.any_instance.stub(:save).and_return(false)
|
92
|
+
post :create, :city => {}
|
93
|
+
response.should render_template("new")
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
describe "PUT update" do
|
99
|
+
describe "with valid params" do
|
100
|
+
it "updates the requested city" do
|
101
|
+
city = City.create! valid_attributes
|
102
|
+
# Assuming there are no other cities in the database, this
|
103
|
+
# specifies that the City created on the previous line
|
104
|
+
# receives the :update_attributes message with whatever params are
|
105
|
+
# submitted in the request.
|
106
|
+
City.any_instance.should_receive(:update_attributes).with({'these' => 'params'})
|
107
|
+
put :update, :id => city.id, :city => {'these' => 'params'}
|
108
|
+
end
|
109
|
+
|
110
|
+
it "assigns the requested city as @city" do
|
111
|
+
city = City.create! valid_attributes
|
112
|
+
put :update, :id => city.id, :city => valid_attributes
|
113
|
+
assigns(:city).should eq(city)
|
114
|
+
end
|
115
|
+
|
116
|
+
it "redirects to the city" do
|
117
|
+
city = City.create! valid_attributes
|
118
|
+
put :update, :id => city.id, :city => valid_attributes
|
119
|
+
response.should redirect_to(city)
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
describe "with invalid params" do
|
124
|
+
it "assigns the city as @city" do
|
125
|
+
city = City.create! valid_attributes
|
126
|
+
# Trigger the behavior that occurs when invalid params are submitted
|
127
|
+
City.any_instance.stub(:save).and_return(false)
|
128
|
+
put :update, :id => city.id.to_s, :city => {}
|
129
|
+
assigns(:city).should eq(city)
|
130
|
+
end
|
131
|
+
|
132
|
+
it "re-renders the 'edit' template" do
|
133
|
+
city = City.create! valid_attributes
|
134
|
+
# Trigger the behavior that occurs when invalid params are submitted
|
135
|
+
City.any_instance.stub(:save).and_return(false)
|
136
|
+
put :update, :id => city.id.to_s, :city => {}
|
137
|
+
response.should render_template("edit")
|
138
|
+
end
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
142
|
+
describe "DELETE destroy" do
|
143
|
+
it "destroys the requested city" do
|
144
|
+
city = City.create! valid_attributes
|
145
|
+
expect {
|
146
|
+
delete :destroy, :id => city.id.to_s
|
147
|
+
}.to change(City, :count).by(-1)
|
148
|
+
end
|
149
|
+
|
150
|
+
it "redirects to the cities list" do
|
151
|
+
city = City.create! valid_attributes
|
152
|
+
delete :destroy, :id => city.id.to_s
|
153
|
+
response.should redirect_to(cities_url)
|
154
|
+
end
|
155
|
+
end
|
156
|
+
|
157
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
# Specs in this file have access to a helper object that includes
|
4
|
+
# the CitiesHelper. For example:
|
5
|
+
#
|
6
|
+
# describe CitiesHelper do
|
7
|
+
# describe "string concat" do
|
8
|
+
# it "concats two strings with spaces" do
|
9
|
+
# helper.concat_strings("this","that").should == "this that"
|
10
|
+
# end
|
11
|
+
# end
|
12
|
+
# end
|
13
|
+
describe CitiesHelper do
|
14
|
+
pending "add some examples to (or delete) #{__FILE__}"
|
15
|
+
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe "Comment" do
|
4
|
+
before(:each) do
|
5
|
+
@article = Factory(:article)
|
6
|
+
@user = User.find_by_id(@article.user_id)
|
7
|
+
@attr = {
|
8
|
+
:text => "Cheaper than the competition",
|
9
|
+
:title => "Review",
|
10
|
+
:user_id => @article.user_id,
|
11
|
+
}
|
12
|
+
end
|
13
|
+
|
14
|
+
it "should create a comment with valid attributes" do
|
15
|
+
success = Comment.new(@attr)
|
16
|
+
success.should be_valid
|
17
|
+
end
|
18
|
+
|
19
|
+
it "should not create a comment if text is empty" do
|
20
|
+
emptytext = Comment.new(@attr.merge(:text => ""))
|
21
|
+
emptytext.should_not be_valid
|
22
|
+
end
|
23
|
+
|
24
|
+
it "should not create a comment if title is empty" do
|
25
|
+
emptytitle = Comment.new(@attr.merge(:title => ""))
|
26
|
+
emptytitle.should_not be_valid
|
27
|
+
end
|
28
|
+
|
29
|
+
it "should require a user id" do
|
30
|
+
noid = Comment.new(@attr.merge(:user_id => ""))
|
31
|
+
noid.should_not be_valid
|
32
|
+
end
|
33
|
+
|
34
|
+
describe "User association" do
|
35
|
+
before(:each) do
|
36
|
+
@attr.merge(:user_id => "")
|
37
|
+
@comment = @user.comments.create(@attr)
|
38
|
+
end
|
39
|
+
|
40
|
+
it "should have a user attribute" do
|
41
|
+
@comment.should respond_to(:user)
|
42
|
+
end
|
43
|
+
|
44
|
+
it "should have the right associated user" do
|
45
|
+
@comment.user_id.should == @user.id
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
describe "Article association" do
|
50
|
+
before(:each) do
|
51
|
+
@attr.merge(:article_id => "")
|
52
|
+
@comment = @article.comments.create(@attr)
|
53
|
+
end
|
54
|
+
|
55
|
+
it "should have an article attribute" do
|
56
|
+
@comment.should respond_to(:article)
|
57
|
+
end
|
58
|
+
|
59
|
+
it "should have the right associated article" do
|
60
|
+
@comment.article_id.should == @article.id
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe "Rating" do
|
4
|
+
before(:each) do
|
5
|
+
@rating = Rating.new()
|
6
|
+
user = Factory(:user)
|
7
|
+
product = Factory(:product)
|
8
|
+
@attr = {
|
9
|
+
:value => 3,
|
10
|
+
:user_id => user.id,
|
11
|
+
:product_id => product.id
|
12
|
+
}
|
13
|
+
end
|
14
|
+
|
15
|
+
it "should create a rating with valid attributes" do
|
16
|
+
success = Rating.new(@attr)
|
17
|
+
success.should be_valid
|
18
|
+
end
|
19
|
+
|
20
|
+
it "should not create a rating when value is empty" do
|
21
|
+
novalue = Rating.new(@attr.merge(:value => ""))
|
22
|
+
novalue.should_not be_valid
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe "Cities" do
|
4
|
+
describe "GET /cities" do
|
5
|
+
it "works! (now write some real specs)" do
|
6
|
+
# Run the generator again with the --webrat flag if you want to use webrat methods/matchers
|
7
|
+
get cities_path
|
8
|
+
response.status.should be(200)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe CitiesController do
|
4
|
+
describe "routing" do
|
5
|
+
|
6
|
+
it "routes to #index" do
|
7
|
+
get("/cities").should route_to("cities#index")
|
8
|
+
end
|
9
|
+
|
10
|
+
it "routes to #new" do
|
11
|
+
get("/cities/new").should route_to("cities#new")
|
12
|
+
end
|
13
|
+
|
14
|
+
it "routes to #show" do
|
15
|
+
get("/cities/1").should route_to("cities#show", :id => "1")
|
16
|
+
end
|
17
|
+
|
18
|
+
it "routes to #edit" do
|
19
|
+
get("/cities/1/edit").should route_to("cities#edit", :id => "1")
|
20
|
+
end
|
21
|
+
|
22
|
+
it "routes to #create" do
|
23
|
+
post("/cities").should route_to("cities#create")
|
24
|
+
end
|
25
|
+
|
26
|
+
it "routes to #update" do
|
27
|
+
put("/cities/1").should route_to("cities#update", :id => "1")
|
28
|
+
end
|
29
|
+
|
30
|
+
it "routes to #destroy" do
|
31
|
+
delete("/cities/1").should route_to("cities#destroy", :id => "1")
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
end
|
data/spec/spec.opts
ADDED
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
unless defined? SPREE_ROOT
|
2
|
+
ENV["RAILS_ENV"] = "test"
|
3
|
+
case
|
4
|
+
when ENV["SPREE_ENV_FILE"]
|
5
|
+
require ENV["SPREE_ENV_FILE"]
|
6
|
+
when File.dirname(__FILE__) =~ %r{vendor/SPREE/vendor/extensions}
|
7
|
+
require "#{File.expand_path(File.dirname(__FILE__) + "/../../../../../../")}/config/environment"
|
8
|
+
else
|
9
|
+
require "#{File.expand_path(File.dirname(__FILE__) + "/../../../../")}/config/environment"
|
10
|
+
end
|
11
|
+
end
|
12
|
+
require "#{SPREE_ROOT}/spec/spec_helper"
|
13
|
+
|
14
|
+
if File.directory?(File.dirname(__FILE__) + "/scenarios")
|
15
|
+
Scenario.load_paths.unshift File.dirname(__FILE__) + "/scenarios"
|
16
|
+
end
|
17
|
+
if File.directory?(File.dirname(__FILE__) + "/matchers")
|
18
|
+
Dir[File.dirname(__FILE__) + "/matchers/*.rb"].each {|file| require file }
|
19
|
+
end
|
20
|
+
|
21
|
+
Spec::Runner.configure do |config|
|
22
|
+
# config.use_transactional_fixtures = true
|
23
|
+
# config.use_instantiated_fixtures = false
|
24
|
+
# config.fixture_path = RAILS_ROOT + '/spec/fixtures'
|
25
|
+
|
26
|
+
# You can declare fixtures for each behaviour like this:
|
27
|
+
# describe "...." do
|
28
|
+
# fixtures :table_a, :table_b
|
29
|
+
#
|
30
|
+
# Alternatively, if you prefer to declare them only once, you can
|
31
|
+
# do so here, like so ...
|
32
|
+
#
|
33
|
+
# config.global_fixtures = :table_a, :table_b
|
34
|
+
#
|
35
|
+
# If you declare global fixtures, be aware that they will be declared
|
36
|
+
# for all of your examples, even those that don't use them.
|
37
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe "cities/edit.html.erb" do
|
4
|
+
before(:each) do
|
5
|
+
@city = assign(:city, stub_model(City,
|
6
|
+
:name => "MyString",
|
7
|
+
:state_id => 1,
|
8
|
+
:active => false
|
9
|
+
))
|
10
|
+
end
|
11
|
+
|
12
|
+
it "renders the edit city form" do
|
13
|
+
render
|
14
|
+
|
15
|
+
# Run the generator again with the --webrat flag if you want to use webrat matchers
|
16
|
+
assert_select "form", :action => cities_path(@city), :method => "post" do
|
17
|
+
assert_select "input#city_name", :name => "city[name]"
|
18
|
+
assert_select "input#city_state_id", :name => "city[state_id]"
|
19
|
+
assert_select "input#city_active", :name => "city[active]"
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe "cities/index.html.erb" do
|
4
|
+
before(:each) do
|
5
|
+
assign(:cities, [
|
6
|
+
stub_model(City,
|
7
|
+
:name => "Name",
|
8
|
+
:state_id => 1,
|
9
|
+
:active => false
|
10
|
+
),
|
11
|
+
stub_model(City,
|
12
|
+
:name => "Name",
|
13
|
+
:state_id => 1,
|
14
|
+
:active => false
|
15
|
+
)
|
16
|
+
])
|
17
|
+
end
|
18
|
+
|
19
|
+
it "renders a list of cities" do
|
20
|
+
render
|
21
|
+
# Run the generator again with the --webrat flag if you want to use webrat matchers
|
22
|
+
assert_select "tr>td", :text => "Name".to_s, :count => 2
|
23
|
+
# Run the generator again with the --webrat flag if you want to use webrat matchers
|
24
|
+
assert_select "tr>td", :text => 1.to_s, :count => 2
|
25
|
+
# Run the generator again with the --webrat flag if you want to use webrat matchers
|
26
|
+
assert_select "tr>td", :text => false.to_s, :count => 2
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe "cities/new.html.erb" do
|
4
|
+
before(:each) do
|
5
|
+
assign(:city, stub_model(City,
|
6
|
+
:name => "MyString",
|
7
|
+
:state_id => 1,
|
8
|
+
:active => false
|
9
|
+
).as_new_record)
|
10
|
+
end
|
11
|
+
|
12
|
+
it "renders new city form" do
|
13
|
+
render
|
14
|
+
|
15
|
+
# Run the generator again with the --webrat flag if you want to use webrat matchers
|
16
|
+
assert_select "form", :action => cities_path, :method => "post" do
|
17
|
+
assert_select "input#city_name", :name => "city[name]"
|
18
|
+
assert_select "input#city_state_id", :name => "city[state_id]"
|
19
|
+
assert_select "input#city_active", :name => "city[active]"
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe "cities/show.html.erb" do
|
4
|
+
before(:each) do
|
5
|
+
@city = assign(:city, stub_model(City,
|
6
|
+
:name => "Name",
|
7
|
+
:state_id => 1,
|
8
|
+
:active => false
|
9
|
+
))
|
10
|
+
end
|
11
|
+
|
12
|
+
it "renders attributes in <p>" do
|
13
|
+
render
|
14
|
+
# Run the generator again with the --webrat flag if you want to use webrat matchers
|
15
|
+
rendered.should match(/Name/)
|
16
|
+
# Run the generator again with the --webrat flag if you want to use webrat matchers
|
17
|
+
rendered.should match(/1/)
|
18
|
+
# Run the generator again with the --webrat flag if you want to use webrat matchers
|
19
|
+
rendered.should match(/false/)
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
Gem::Specification.new do |s|
|
2
|
+
s.platform = Gem::Platform::RUBY
|
3
|
+
s.name = 'spree_suppliers'
|
4
|
+
s.version = '0.60.3'
|
5
|
+
s.summary = 'Add suppliers to products.'
|
6
|
+
s.description = 'This gem adds multiple supplier/vendor support to spree by allowing mutliple vendors to be created and managed in the admin panel, so that each vendor can have a mini-store listing only their products. The default spree feel and operation of a combined products index showing all available products in the store is left intact, so customers can buy items from different vendors with a single checkout process. This extension can be used to simply add multiple supplier support to show off your vendors, or it can be used as a 3rd party gateway to link customers directly to suppliers.'
|
7
|
+
s.required_ruby_version = '>= 1.9.2'
|
8
|
+
|
9
|
+
s.author = 'JD Warren and Han Dao (Isotope11.com)'
|
10
|
+
s.email = 'jd@isotope11.com'
|
11
|
+
s.homepage = 'http://www.isotope11.com'
|
12
|
+
s.rubyforge_project = 'spreecommerce'
|
13
|
+
|
14
|
+
s.files = `git ls-files`.split("\n")
|
15
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
16
|
+
s.require_path = 'lib'
|
17
|
+
s.requirements << 'none'
|
18
|
+
|
19
|
+
s.add_dependency('spree_core', '>= 0.60.3')
|
20
|
+
s.add_dependency('gmaps4rails', '>= 1.3.2')
|
21
|
+
s.add_dependency('dragonfly', '>= 0.9.4')
|
22
|
+
s.add_dependency('rack-cache')
|
23
|
+
|
24
|
+
end
|