This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
context "#build_source" do | |
let(:payment_method) { Factory(:bogus_payment_method) } | |
it "should build the payment's source" do | |
params = { :amount => 100, :payment_method_id => payment_method.id, | |
:source_attributes => {:year=>"2012", :month =>"1", :number => '1234567890123',:verification_value => '123'}} | |
payment = Spree::Payment.new(params) | |
payment.should be_valid | |
payment.source.should_not be_nil |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<message xmlns="urn:ULGNEWCART"><request requestID="addToCart" userID="STS" cartID="Q301-740" description="Coupon (U14925568)" qty="1" cardCode="1022" siteType="CELLARS" priceEachEX="-20.00" cartType="shopping" taxEach="0.00" lineNumber="" prodID="VOUCHER"/></message> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<message xmlns="urn:ULGNEWCART"> | |
<request prodID="" requestID="addToCart" description="Shipping" userID="STS" cartID="Q301-716" qty="1" cardCode="1022" siteType="CELLARS" priceEachEX="10.00" cartType="shopping" taxEach="0.00" lineNumber=""/> | |
</message> | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
newdoorventures $ DEBUG=true ey deploy | |
Token xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx | |
Request GET https://cloud.engineyard.com/api/v2/apps | |
EY::API::RequestFailed 408 Request Timeout <html> | |
<head> | |
<meta http-equiv="Content-type" content="text/html; charset=utf-8" /> | |
<title>Request timed out</title> | |
<link rel="stylesheet" href="http://assets.engineyard.com/stylesheets/master.css" type="text/css" media="screen" charset="utf-8" /> | |
<style type="text/css"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#making .irbrc posted at http://www.tech-angels.fr/post/963080350/improve-irb-and-fix-it-on-mac-os-x | |
#work with rails3 | |
require 'rubygems' | |
#rails3: be sure to include wirble and hirb in your Gemfile | |
require 'wirble' | |
require 'hirb' | |
Wirble.init | |
Wirble.colorize | |
# hirb (active record output format in table) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# put in config/application.rb | |
config.to_prepare do | |
::PagesController.module_eval do | |
caches_page :show, :unless => proc {|c| c.user_signed_in? || c.flash.any? } | |
caches_page :home, :unless => proc {|c| c.user_signed_in? || c.flash.any? } | |
end | |
::Page.module_eval do | |
after_save :clear_static_caching! | |
after_destroy :clear_static_caching! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def site_taxes | |
zones = Zone.match(self.shipment.address) | |
tax_rates = zones.map { |zone| zone.tax_rates}.flatten.uniq | |
calculated_taxes = {} | |
tax_rates.each do |tax_rate| | |
calculated_taxes[tax_rate.calculator.description] ||= 0 | |
calculated_taxes[tax_rate.calculator.description] += tax_rate.calculate_tax(self) | |
end | |
calculated_taxes.delete_if { |k, v| v == 0 } | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### output from running cucumber ### | |
Using the default profile... | |
Feature: Manage Projects | |
In order to manage my projects | |
As an authenticated user | |
I want to create and manage projects | |
Scenario: Projects List # features/manage_projects.feature:7 | |
Given I am logged in as user bob@test.com # features/step_definitions/project_steps.rb:1 | |
And I have 5 to 10 projects # features/step_definitions/project_steps.rb:10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(function() { | |
$( ".sortable" ).sortable({ | |
handle: '.handle', | |
cursor: 'crosshair', | |
update: function(){ | |
$.ajax({ | |
type: 'post', | |
data: $('.sortable').sortable('serialize'), | |
url: '/projects/<%= @project.id %>/sort_tasks'}); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# add to site_extension.rb | |
Checkout.class_eval do | |
state_machine do | |
before_transition :to => 'confirm' do |checkout, transition| | |
!checkout.payments.first.nil? && !checkout.payments.first.source_id.nil? | |
end | |
end | |
end | |
# override update method in CheckoutsController |
NewerOlder