Skip to content

Instantly share code, notes, and snippets.

View darron's full-sized avatar
🎯
Focusing

darron froese darron

🎯
Focusing
View GitHub Profile
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']
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
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):
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
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
+
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}"))
#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"
#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"
require 'page'
run Sinatra::Application
#!/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