View gist:101789
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
diff --git a/app/models/order.rb b/app/models/order.rb | |
index 00799d0..3ae6013 100644 | |
--- a/app/models/order.rb | |
+++ b/app/models/order.rb | |
@@ -70,11 +70,17 @@ class Order < ActiveRecord::Base | |
end | |
def processing_fee | |
+ # These are the packages with a processing fee. | |
+ require_processing_fee = ['Package', 'FamilyPackage', 'LadiesPackage', 'CompletePackage'] |
View gist:101845
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
class Order < ActiveRecord::Base | |
def processing_fee | |
packages_with_processing_fees = ['Package', 'FamilyPackage', 'LadiesPackage', 'CompletePackage'] | |
fee = 0 | |
# Only apply fee if cart contains an item with processing fees | |
fee = 3.00 if line_items.any? {|line_item| packages_with_processing_fees.include? line_item.item.class.to_s } | |
if customer |
View gist:224488
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
test 'create' do | |
Duck.any_instance.expects(:save).returns(true) | |
@duck = ducks(:basic) | |
post :create, :duck => @duck.attributes | |
assert_response :redirect | |
end | |
# is erroring out: | |
# 1) Error: | |
#test_create(DucksControllerTest): |
View gist:224563
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
darron-froeses-macbook-pro:Sites darron$ rails -v | |
Rails 2.3.4 | |
darron-froeses-macbook-pro:Sites darron$ rails dry-scaffold-test | |
create | |
create app/controllers | |
create app/helpers | |
create app/models | |
create app/views/layouts | |
create config/environments | |
create config/initializers |
View gist:225438
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
diff --git a/README.textile b/README.textile | |
index 6ee8d12..57d3c85 100644 | |
--- a/README.textile | |
+++ b/README.textile | |
@@ -38,6 +38,9 @@ h4. Testing | |
* "*shoulda*":http://github.com/thoughtbot/shoulda - Testing framework | |
* "*rspec*":http://wiki.github.com/dchelimsky/rspec - Testing framework | |
+* "*mocha*":http://github.com/floehopper/mocha - Mocking and stubbing library | |
+ |
View gist:271448
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
class Link < ActiveRecord::Base | |
has_and_belongs_to_many :bundle | |
validates_presence_of :url | |
before_save :grab_title | |
require 'hpricot' | |
require 'open-uri' | |
# TODO: There's no error checking at all. | |
def grab_title | |
doc = Hpricot(open("#{url}")) |
View gist:272514
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
#showlinks | |
-@links.each do |link| | |
%p== <a href="#{link.url}" title="#{link.url}" target="_blank">#{link.title}</a> | |
#linknote | |
%p Send this link to your friends: | |
%b | |
%a{:href => "/" } Dude | |
/ This works, but I am trying to put @instance_variable in the "/" and the "Dude" |
View gist:272525
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
#showlinks | |
-@links.each do |link| | |
%p= link_to( link.title, link.url, :title => link.title, :target => '_blank' ) | |
#linknote | |
%p Send this link to your friends: | |
%b | |
%a{:href => "/" } Dude | |
/ This works, but I am trying to put @instance_variable in the "/" and the "Dude" |
View config.ru
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
require 'page' | |
run Sinatra::Application |
View gist:309428
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
#!/bin/bash | |
# Thanks: http://www.hackido.com/2009/04/install-ruby-rails-on-ubuntu-904-jaunty.html | |
# Thanks: http://github.com/crafterm/sprinkle and @aplus | |
# Log in and uncomment universe lines in /etc/apt/sources.list | |
# For Git | |
apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 4CBEDD5A | |
echo "deb http://ppa.launchpad.net/pdoes/ppa/ubuntu karmic main" >> /etc/apt/sources.list |
OlderNewer