nimbleshop_simply 0.0.5 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (27) hide show
  1. data/app/assets/javascripts/nimbleshop_simply/enable_fancybox.js.coffee +5 -0
  2. data/app/assets/javascripts/nimbleshop_simply/load_states.js.coffee +3 -3
  3. data/app/assets/javascripts/nimbleshop_simply/remove_item_from_cart.js.coffee +7 -6
  4. data/app/assets/javascripts/nimbleshop_simply/shipping_address_same_as_billing_address.js.coffee +14 -8
  5. data/app/assets/javascripts/nimbleshop_simply/{application.js → simply.js} +2 -1
  6. data/app/assets/javascripts/nimbleshop_simply/thumbnail.js.coffee +6 -12
  7. data/app/assets/stylesheets/nimbleshop_simply/override_bootstrap.css +17 -2
  8. data/app/assets/stylesheets/nimbleshop_simply/themed_bootstrap_and_overrides.css.less +5 -4
  9. data/app/mailers/nimbleshop_simply/mailer.rb +34 -0
  10. data/app/views/layouts/nimbleshop_simply/mailer.text.erb +1 -0
  11. data/app/views/layouts/simply.html.erb +1 -1
  12. data/app/views/nimbleshop_simply/mailer/order_notification_to_buyer.text.erb +31 -0
  13. data/app/views/nimbleshop_simply/mailer/shipment_notification_to_buyer.text.erb +34 -0
  14. data/config/routes.rb +0 -1
  15. data/lib/nimbleshop_simply/engine.rb +1 -0
  16. data/test/integration/checkout/cart_acceptance_test.rb +113 -0
  17. data/test/integration/checkout/payment_confirmation_acceptance_test.rb +24 -0
  18. data/test/integration/checkout/paypal_acceptance_test.rb +34 -0
  19. data/test/integration/checkout/shipping_address_acceptance_test.rb +91 -0
  20. data/test/integration/checkout/shipping_method_acceptance_test.rb +51 -0
  21. data/test/integration/homepage_acceptance_test.rb +22 -0
  22. data/test/integration/products_acceptance_test.rb +12 -0
  23. data/test/integration/static_pages_acceptance_test.rb +13 -0
  24. data/test/mailers/mailer_test.rb +25 -0
  25. data/test/test_helper.rb +59 -0
  26. metadata +36 -22
  27. data/app/views/layouts/email.html.erb +0 -3
@@ -0,0 +1,5 @@
1
+ $ ->
2
+ $(".fancybox").fancybox
3
+ openEffect: "none"
4
+ closeEffect: "none"
5
+ cyclic: true
@@ -10,13 +10,13 @@ class window.App.toggleStates
10
10
  @stateNameField(country).val('').parents('.control-group').show()
11
11
  @stateCodeField(country).val('').parents('.control-group').hide()
12
12
 
13
- hasRegions: ($element) ->
13
+ hasRegions: ($element) ->
14
14
  window.countryStateCodes[$element.val()].length > 0
15
15
 
16
- stateNameField: ($element) ->
16
+ stateNameField: ($element) ->
17
17
  $element.parents("div.well").find("[name$='[state_name]']")
18
18
 
19
- stateCodeField: ($element) ->
19
+ stateCodeField: ($element) ->
20
20
  $element.parents("div.well").find("[name$='[state_code]']")
21
21
 
22
22
  createOption: (state) ->
@@ -1,6 +1,7 @@
1
- $("a.remove-item").live "click", ->
2
- $this = $(this)
3
- permalink = $this.data("permalink")
4
- $("#updates_" + permalink).val 0
5
- $("#cartform").submit()
6
- false
1
+ $ ->
2
+ $("a.remove-item").on "click", ->
3
+ $this = $(this)
4
+ permalink = $this.data("permalink")
5
+ $("#updates_" + permalink).val 0
6
+ $("#cartform").submit()
7
+ false
@@ -1,11 +1,17 @@
1
- window.App = window.App || {}
1
+ window.NimbleshopSimply = {} if typeof(NimbleshopSimply) == 'undefined'
2
+
3
+ NimbleshopSimply.toggleBillingAddress = class ToggleBillingAddress
4
+ constructor: ->
5
+ @handleToggleCheckBox()
6
+ $("#order_shipping_address_attributes_use_for_billing").on 'click', =>
7
+ this.handleToggleCheckBox()
8
+
9
+ handleToggleCheckBox: ->
10
+ if $("#order_shipping_address_attributes_use_for_billing").is(':checked')
11
+ $('#billing_well').hide()
12
+ else
13
+ $('#billing_well').show()
2
14
 
3
- App.toggleBillingAddress = ->
4
- if $("#order_shipping_address_attributes_use_for_billing").is(':checked')
5
- $('#billing_well').hide()
6
- else
7
- $('#billing_well').show()
8
15
 
9
16
  $ ->
10
- $("#order_shipping_address_attributes_use_for_billing").bind 'click', App.toggleBillingAddress
11
- App.toggleBillingAddress()
17
+ new NimbleshopSimply.toggleBillingAddress
@@ -5,7 +5,7 @@
5
5
  //= require accounting
6
6
 
7
7
  /* bootstrap must be after jquery-ujs */
8
- //= require twitter/bootstrap
8
+ //= require twitter/bootstrap
9
9
 
10
10
  // loaded using fancybox-rails gem
11
11
  //= require fancybox
@@ -19,3 +19,4 @@
19
19
  //= require nimbleshop_simply/remove_item_from_cart
20
20
  //= require nimbleshop_simply/load_states
21
21
  //= require nimbleshop_simply/order
22
+ //= require nimbleshop_simply/enable_fancybox
@@ -1,14 +1,8 @@
1
- # This JavaScript file adds the feature by which
2
- # mouse enter on thumbnail displays the image
3
-
4
- $("img.thumb").live "mouseenter", ->
5
- $this = $(this)
6
- item_index = $(".thumb").index($this) + 1
7
- $(".thumbnails li:nth-child(" + item_index + ")").show().siblings().hide()
8
- false
1
+ # mouse enter on thumbnail displays the image on the product show page
9
2
 
10
3
  $ ->
11
- $(".fancybox").fancybox
12
- openEffect: "none"
13
- closeEffect: "none"
14
- cyclic: true
4
+ $("img.thumb").on "mouseenter", ->
5
+ $this = $(this)
6
+ itemIndex = $(".thumb").index($this) + 1
7
+ $(".thumbnails li:nth-child(" + itemIndex + ")").show().siblings().hide()
8
+ false
@@ -1,11 +1,26 @@
1
1
  .navbar-inner {
2
- background-color: #373d48;
2
+ background-color: #fff;
3
+ background-color: #fafafa;
4
+ background-color: #f2f2f2;
3
5
  box-shadow: none;
4
6
  -moz-box-shadow: none;
5
7
  -webkit-box-shadow: none;
6
- border-bottom: 1px solid #D8DDE1;
8
+ background-image:none;
9
+ min-height: 45px;
7
10
  }
8
11
 
9
12
  .navbar .nav > li > a:hover {
13
+ text-shadow: none;
14
+ text-decoration: underline;
15
+ color: #000;
16
+ }
17
+
18
+ .navbar .nav > li > a {
19
+ text-shadow: none;
20
+ }
21
+
22
+ #site-name {
23
+ height: 25px;
24
+ background: #00adef;
10
25
  color: #fff;
11
26
  }
@@ -1,5 +1,5 @@
1
1
  @import "twitter/bootstrap/bootstrap";
2
- body {
2
+ body {
3
3
  padding-top: 60px;
4
4
  padding-left: 20px;
5
5
  }
@@ -11,7 +11,7 @@ body {
11
11
  @iconWhiteSpritePath: asset-path('twitter/bootstrap/glyphicons-halflings-white.png');
12
12
 
13
13
  // Set the Font Awesome (Font Awesome is default. You can disable by commenting below lines)
14
- // Note: If you use asset_path() here, your compiled boostrap_and_overrides.css will not
14
+ // Note: If you use asset_path() here, your compiled boostrap_and_overrides.css will not
15
15
  // have the proper paths. So for now we use the absolute path.
16
16
  @fontAwesomeEotPath: '/assets/fontawesome-webfont.eot';
17
17
  @fontAwesomeWoffPath: '/assets/fontawesome-webfont.woff';
@@ -31,6 +31,7 @@ body {
31
31
  //
32
32
  // Example:
33
33
  // @linkColor: #ff0000;
34
- @navbarBackground: #369bd7;
34
+ @navbarBackground: #fff;
35
35
  @navbarBackgroundHighlight: #2f7dac;
36
- @navbarLinkColor: #fff;
36
+ @navbarLinkColor: #000;
37
+
@@ -0,0 +1,34 @@
1
+ module NimbleshopSimply
2
+ class Mailer < ActionMailer::Base
3
+
4
+ helper :application
5
+
6
+ layout 'nimbleshop_simply/mailer'
7
+
8
+ default from: lambda { Shop.current.from_email }
9
+ default_url_options[:host] = Nimbleshop.config.bare_url_with_port
10
+ default_url_options[:protocol] = 'http'
11
+
12
+ def order_notification_to_buyer(order_number)
13
+ subject = "Order confirmation for order ##{order_number}"
14
+ @order = Order.find_by_number!(order_number)
15
+
16
+ @shop = Shop.current
17
+ @payment_date = @order.created_at.to_s(:long) || @order.purchased_at.to_s(:long)
18
+
19
+ mail_options = {to: @order.email, subject: subject}
20
+ mail(mail_options)
21
+
22
+ end
23
+
24
+ def shipment_notification_to_buyer(order_number)
25
+ subject = "Items for order ##{order_number} have been shipped"
26
+ @order = Order.find_by_number!(order_number)
27
+ @shipment = @order.shipments.first
28
+
29
+ mail_options = {to: @order.email, subject: subject}
30
+ mail(mail_options)
31
+ end
32
+
33
+ end
34
+ end
@@ -0,0 +1 @@
1
+ <%= yield %>
@@ -33,7 +33,7 @@
33
33
  <link rel="apple-touch-icon" sizes="114x114" href="/images/apple-touch-icon-114x114.png">
34
34
  -->
35
35
  <%= csrf_meta_tag %>
36
- <%= javascript_include_tag 'nimbleshop_simply/application' %>
36
+ <%= javascript_include_tag 'nimbleshop_simply/simply' %>
37
37
  <%= yield :js %>
38
38
  </head>
39
39
 
@@ -0,0 +1,31 @@
1
+ Here is receipt for your purchase at <%= @shop.name %> . When items are shipped you will get an email with tracking number.
2
+
3
+ Payment date: <%= @payment_date %>
4
+
5
+ Shipping address:
6
+ <% @order.shipping_address.full_address_array.each do |line| %>
7
+ <%= line %>
8
+ <% end %>
9
+
10
+ <% unless @order.shipping_address.use_for_billing %>
11
+ Billing address :
12
+ <% @order.billing_address.full_address_array.each do |line| %>
13
+ <%= line %>
14
+ <% end %>
15
+ <% end %>
16
+
17
+ Items purchased:
18
+
19
+ <% @order.line_items.each do |line_item| %>
20
+ Name: <%= truncate(sanitize(line_item.product_name), length: 90) %>
21
+ Item price: <%= number_to_currency(line_item.product_price) %>
22
+ Item quantity: <%= line_item.quantity %>
23
+ Item total price: <%= number_to_currency(line_item.price) %>
24
+ <%# the below empty line is intentional %>
25
+
26
+ <% end %>
27
+
28
+ Shipping method: <%= @order.shipping_method.name %>
29
+ Shipping cost: <%= number_to_currency(@order.shipping_method.shipping_cost) %>
30
+
31
+ Total amount: <%= number_to_currency(@order.total_amount) %>
@@ -0,0 +1,34 @@
1
+ Hi <%= @order.final_billing_address.name%> ,
2
+
3
+ All items regarding order #<%= @order.number %> have been shipped.
4
+
5
+ <% if @shipment.tracking_number.present? %>
6
+ Items have been shipped using <%= @order.shipments.first.shipment_carrier.name %> and the tracking number is <%= @order.shipments.first.tracking_number %>. Use the URL given below to track your shipment.
7
+
8
+ <%= @shipment.tracking_url %>
9
+
10
+ Sometimes it takes upto 12 hours for a tracking number to show up in the system.
11
+
12
+ <% else %>
13
+ Items have been shipped using <%= @shipment.shipment_carrier.name %> .
14
+ <% end %>
15
+
16
+
17
+ Items are being shipped to the following address:
18
+
19
+ <% @order.shipping_address.full_address_array.each do |line| %>
20
+ <%= line %>
21
+ <% end %>
22
+
23
+ Here are the contents of the shipment.
24
+
25
+ <% @order.line_items.each do |line_item| %>
26
+ Name: <%= truncate(sanitize(line_item.name), length: 90) %>
27
+ Item price: <%= number_to_currency(line_item.product_price) %>
28
+ Item quantity: <%= line_item.quantity %>
29
+ Item total price: <%= number_to_currency(line_item.price) %>
30
+ <% end %>
31
+
32
+ <% if @order.payment_method.permalink == 'authorize-net' %>
33
+ Your credit card has been charged <%= number_to_currency(@order.total_amount) %> .This charge will appear on your credit card statement as "<%= @order.payment_method.business_name %>".
34
+ <% end %>
data/config/routes.rb CHANGED
@@ -1,6 +1,5 @@
1
1
  NimbleshopSimply::Engine.routes.draw do
2
2
 
3
- get "/reset", to: "carts#reset"
4
3
  get "/pages/about-us", to: "pages#about_us", as: :about_us
5
4
  get "/pages/contact-us", to: "pages#contact_us", as: :contact_us
6
5
 
@@ -5,6 +5,7 @@ module NimbleshopSimply
5
5
 
6
6
  initializer 'nimbleshop_simply.precompile_assets' do |config|
7
7
  Rails.application.config.assets.precompile += %w( nimbleshop_simply/simply.css )
8
+ Rails.application.config.assets.precompile += %w( nimbleshop_simply/simply.js )
8
9
  end
9
10
 
10
11
  end
@@ -0,0 +1,113 @@
1
+ require "test_helper"
2
+
3
+ class CartAcceptanceTest < ActionDispatch::IntegrationTest
4
+
5
+ include ::ShippingMethodTestHelper
6
+ include ::CheckoutTestHelper
7
+
8
+ setup do
9
+ create(:product, name: 'Bracelet Set', price: 25)
10
+ create(:product, name: 'Necklace Set', price: 14)
11
+ create_regional_shipping_method
12
+ end
13
+
14
+ test "after going all the way to checkout if buyer comes back to cart only line items amount should be shown" do
15
+ visit root_path
16
+ add_item_to_cart('Bracelet Set')
17
+ assert_equal "Total: $25.00", find('.line-items-total').text.chomp.strip
18
+
19
+ click_link 'Checkout'
20
+
21
+ enter_valid_email_address
22
+ enter_valid_shipping_address
23
+
24
+ click_button 'Submit'
25
+
26
+ choose 'Ground'
27
+ click_button 'Submit'
28
+
29
+ assert_sanitized_equal 'Total: $29.30', find('.order-total-amount').text
30
+ click_link 'edit_cart'
31
+
32
+ assert_sanitized_equal "Total: $25.00", find('.line-items-total').text
33
+ end
34
+
35
+ test "should be able to change the quantity even if product is deleted" do
36
+ visit root_path
37
+ add_item_to_cart('Bracelet Set')
38
+
39
+ p = Product.find_by_name('Bracelet Set')
40
+ fill_in "updates_#{p.id}", with: '10'
41
+ p.destroy
42
+ click_button 'Update'
43
+ assert_sanitized_equal "Total: $250.00", find('.line-items-total').text
44
+ end
45
+
46
+ test "should be able to increase the quantities of items in the cart" do
47
+ visit root_path
48
+ add_item_to_cart('Bracelet Set')
49
+ visit root_path
50
+ add_item_to_cart 'Necklace Set'
51
+ p1 = Product.find_by_name 'Bracelet Set'
52
+ p2 = Product.find_by_name 'Necklace Set'
53
+
54
+ fill_in "updates_#{p1.id}", with: '4'
55
+ fill_in "updates_#{p2.id}", with: '2'
56
+
57
+ click_button 'Update'
58
+ assert page.has_content?('$128')
59
+ end
60
+
61
+ test "when admin has not setup any payment method then there should not be any error" do
62
+ PaymentMethod.delete_all
63
+ visit root_path
64
+ add_item_to_cart('Bracelet Set')
65
+ click_link 'Checkout'
66
+ enter_valid_email_address
67
+ enter_valid_shipping_address
68
+ click_button 'Submit'
69
+ choose 'Ground'
70
+ click_button 'Submit'
71
+ assert page.has_content?('No payment method has been setup. Please setup atleast one payment method.')
72
+ end
73
+
74
+ test "should be able to add 2 items to cart and title should be reflect that" do
75
+ visit root_path
76
+ add_item_to_cart('Bracelet Set')
77
+ visit root_path
78
+ add_item_to_cart 'Necklace Set'
79
+ assert page.has_content?('2 Items')
80
+ assert page.has_content?('$39')
81
+ end
82
+ end
83
+
84
+ class CartWithOrderExpiredAcceptanceTest < ActionDispatch::IntegrationTest
85
+
86
+ include ::ShippingMethodTestHelper
87
+ include ::CheckoutTestHelper
88
+
89
+ setup do
90
+ create(:product, name: 'Bracelet Set', price: 25)
91
+ create(:product, name: 'Necklace Set', price: 14)
92
+ create(:country_shipping_method)
93
+ end
94
+
95
+ test 'on cart page' do
96
+ visit root_path
97
+ add_item_to_cart('Bracelet Set')
98
+ click_link 'Checkout'
99
+ Order.last.destroy
100
+ click_link 'edit_cart'
101
+ assert page.has_content?('powered by')
102
+ end
103
+
104
+ test 'on shipping address page' do
105
+ visit root_path
106
+ add_item_to_cart('Bracelet Set')
107
+ assert page.has_css?('.line-items-total', text: '$25.00')
108
+ click_link 'Checkout'
109
+ Order.last.destroy
110
+ visit current_path
111
+ assert page.has_content?('powered by')
112
+ end
113
+ end
@@ -0,0 +1,24 @@
1
+ require 'test_helper'
2
+
3
+ class PaymentConfirmationAcceptanceTest < ActionDispatch::IntegrationTest
4
+
5
+ test "show order when it was paid using splitable" do
6
+ order = create :order_paid_using_splitable
7
+ visit nimbleshop_simply.order_path(order)
8
+ assert page.has_content?('Purchase is complete')
9
+ end
10
+
11
+ test "show order when it was paid using paypalwp" do
12
+ order = create :order_paid_using_paypalwp
13
+ visit nimbleshop_simply.order_path(order)
14
+ assert page.has_content?('Purchase is complete')
15
+ end
16
+
17
+ test "show order when it was paid using authorizedotnet" do
18
+ order = create :order_paid_using_authorizedotnet
19
+ visit nimbleshop_simply.order_path(order)
20
+ assert page.has_content?('Purchase is complete')
21
+ assert page.has_content?('In the credit card statement name of the company would appear as Nimbleshop LLC')
22
+ end
23
+
24
+ end
@@ -0,0 +1,34 @@
1
+ require "test_helper"
2
+
3
+ class PaypalAcceptanceTest < ActionDispatch::IntegrationTest
4
+
5
+ include ::ShippingMethodTestHelper
6
+ include ::CheckoutTestHelper
7
+
8
+ setup do
9
+ create(:product, name: 'Bracelet Set', price: 25)
10
+ create(:product, name: 'Necklace Set', price: 14)
11
+ create_regional_shipping_method
12
+ end
13
+
14
+ test 'paypal variables' do
15
+ visit root_path
16
+ add_item_to_cart('Bracelet Set')
17
+ assert_sanitized_equal "Total: $25.00", find('.line-items-total').text
18
+
19
+ click_link 'Checkout'
20
+
21
+ enter_valid_email_address
22
+ enter_valid_shipping_address
23
+
24
+ click_button 'Submit'
25
+
26
+ choose 'Ground'
27
+ click_button 'Submit'
28
+
29
+ assert_sanitized_equal 'Total: $29.30', find('.order-total-amount').text
30
+ assert_sanitized_equal "25.0", page.find("#amount_1").value
31
+ assert_sanitized_equal "3.99", page.find("#handling_cart").value
32
+ assert_sanitized_equal "0.31", page.find("#tax_cart").value
33
+ end
34
+ end
@@ -0,0 +1,91 @@
1
+ require "test_helper"
2
+
3
+ class ShippingAddressAcceptanceTest < ActionDispatch::IntegrationTest
4
+
5
+ include ::ShippingMethodTestHelper
6
+ include ::CheckoutTestHelper
7
+
8
+ setup do
9
+ create(:product, name: 'Bracelet Set', price: 25)
10
+ create(:product, name: 'Necklace Set', price: 14)
11
+ create_regional_shipping_method
12
+ end
13
+
14
+ test "Billing address is same as shipping address" do
15
+ visit root_path
16
+ add_item_to_cart('Bracelet Set')
17
+ click_link 'Checkout'
18
+ assert page.has_content?('Shipping address')
19
+ enter_valid_email_address
20
+ enter_valid_shipping_address
21
+ click_button 'Submit'
22
+
23
+ assert_sanitized_equal "Neeaj Singh 100 N Miami Ave Suite 500 Miami Florida 33333 United States", find('.shipping-address').text
24
+ assert_sanitized_equal "Same as shipping address", find('.billing-address').text
25
+ end
26
+
27
+ test "Billing address is not same as shipping address" do
28
+ visit root_path
29
+ add_item_to_cart('Bracelet Set')
30
+ click_link 'Checkout'
31
+ enter_valid_email_address
32
+ enter_valid_shipping_address
33
+ uncheck 'order_shipping_address_attributes_use_for_billing'
34
+ enter_valid_billing_address
35
+
36
+ click_button 'Submit'
37
+
38
+ assert_sanitized_equal "Neeaj Singh 100 N Miami Ave Suite 500 Miami Florida 33333 United States", find('.shipping-address').text
39
+ assert_sanitized_equal "Neil Singh 100 N Pines Ave Suite 400 Pembroke Pines Florida 33332 United States", find('.billing-address').text
40
+ end
41
+
42
+ test 'editing shipping address' do
43
+ visit root_path
44
+ add_item_to_cart('Bracelet Set')
45
+ click_link 'Checkout'
46
+ enter_valid_email_address
47
+ enter_valid_shipping_address
48
+ click_button 'Submit'
49
+ choose 'Ground'
50
+ click_button 'Submit'
51
+ click_link 'edit_shipping_address'
52
+ fill_in "order_shipping_address_attributes_first_name", with: 'Neeraj1234'
53
+ click_button 'Submit'
54
+ assert page.has_content?('Neeraj1234')
55
+ end
56
+
57
+ test 'shipping_address validations' do
58
+ visit root_path
59
+ add_item_to_cart('Bracelet Set')
60
+ click_link 'Checkout'
61
+
62
+ click_button 'Submit'
63
+ assert page.has_content?('Email is invalid')
64
+
65
+ enter_valid_email_address
66
+ click_button 'Submit'
67
+
68
+ assert page.has_content?('Shipping address error !')
69
+ assert page.has_content?("First name can't be blank")
70
+ assert page.has_content?("Last name can't be blank")
71
+ assert page.has_content?("Address1 can't be blank")
72
+ assert page.has_content?("Zipcode can't be blank")
73
+ assert page.has_content?("City can't be blank")
74
+
75
+ enter_valid_shipping_address
76
+ uncheck 'order_shipping_address_attributes_use_for_billing'
77
+ click_button 'Submit'
78
+
79
+ assert page.has_content?('Billing address error !')
80
+ assert page.has_content?("First name can't be blank")
81
+ assert page.has_content?("Last name can't be blank")
82
+ assert page.has_content?("Address1 can't be blank")
83
+ assert page.has_content?("Zipcode can't be blank")
84
+ assert page.has_content?("City can't be blank")
85
+
86
+ check 'order_shipping_address_attributes_use_for_billing'
87
+ click_button 'Submit'
88
+ assert page.has_content?("Pick shipping method")
89
+ end
90
+ end
91
+
@@ -0,0 +1,51 @@
1
+ require "test_helper"
2
+
3
+ class ShippingMethodAcceptanceTest < ActionDispatch::IntegrationTest
4
+
5
+ include ::CheckoutTestHelper
6
+
7
+ setup do
8
+ Capybara.current_driver = :selenium
9
+ create(:product, name: 'Bracelet Set', price: 25)
10
+ create(:product, name: 'Necklace Set', price: 14)
11
+ create(:country_shipping_method, name: 'Ground Shipping', base_price: 3.99, minimum_order_amount: 1, maximum_order_amount: 99999)
12
+ create(:country_shipping_method, name: 'Express Shipping', base_price: 13.99, minimum_order_amount: 1, maximum_order_amount: 99999)
13
+ end
14
+
15
+ test "shipping method is required" do
16
+ visit root_path
17
+ add_item_to_cart('Bracelet Set')
18
+ click_link 'Checkout'
19
+
20
+ enter_valid_email_address
21
+ enter_valid_shipping_address
22
+ click_button 'Submit'
23
+
24
+ # Submit without choosing a shipping method
25
+ click_button 'Submit'
26
+
27
+ assert page.has_content?('Please select a shipping method')
28
+ end
29
+
30
+ test "ability to change shipping method" do
31
+ visit root_path
32
+ add_item_to_cart('Bracelet Set')
33
+ click_link 'Checkout'
34
+
35
+ enter_valid_email_address
36
+ enter_valid_shipping_address
37
+ click_button 'Submit'
38
+
39
+ choose 'Ground Shipping'
40
+ click_button 'Submit'
41
+
42
+ assert_sanitized_equal 'Ground Shipping ( $3.99 )', find('.shipping-method').text
43
+ click_link 'edit_shipping_method'
44
+
45
+ choose 'Express Shipping'
46
+ click_button 'Submit'
47
+
48
+ assert_sanitized_equal 'Express Shipping ( $13.99 )', find('.shipping-method').text
49
+ end
50
+
51
+ end
@@ -0,0 +1,22 @@
1
+ require 'test_helper'
2
+
3
+ class HomepageAcceptanceTest < ActionDispatch::IntegrationTest
4
+
5
+ test 'home page with link groups' do
6
+ assert_equal 1, Shop.count
7
+ visit root_path
8
+
9
+ assert page.has_content?('powered by')
10
+ assert page.has_content?('Shop by category')
11
+ end
12
+
13
+ test 'home page without link groups' do
14
+ assert_equal 1, Shop.count
15
+ LinkGroup.delete_all
16
+
17
+ visit root_path
18
+
19
+ assert page.has_content?('powered by')
20
+ refute page.has_content?('Shop by category')
21
+ end
22
+ end
@@ -0,0 +1,12 @@
1
+ require 'test_helper'
2
+
3
+ class ProductAcceptanceTest < ActionDispatch::IntegrationTest
4
+ setup do
5
+ @product = create(:product, name: 'ipad', description: 'awesome ipad from Apple')
6
+ end
7
+
8
+ test "show page" do
9
+ visit nimbleshop_simply.product_path(@product)
10
+ assert page.has_content?('awesome ipad from Apple')
11
+ end
12
+ end
@@ -0,0 +1,13 @@
1
+ require 'test_helper'
2
+
3
+ class StaticPagesAcceptanceTest < ActionDispatch::IntegrationTest
4
+ test "static pages" do
5
+ visit root_path
6
+
7
+ click_link 'About us'
8
+ assert page.has_content?('is a free and open source e-commerce framework based on Ruby on Rails')
9
+
10
+ click_link 'Contact us'
11
+ assert page.has_content?('hello.nimbleshop@gmail.com')
12
+ end
13
+ end
@@ -0,0 +1,25 @@
1
+ require "test_helper"
2
+
3
+ class MailerTest < ActiveSupport::TestCase
4
+
5
+ test "sends out order notification" do
6
+ order = create(:order_with_line_items)
7
+
8
+ mail = NimbleshopSimply::Mailer.order_notification_to_buyer(order.number)
9
+
10
+ assert_equal "Order confirmation for order ##{order.number}", mail.subject
11
+ assert_equal ['john@nimbleshop.com'], mail.to
12
+ assert_match /Here is receipt for your purchase/, mail.encoded
13
+ end
14
+
15
+ test "sends out shipment notification" do
16
+ order = create(:order_paid_using_authorizedotnet)
17
+
18
+ mail = NimbleshopSimply::Mailer.shipment_notification_to_buyer(order.number)
19
+
20
+ assert_equal "Items for order ##{order.number} have been shipped", mail.subject
21
+ assert_equal ['john@nimbleshop.com'], mail.to
22
+ assert_match /Items have been shipped/, mail.encoded
23
+ end
24
+
25
+ end
@@ -0,0 +1,59 @@
1
+ require 'bundler'
2
+ Bundler.setup(:test)
3
+
4
+ ENV["RAILS_ENV"] = "test"
5
+ require File.expand_path("../../../../nimbleshop_core/test/myshop/config/environment.rb", __FILE__)
6
+ require 'rails/test_help'
7
+ require 'capybara/rails'
8
+
9
+ # DatabaseCleaner recommends to use :transaction strategy since it is faster. However using that strategy
10
+ # causes a lot of errors like this SQLite3::BusyException: database is locked: commit transaction
11
+ # Hence :truncation strategy is used .
12
+ require 'factory_girl'
13
+ Dir["#{File.dirname(__FILE__)}/../../../nimbleshop_core/test/factories/**"].each { |f| require File.expand_path(f) }
14
+
15
+ require 'active_record/fixtures'
16
+
17
+ DatabaseCleaner.strategy = :truncation
18
+ Capybara.default_wait_time = 5
19
+
20
+ VCR.configure do | c |
21
+ c.ignore_hosts '127.0.0.1', 'localhost'
22
+ c.cassette_library_dir = 'test/vcr_cassettes'
23
+ c.hook_into :webmock # or :fakeweb
24
+ end
25
+
26
+ class ActiveSupport::TestCase
27
+ include FactoryGirl::Syntax::Methods
28
+ self.use_transactional_fixtures = false
29
+ setup do
30
+ DatabaseCleaner.start
31
+ ActiveRecord::Fixtures.create_fixtures("#{File.dirname(__FILE__)}/../../../nimbleshop_core/test/fixtures", ['shops', 'link_groups', 'payment_methods'])
32
+ end
33
+ teardown do
34
+ DatabaseCleaner.clean
35
+ end
36
+
37
+ def playcasette(casette)
38
+ VCR.use_cassette(casette) { yield }
39
+ end
40
+ end
41
+
42
+ class ActionDispatch::IntegrationTest
43
+ include Capybara::DSL
44
+ self.use_transactional_fixtures = false
45
+ setup do
46
+ DatabaseCleaner.start
47
+ ActiveRecord::Fixtures.create_fixtures("#{File.dirname(__FILE__)}/../../nimbleshop_core/test/fixtures", ['shops', 'link_groups', 'payment_methods'])
48
+ end
49
+
50
+ teardown do
51
+ DatabaseCleaner.clean
52
+ Capybara.reset_sessions!
53
+ Capybara.use_default_driver
54
+ end
55
+ end
56
+
57
+ Dir["#{File.dirname(__FILE__)}/../../../nimbleshop_core/test/support/**"].each do |f|
58
+ require File.expand_path(f) unless File.directory? f
59
+ end
metadata CHANGED
@@ -1,16 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nimbleshop_simply
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
8
8
  - Neeraj Singh
9
- - Megpha
9
+ - megpha
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-07-13 00:00:00.000000000 Z
13
+ date: 2012-08-10 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: jquery-rails
@@ -44,22 +44,6 @@ dependencies:
44
44
  - - '='
45
45
  - !ruby/object:Gem::Version
46
46
  version: 0.1.4
47
- - !ruby/object:Gem::Dependency
48
- name: nimbleshop_core
49
- requirement: !ruby/object:Gem::Requirement
50
- none: false
51
- requirements:
52
- - - '='
53
- - !ruby/object:Gem::Version
54
- version: 0.0.5
55
- type: :runtime
56
- prerelease: false
57
- version_requirements: !ruby/object:Gem::Requirement
58
- none: false
59
- requirements:
60
- - - '='
61
- - !ruby/object:Gem::Version
62
- version: 0.0.5
63
47
  description: Provides simply theme to nimbleShop
64
48
  email:
65
49
  - neeraj@bigbinary.com
@@ -74,11 +58,12 @@ files:
74
58
  - app/assets/images/nimbleshop_simply/lock.png
75
59
  - app/assets/images/nimbleshop_simply/mail.png
76
60
  - app/assets/images/nimbleshop_simply/twitter.png
77
- - app/assets/javascripts/nimbleshop_simply/application.js
61
+ - app/assets/javascripts/nimbleshop_simply/enable_fancybox.js.coffee
78
62
  - app/assets/javascripts/nimbleshop_simply/load_states.js.coffee
79
63
  - app/assets/javascripts/nimbleshop_simply/order.js.coffee
80
64
  - app/assets/javascripts/nimbleshop_simply/remove_item_from_cart.js.coffee
81
65
  - app/assets/javascripts/nimbleshop_simply/shipping_address_same_as_billing_address.js.coffee
66
+ - app/assets/javascripts/nimbleshop_simply/simply.js
82
67
  - app/assets/javascripts/nimbleshop_simply/thumbnail.js.coffee
83
68
  - app/assets/stylesheets/nimbleshop_simply/cart.css.scss
84
69
  - app/assets/stylesheets/nimbleshop_simply/cart_button.css.scss
@@ -96,11 +81,12 @@ files:
96
81
  - app/controllers/nimbleshop_simply/products_controller.rb
97
82
  - app/controllers/nimbleshop_simply/simply_controller.rb
98
83
  - app/helpers/nimbleshop_simply/simply_helper.rb
84
+ - app/mailers/nimbleshop_simply/mailer.rb
99
85
  - app/views/layouts/_footer.html.erb
100
86
  - app/views/layouts/_google_analytics.html.erb
101
87
  - app/views/layouts/_top_bar.html.erb
102
88
  - app/views/layouts/_twitter.html.erb
103
- - app/views/layouts/email.html.erb
89
+ - app/views/layouts/nimbleshop_simply/mailer.text.erb
104
90
  - app/views/layouts/simply.html.erb
105
91
  - app/views/nimbleshop_simply/carts/_empty_cart.html.erb
106
92
  - app/views/nimbleshop_simply/carts/_line_item.html.erb
@@ -116,6 +102,8 @@ files:
116
102
  - app/views/nimbleshop_simply/checkout/shipping_methods/_shipping_methods.html.erb
117
103
  - app/views/nimbleshop_simply/checkout/shipping_methods/new.html.erb
118
104
  - app/views/nimbleshop_simply/link_groups/_link_group.html.erb
105
+ - app/views/nimbleshop_simply/mailer/order_notification_to_buyer.text.erb
106
+ - app/views/nimbleshop_simply/mailer/shipment_notification_to_buyer.text.erb
119
107
  - app/views/nimbleshop_simply/nimbleshohp_simply/_footer.html.erb
120
108
  - app/views/nimbleshop_simply/nimbleshohp_simply/_google_analytics.html.erb
121
109
  - app/views/nimbleshop_simply/nimbleshohp_simply/_top_bar.html.erb
@@ -142,6 +130,16 @@ files:
142
130
  - lib/nimbleshop_simply/engine.rb
143
131
  - lib/nimbleshop_simply.rb
144
132
  - README.md
133
+ - test/integration/checkout/cart_acceptance_test.rb
134
+ - test/integration/checkout/payment_confirmation_acceptance_test.rb
135
+ - test/integration/checkout/paypal_acceptance_test.rb
136
+ - test/integration/checkout/shipping_address_acceptance_test.rb
137
+ - test/integration/checkout/shipping_method_acceptance_test.rb
138
+ - test/integration/homepage_acceptance_test.rb
139
+ - test/integration/products_acceptance_test.rb
140
+ - test/integration/static_pages_acceptance_test.rb
141
+ - test/mailers/mailer_test.rb
142
+ - test/test_helper.rb
145
143
  homepage: http://nimbleshop.org
146
144
  licenses: []
147
145
  post_install_message:
@@ -154,16 +152,32 @@ required_ruby_version: !ruby/object:Gem::Requirement
154
152
  - - ! '>='
155
153
  - !ruby/object:Gem::Version
156
154
  version: '0'
155
+ segments:
156
+ - 0
157
+ hash: -1282583842987372000
157
158
  required_rubygems_version: !ruby/object:Gem::Requirement
158
159
  none: false
159
160
  requirements:
160
161
  - - ! '>='
161
162
  - !ruby/object:Gem::Version
162
163
  version: '0'
164
+ segments:
165
+ - 0
166
+ hash: -1282583842987372000
163
167
  requirements: []
164
168
  rubyforge_project:
165
169
  rubygems_version: 1.8.24
166
170
  signing_key:
167
171
  specification_version: 3
168
172
  summary: simply theme for nimbleShop
169
- test_files: []
173
+ test_files:
174
+ - test/integration/checkout/cart_acceptance_test.rb
175
+ - test/integration/checkout/payment_confirmation_acceptance_test.rb
176
+ - test/integration/checkout/paypal_acceptance_test.rb
177
+ - test/integration/checkout/shipping_address_acceptance_test.rb
178
+ - test/integration/checkout/shipping_method_acceptance_test.rb
179
+ - test/integration/homepage_acceptance_test.rb
180
+ - test/integration/products_acceptance_test.rb
181
+ - test/integration/static_pages_acceptance_test.rb
182
+ - test/mailers/mailer_test.rb
183
+ - test/test_helper.rb
@@ -1,3 +0,0 @@
1
- <p>This is email template. Should be fixed shortly</p>
2
-
3
- <%= yield %>