dugway 0.5.3 → 0.5.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +2 -0
- data/.rspec +1 -0
- data/.travis.yml +3 -0
- data/Gemfile +1 -1
- data/LICENSE.txt +22 -0
- data/dugway.gemspec +3 -0
- data/lib/dugway/cart.rb +8 -12
- data/lib/dugway/cli/templates/Gemfile.tt +1 -1
- data/lib/dugway/cli/templates/gitignore.tt +1 -0
- data/lib/dugway/cli/templates/source/product.html +5 -3
- data/lib/dugway/cli/templates/source/stylesheets/cart.css.sass +8 -0
- data/lib/dugway/cli/templates/source/stylesheets/product.css.sass +32 -0
- data/lib/dugway/liquid/drops/cart_item_drop.rb +4 -0
- data/lib/dugway/liquid/drops/product_drop.rb +10 -6
- data/lib/dugway/liquid/drops/product_option_drop.rb +1 -1
- data/lib/dugway/liquid/drops/shipping_option_drop.rb +2 -0
- data/lib/dugway/liquid/tags/checkout_form.rb +1 -1
- data/lib/dugway/version.rb +1 -1
- data/spec/features/contact_form_spec.rb +43 -0
- data/spec/features/page_rendering_spec.rb +69 -0
- data/spec/features/shopping_spec.rb +38 -0
- data/spec/fixtures/store/products.js +1 -1
- data/spec/fixtures/store/store.js +1 -1
- data/spec/fixtures/theme/cart.html +22 -7
- data/spec/fixtures/theme/contact.html +37 -37
- data/spec/fixtures/theme/layout.html +8 -0
- data/spec/fixtures/theme/settings.json +1 -0
- data/spec/fixtures/theme/styles.css +2 -2
- data/spec/spec_helper.rb +8 -0
- data/spec/units/dugway/cart_spec.rb +204 -0
- data/spec/units/dugway/liquid/drops/account_drop_spec.rb +54 -0
- data/spec/units/dugway/liquid/drops/artist_drop_spec.rb +40 -0
- data/spec/units/dugway/liquid/drops/artists_drop_spec.rb +41 -0
- data/spec/units/dugway/liquid/drops/cart_drop_spec.rb +81 -0
- data/spec/units/dugway/liquid/drops/cart_item_drop_spec.rb +72 -0
- data/spec/units/dugway/liquid/drops/categories_drop_spec.rb +41 -0
- data/spec/units/dugway/liquid/drops/category_drop_spec.rb +40 -0
- data/spec/units/dugway/liquid/drops/contact_drop_spec.rb +124 -0
- data/spec/units/dugway/liquid/drops/country_drop_spec.rb +17 -0
- data/spec/units/dugway/liquid/drops/image_drop_spec.rb +23 -0
- data/spec/units/dugway/liquid/drops/page_drop_spec.rb +70 -0
- data/spec/units/dugway/liquid/drops/pages_drop_spec.rb +29 -0
- data/spec/units/dugway/liquid/drops/product_drop_spec.rb +269 -0
- data/spec/units/dugway/liquid/drops/product_option_drop_spec.rb +86 -0
- data/spec/units/dugway/liquid/drops/products_drop_spec.rb +127 -0
- data/spec/units/dugway/liquid/drops/shipping_option_drop_spec.rb +26 -0
- data/spec/units/dugway/liquid/drops/theme_drop_spec.rb +68 -0
- data/spec/units/dugway/store_spec.rb +27 -27
- data/spec/units/dugway/template_spec.rb +12 -0
- data/spec/units/dugway/theme_spec.rb +198 -0
- metadata +95 -57
- data/spec/units/dugway_spec.rb +0 -9
@@ -1 +1 @@
|
|
1
|
-
[{"price":10.0,"status":"active","created_at":"2013-02-10T19:28:11-07:00","tax":0.0,"position":1,"artists":[{"permalink":"artist-one","name":"Artist One","id":176141,"url":"/artist/artist-one"}],"shipping":[{"amount_with_others":5.0,"country":{"name":"United States","id":43,"code":"US"},"amount_alone":10.0},{"amount_with_others":10.0,"amount_alone":20.0}],"images":[{"width":475,"height":
|
1
|
+
[{"price":10.0,"status":"active","created_at":"2013-02-10T19:28:11-07:00","tax":0.0,"position":1,"artists":[{"permalink":"artist-one","name":"Artist One","id":176141,"url":"/artist/artist-one"}],"shipping":[{"amount_with_others":5.0,"country":{"name":"United States","id":43,"code":"US"},"amount_alone":10.0},{"amount_with_others":10.0,"amount_alone":20.0}],"images":[{"width":475,"height":500,"secure_url":"https://s3.amazonaws.com/bigcartel/product_images/92599166/mens_tee_1.jpg","url":"http://cache1.bigcartel.com/product_images/92599166/mens_tee_1.jpg"},{"width":475,"height":475,"secure_url":"https://s3.amazonaws.com/bigcartel/product_images/92599178/mens_tee_2.jpg","url":"http://cache1.bigcartel.com/product_images/92599178/mens_tee_2.jpg"},{"width":475,"height":475,"secure_url":"https://s3.amazonaws.com/bigcartel/product_images/92599196/mens_tee_3.jpg","url":"http://cache1.bigcartel.com/product_images/92599196/mens_tee_3.jpg"},{"width":475,"height":475,"secure_url":"https://s3.amazonaws.com/bigcartel/product_images/92599214/mens_tee_4.jpg","url":"http://cache0.bigcartel.com/product_images/92599214/mens_tee_4.jpg"},{"width":475,"height":475,"secure_url":"https://s3.amazonaws.com/bigcartel/product_images/92599226/mens_tee_5.jpg","url":"http://cache1.bigcartel.com/product_images/92599226/mens_tee_5.jpg"}],"categories":[{"permalink":"tees","name":"Tees","id":4615193,"url":"/category/tees"}],"on_sale":false,"permalink":"my-product","name":"My Product","default_price":10.0,"id":9422939,"description":"This is a description of my product.","options":[{"price":10.0,"sold_out":false,"has_custom_price":false,"name":"Small","id":29474321},{"price":10.0,"sold_out":false,"has_custom_price":false,"name":"Medium","id":29474324},{"price":10.0,"sold_out":true,"has_custom_price":false,"name":"Large","id":29474327},{"price":15.0,"sold_out":false,"has_custom_price":true,"name":"X-Large","id":29474330}],"url":"/product/my-product"},{"price":10.0,"status":"active","created_at":"2013-03-02T10:05:34-07:00","tax":0.0,"position":2,"artists":[{"permalink":"artist-two","name":"Artist Two","id":176144,"url":"/artist/artist-two"}],"images":[{"width":475,"height":475,"secure_url":"https://s3.amazonaws.com/bigcartel/product_images/95272745/mens_tee_8.jpg","url":"http://cache0.bigcartel.com/product_images/95272745/mens_tee_8.jpg"}],"categories":[{"permalink":"tees","name":"Tees","id":4615193,"url":"/category/tees"}],"on_sale":false,"permalink":"my-tee","name":"My Tee","default_price":10.0,"id":9696017,"description":"This is my cool tee shirt.","options":[{"price":10.0,"sold_out":false,"has_custom_price":false,"name":"Small","id":30344519},{"price":10.0,"sold_out":false,"has_custom_price":false,"name":"Medium","id":30344522},{"price":15.0,"sold_out":false,"has_custom_price":true,"name":"Large","id":30344525}],"url":"/product/my-tee"},{"price":20.0,"status":"active","created_at":"2013-03-02T10:06:22-07:00","tax":0.0,"position":3,"artists":[],"categories":[{"permalink":"prints","name":"Prints","id":4615190,"url":"/category/prints"}],"on_sale":true,"permalink":"print","name":"Print","default_price":20.0,"id":9696032,"description":"This is my print.","options":[{"price":20.0,"sold_out":false,"has_custom_price":false,"name":"Default","id":30344567}],"url":"/product/print"}]
|
@@ -1 +1 @@
|
|
1
|
-
{"website":"","artists":[{"permalink":"artist-one","name":"Artist One","id":176141,"url":"/artist/artist-one"},{"permalink":"artist-two","name":"Artist Two","id":176144,"url":"/artist/artist-two"}],"products_count":3,"currency":{"sign":"$","name":"U.S. Dollar","id":1,"code":"USD"},"country":{"name":"United States","id":43,"code":"US"},"categories":[{"permalink":"cds","name":"CDs","id":4615184,"url":"/category/cds"},{"permalink":"hats","name":"Hats","id":4615187,"url":"/category/hats"},{"permalink":"prints","name":"Prints","id":4615190,"url":"/category/prints"},{"permalink":"tees","name":"Tees","id":4615193,"url":"/category/tees"}],"name":"Dugway","pages":[{"permalink":"about-us","name":"About Us"}],"url":"http://dugway.bigcartel.com","description":""}
|
1
|
+
{"website":"https://github.com/bigcartel/dugway","artists":[{"permalink":"artist-one","name":"Artist One","id":176141,"url":"/artist/artist-one"},{"permalink":"artist-two","name":"Artist Two","id":176144,"url":"/artist/artist-two"},{"permalink":"threezer","name":"Threezer","id":176151,"url":"/artist/threezer"}],"products_count":3,"currency":{"sign":"$","name":"U.S. Dollar","id":1,"code":"USD"},"country":{"name":"United States","id":43,"code":"US"},"categories":[{"permalink":"cds","name":"CDs","id":4615184,"url":"/category/cds"},{"permalink":"hats","name":"Hats","id":4615187,"url":"/category/hats"},{"permalink":"prints","name":"Prints","id":4615190,"url":"/category/prints"},{"permalink":"tees","name":"Tees","id":4615193,"url":"/category/tees"}],"name":"Dugway","pages":[{"permalink":"about-us","name":"About Us"}],"url":"http://dugway.bigcartel.com","description":"A really cool store."}
|
@@ -6,21 +6,36 @@
|
|
6
6
|
<ul>
|
7
7
|
{% for item in cart.items %}
|
8
8
|
<li>
|
9
|
-
|
10
|
-
<
|
11
|
-
|
12
|
-
|
13
|
-
{
|
14
|
-
|
9
|
+
<a href="{{ item.product.url }}">
|
10
|
+
<img src="{{ item.product.image | product_image_url size:"thumb" }}">
|
11
|
+
</a>
|
12
|
+
<h2>
|
13
|
+
<a href="{{ item.product.url }}">
|
14
|
+
{{ item.product.name }}
|
15
|
+
{% unless item.product.has_default_option %}
|
16
|
+
<em>{{ item.option.name }}</em>
|
17
|
+
{% endunless %}
|
18
|
+
</a>
|
19
|
+
</h2>
|
20
|
+
<p>
|
21
|
+
{{ item | item_quantity_input }}
|
22
|
+
{{ item.price | money_with_sign }}
|
23
|
+
<a href="#" class="remove">×</a>
|
24
|
+
</p>
|
25
|
+
</li>
|
15
26
|
{% endfor %}
|
16
27
|
|
17
28
|
<li>
|
18
29
|
<label>Total:</label>
|
19
30
|
<span>{{ cart.total | money_with_sign }}</span>
|
20
31
|
</li>
|
32
|
+
|
33
|
+
<li>
|
34
|
+
<button type="submit">Update</button>
|
35
|
+
</li>
|
21
36
|
|
22
37
|
<li>
|
23
|
-
<button type="submit"name="checkout"
|
38
|
+
<button type="submit" name="checkout">Checkout</button>
|
24
39
|
</li>
|
25
40
|
</ul>
|
26
41
|
</form>
|
@@ -1,37 +1,37 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
1
|
+
{% if contact.sent %}
|
2
|
+
|
3
|
+
<p>Your message has been sent and we’ll get back to you soon.</p>
|
4
|
+
|
5
|
+
{% else %}
|
6
|
+
|
7
|
+
<form method="post" action="/contact">
|
8
|
+
<ul>
|
9
|
+
<li>
|
10
|
+
<label for="name">Name</label>
|
11
|
+
{{ contact | contact_input: 'name' }}
|
12
|
+
</li>
|
13
|
+
<li>
|
14
|
+
<label for="email">Email</label>
|
15
|
+
{{ contact | contact_input: 'email' }}
|
16
|
+
</li>
|
17
|
+
<li>
|
18
|
+
<label for="subject">Subject</label>
|
19
|
+
{{ contact | contact_input: 'subject' }}
|
20
|
+
</li>
|
21
|
+
<li>
|
22
|
+
<label for="message">Message</label>
|
23
|
+
{{ contact | contact_input: 'message' }}
|
24
|
+
</li>
|
25
|
+
<li>
|
26
|
+
<label for="captcha">Spam check</label>
|
27
|
+
<p>Please enter the characters from the image.</p>
|
28
|
+
<div>{{ contact.captcha }}</div>
|
29
|
+
{{ contact | contact_input: 'captcha' }}
|
30
|
+
</li>
|
31
|
+
<li>
|
32
|
+
<button type="submit" name="submit" title="Send us an email">Send</button>
|
33
|
+
</li>
|
34
|
+
</ul>
|
35
|
+
</form>
|
36
|
+
|
37
|
+
{% endif %}
|
data/spec/spec_helper.rb
CHANGED
@@ -1,4 +1,9 @@
|
|
1
|
+
require 'simplecov'
|
2
|
+
SimpleCov.start
|
3
|
+
|
1
4
|
require 'webmock/rspec'
|
5
|
+
require 'json_expressions/rspec'
|
6
|
+
require 'capybara/rspec'
|
2
7
|
require 'dugway'
|
3
8
|
|
4
9
|
RSpec.configure do |config|
|
@@ -20,5 +25,8 @@ RSpec.configure do |config|
|
|
20
25
|
Dugway.stub(:theme) {
|
21
26
|
Dugway::Theme.new
|
22
27
|
}
|
28
|
+
|
29
|
+
# Setup Capybara
|
30
|
+
Capybara.app = Dugway.application
|
23
31
|
end
|
24
32
|
end
|
@@ -0,0 +1,204 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Dugway::Cart do
|
4
|
+
let(:cart) { Dugway::Cart.new }
|
5
|
+
let(:store) { Dugway::Store.new('dugway') }
|
6
|
+
|
7
|
+
let(:product) { store.products.first }
|
8
|
+
let(:product_option) { product['options'].first }
|
9
|
+
|
10
|
+
let(:product_2) { store.products.last }
|
11
|
+
let(:product_option_2) { product_2['options'].first }
|
12
|
+
|
13
|
+
describe "#new" do
|
14
|
+
it "should have a blank items array" do
|
15
|
+
cart.items.should be_an_instance_of(Array)
|
16
|
+
cart.items.should be_empty
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
describe "#reset" do
|
21
|
+
before(:each) do
|
22
|
+
cart.update(add: { id: product_option['id'] })
|
23
|
+
end
|
24
|
+
|
25
|
+
it "should empty the items array" do
|
26
|
+
expect { cart.reset }.to change { cart.items.size }.from(1).to(0)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
describe "#item_count" do
|
31
|
+
it "should return the number of items in the cart times their quantity" do
|
32
|
+
cart.item_count.should == 0
|
33
|
+
cart.update(add: { id: product_option['id'] })
|
34
|
+
cart.item_count.should == 1
|
35
|
+
cart.update(add: { id: product_option_2['id'], quantity: 2 })
|
36
|
+
cart.item_count.should == 3
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
describe "#empty?" do
|
41
|
+
it "should return true or false if there are items in the cart" do
|
42
|
+
cart.should be_empty
|
43
|
+
cart.update(add: { id: product_option['id'] })
|
44
|
+
cart.should_not be_empty
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
describe "#subtotal" do
|
49
|
+
it "should return the total of all item prices times their quantity" do
|
50
|
+
cart.subtotal.should == 0.0
|
51
|
+
|
52
|
+
cart.update(add: { id: product_option['id'], quantity: 1 })
|
53
|
+
cart.subtotal.should == product_option['price']
|
54
|
+
|
55
|
+
cart.update(add: { id: product_option_2['id'], quantity: 2 })
|
56
|
+
cart.subtotal.should == product_option['price'] + (product_option_2['price'] * 2)
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
describe "#total" do
|
61
|
+
it "should return the total of all item prices times their quantity" do
|
62
|
+
cart.total.should == 0.0
|
63
|
+
|
64
|
+
cart.update(add: { id: product_option['id'], quantity: 1 })
|
65
|
+
cart.total.should == product_option['price']
|
66
|
+
|
67
|
+
cart.update(add: { id: product_option_2['id'], quantity: 2 })
|
68
|
+
cart.total.should == product_option['price'] + (product_option_2['price'] * 2)
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
describe "#country" do
|
73
|
+
it "should return nil to disable it" do
|
74
|
+
cart.country.should be_nil
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
describe "#shipping" do
|
79
|
+
it "should return a hash that disables it" do
|
80
|
+
cart.shipping.should == {
|
81
|
+
'enabled' => false,
|
82
|
+
'amount' => 0.0,
|
83
|
+
'strict' => false,
|
84
|
+
'pending' => false
|
85
|
+
}
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
describe "#tax" do
|
90
|
+
it "should return a hash that disables it" do
|
91
|
+
cart.tax.should == {
|
92
|
+
'enabled' => false,
|
93
|
+
'amount' => 0.0
|
94
|
+
}
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
describe "#discount" do
|
99
|
+
it "should return a hash that disables it" do
|
100
|
+
cart.discount.should == {
|
101
|
+
'enabled' => false,
|
102
|
+
'pending' => false,
|
103
|
+
'amount' => 0.0
|
104
|
+
}
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
describe "#update" do
|
109
|
+
describe "when adding individual items" do
|
110
|
+
it "should add an item" do
|
111
|
+
cart.items.should be_empty
|
112
|
+
cart.update(add: { id: product_option['id'], quantity: 2 })
|
113
|
+
cart.items.should_not be_empty
|
114
|
+
|
115
|
+
item = cart.items.first
|
116
|
+
item.product['id'].should == product['id']
|
117
|
+
item.option['id'].should == product_option['id']
|
118
|
+
item.quantity.should == 2
|
119
|
+
end
|
120
|
+
|
121
|
+
it "should default to quantity 1" do
|
122
|
+
cart.items.should be_empty
|
123
|
+
cart.update(add: { id: product_option['id'] })
|
124
|
+
cart.items.should_not be_empty
|
125
|
+
|
126
|
+
item = cart.items.first
|
127
|
+
item.product['id'].should == product['id']
|
128
|
+
item.option['id'].should == product_option['id']
|
129
|
+
item.quantity.should == 1
|
130
|
+
end
|
131
|
+
|
132
|
+
it "should update the existing item when re-adding the same thing" do
|
133
|
+
cart.items.should be_empty
|
134
|
+
cart.update(add: { id: product_option['id'] })
|
135
|
+
cart.items.should_not be_empty
|
136
|
+
|
137
|
+
item = cart.items.first
|
138
|
+
item.product['id'].should == product['id']
|
139
|
+
item.option['id'].should == product_option['id']
|
140
|
+
item.quantity.should == 1
|
141
|
+
|
142
|
+
cart.update(add: { id: product_option['id'], quantity: 2 })
|
143
|
+
|
144
|
+
item = cart.items.first
|
145
|
+
item.product['id'].should == product['id']
|
146
|
+
item.option['id'].should == product_option['id']
|
147
|
+
item.quantity.should == 3
|
148
|
+
end
|
149
|
+
end
|
150
|
+
|
151
|
+
describe "when adding multiple items at once" do
|
152
|
+
it "should add multiple items" do
|
153
|
+
cart.items.should be_empty
|
154
|
+
cart.update(adds: [{ id: product_option['id'] }, { id: product_option_2['id'], quantity: 2 }])
|
155
|
+
cart.item_count.should == 3
|
156
|
+
|
157
|
+
item = cart.items.first
|
158
|
+
item.product['id'].should == product['id']
|
159
|
+
item.option['id'].should == product_option['id']
|
160
|
+
item.quantity.should == 1
|
161
|
+
|
162
|
+
item = cart.items.last
|
163
|
+
item.product['id'].should == product_2['id']
|
164
|
+
item.option['id'].should == product_option_2['id']
|
165
|
+
item.quantity.should == 2
|
166
|
+
end
|
167
|
+
end
|
168
|
+
|
169
|
+
describe "when updating items already in the cart" do
|
170
|
+
before(:each) do
|
171
|
+
cart.update(adds: [{ id: product_option['id'] }, { id: product_option_2['id'], quantity: 2 }])
|
172
|
+
end
|
173
|
+
|
174
|
+
it "should update the quanitities" do
|
175
|
+
cart.item_count.should == 3
|
176
|
+
|
177
|
+
item_1 = cart.items.first
|
178
|
+
item_2 = cart.items.last
|
179
|
+
|
180
|
+
cart.update(:update => { item_1.id => 3, item_2.id => 1 })
|
181
|
+
cart.item_count.should == 4
|
182
|
+
end
|
183
|
+
end
|
184
|
+
end
|
185
|
+
|
186
|
+
describe "#as_json" do
|
187
|
+
before(:each) do
|
188
|
+
cart.update(adds: [{ id: product_option['id'] }, { id: product_option_2['id'], quantity: 2 }])
|
189
|
+
end
|
190
|
+
|
191
|
+
it "should output the cart as JSON" do
|
192
|
+
cart.as_json.should match_json_expression({
|
193
|
+
:item_count => cart.item_count,
|
194
|
+
:subtotal => cart.subtotal,
|
195
|
+
:price => cart.subtotal,
|
196
|
+
:total => cart.total,
|
197
|
+
:items => cart.items,
|
198
|
+
:country => cart.country,
|
199
|
+
:shipping => cart.shipping,
|
200
|
+
:discount => cart.discount
|
201
|
+
})
|
202
|
+
end
|
203
|
+
end
|
204
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Dugway::Drops::AccountDrop do
|
4
|
+
let(:account) { Dugway::Drops::AccountDrop.new(Dugway.store.account) }
|
5
|
+
|
6
|
+
describe "#name" do
|
7
|
+
it "should return the store's name" do
|
8
|
+
account.name.should == 'Dugway'
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
describe "#description" do
|
13
|
+
it "should return the store's description" do
|
14
|
+
account.description.should == 'A really cool store.'
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
describe "#url" do
|
19
|
+
it "should return the store's url" do
|
20
|
+
account.url.should == 'http://dugway.bigcartel.com'
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
describe "#website" do
|
25
|
+
it "should return the store's website" do
|
26
|
+
account.website.should == 'https://github.com/bigcartel/dugway'
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
describe "#currency" do
|
31
|
+
it "should return the store's currency" do
|
32
|
+
currency = account.currency
|
33
|
+
currency.should be_an_instance_of(Dugway::Drops::CurrencyDrop)
|
34
|
+
currency.name.should == 'U.S. Dollar'
|
35
|
+
currency.code.should == 'USD'
|
36
|
+
currency.sign.should == '$'
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
describe "#country" do
|
41
|
+
it "should return the store's country" do
|
42
|
+
country = account.country
|
43
|
+
country.should be_an_instance_of(Dugway::Drops::CountryDrop)
|
44
|
+
country.name.should == 'United States'
|
45
|
+
country.code.should == 'US'
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
describe "#logged_in" do
|
50
|
+
it "should return false" do
|
51
|
+
account.logged_in.should be(false)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Dugway::Drops::ArtistDrop do
|
4
|
+
let(:artist) { Dugway::Drops::ArtistDrop.new(Dugway.store.artists.first) }
|
5
|
+
|
6
|
+
describe "#id" do
|
7
|
+
it "should return the artist's id" do
|
8
|
+
artist.id.should == 176141
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
describe "#name" do
|
13
|
+
it "should return the artist's name" do
|
14
|
+
artist.name.should == 'Artist One'
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
describe "#permalink" do
|
19
|
+
it "should return the artist's permalink" do
|
20
|
+
artist.permalink.should == 'artist-one'
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
describe "#url" do
|
25
|
+
it "should return the artist's url" do
|
26
|
+
artist.url.should == '/artist/artist-one'
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
describe "#products" do
|
31
|
+
it "should return the artist's products" do
|
32
|
+
products = artist.products
|
33
|
+
products.should be_an_instance_of(Array)
|
34
|
+
|
35
|
+
product = products.first
|
36
|
+
product.should be_an_instance_of(Dugway::Drops::ProductDrop)
|
37
|
+
product.name.should == 'My Product'
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|