Calculate Order#uncaptured amount on payments on the fly.
Fixes #4831
Fixes #4834
Fixes #4747
Bump rails to ~> 4.1.1
Refer to selected shipping rates directly

This means that rates can be available on shipments, but not shipping methods

Useful for extensions like spree_easypost which only set rates and don't have shipping methods
Use permitted_option_value_attributes instead of permitted_option_type_attributes

Fixes #4772
Add deletion protection for promotion actions

When promotion actions get destroyed, all of their completed adjustments
then have a reference to a non-existent source, which causes data issues
when trying to understand what promotion an adjustment was for.

Since promotion actions get destroyed when a promotion changes how it is
applied, which can happen somewhat frequently, adding a paranoia around
it will allow a paper trail back to the original promotion.

Fixes #4806
Switch to rspec expect syntax in AuthorizationHelpers.

This stub syntax brings up deprecation warnings in rspec 3.0.  Spree
still operates on 2.14, but we use the auth helpers in an rspec 3
project.

The expect syntax is compatible with version of rspec newer than 2.11
introduced in Jun 2012.

Fixes #4810
Fixes an issue where entering 30.49 would preauthorize 3049$.

Fixed by using both the dot (.) and the custom decimal separator for amount parsing.

Fixes #4259
Pagination and search in property list

Fixes #4369
Adding data-hooks to search results header

Our app modifies the look of the page when no results are found, and in order to do that we have to override this entire partial. I'm thinking that adding some data-hooks might make it easier for folks like us to modify just a part of the partial if needed.

Fixes #4820
Fixes Zone #contains? n+1 query performance.

Fixes #4832
Fix properties search icon and failing spec

Fixes a failing feature spec (Unable to find css ".fa-search")
introduced in 2e9002a36b24b22f120bf9494b51a0fec3eebf4c.

Using the correct icon for the search button fixes this.
Simplify records created form line_item factory

Instead of creating a variant, which creates a product and a master
variant (thus creating two variants), just use the product factory and
reference variant created.

This makes core specs run very slightly faster on my machine (a few
seconds off of ~1:30) and I think this is closer to what people would
expect create(:line_item) to do.

Fixes #4852
Drop nonsense api/checkouts#ip_address
fix permalink handling to force uniqueueness and rename on product destroy

Fixes #4805

Conflicts:
	core/spec/models/spree/product_spec.rb
'quantity -= amount' is the same as 'quantity += -amount'
Make migration more tolerant of deleted Variants

This migration bailed for me when it found an old order (before Spree used `acts_as_paranoid`) with a line_item referencing a Variant that no longer existed.

Making the migration use `variant_id` instead of `variant.id` fixed this problem for me, and I suspect will make the migration path smoother for other people who have been using Spree since before the `paranoia` gem.

Fixes #4822
Bump activemerchant to 1.43.1

This should fix spree/spree_gateway#149
Delegate accessor line_item.sku to variant

(Addressing conversation in https://github.com/spree/spree/pull/4856)

Fixes #4860
Don't assume default variant in JS. Let this be controlled by HTML markup.

Fixes #4849
Downcasing locale for jquery.validate i18n messages

Fixes #4867