This file contains hidden or 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 File.join( File.dirname(__FILE__), '..', "spec_helper" ) | |
| describe Stock do | |
| it "should be valid when new" do | |
| stock = Stock.new(:symbol => 'GOOG') | |
| stock.should be_valid | |
| end | |
| it "should be invalid when symbol is empty" do |
This file contains hidden or 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
| # http://www.peterryan.net/2007/08/08/bdd-model-validation-using-rspec-and-extensions-to-hash/ | |
| 1. before(:each) do | |
| 2. @team = Team.new | |
| 3. end | |
| 4. | |
| 5. def valid_team | |
| 6. { | |
| 7. :name => "team name", | |
| 8. :contact_number => "call me here!", |
This file contains hidden or 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
| it "should have comments" do | |
| stock = Stock.create(:symbol => 'GOOG') | |
| stock.comments << Comment.new(:body => "First comment") | |
| stock.comments << Comment.new(:body => "Second comment") | |
| stock.should have(2).comments | |
| end | |
| or | |
| it "should have comments" do |
This file contains hidden or 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
| render :update do |page| | |
| div_id = "panel_"{var.id}" | |
| div_id.to_sym | |
| page[div_id].set_style... |
This file contains hidden or 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
| # default rails environment to development | |
| ENV['RAILS_ENV'] ||= 'development' | |
| # require rails environment file which basically "boots" up rails for this script | |
| require File.join(File.dirname(__FILE__), '..', '..', 'config', 'environment') | |
| require 'net/imap' | |
| require 'net/http' | |
| # mail.yml is the imap config for the email account (ie: username, host, etc.) | |
| config = YAML.load(File.read(File.join(RAILS_ROOT, 'config', 'mail.yml'))) | |
This file contains hidden or 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
| # default rails environment to development | |
| ENV['RAILS_ENV'] ||= 'development' | |
| # require rails environment file which basically "boots" up rails for this script | |
| require File.join(File.dirname(__FILE__), '..', '..', 'config', 'environment') | |
| require 'net/imap' | |
| require 'net/http' | |
| # mail.yml is the imap config for the email account (ie: username, host, etc.) | |
| config = YAML.load(File.read(File.join(RAILS_ROOT, 'config', 'mail.yml'))) | |
This file contains hidden or 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
| \[Project:.*] |
This file contains hidden or 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
| namespace :chores do | |
| task :each_minute => :environment do | |
| chore("Each minute") do | |
| # our code will go here | |
| end | |
| end | |
| task :hourly => :environment do | |
| chore("Hourly") do |
This file contains hidden or 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
| namespace :chores do | |
| task :each_minute => :environment do | |
| chore("Each minute") do | |
| # our code will go here | |
| end | |
| end | |
| task :hourly => :environment do | |
| chore("Hourly") do |
This file contains hidden or 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
| * * * * * RAILS_ENV=production rake -f <%= current_path %>/Rakefile chores:each_minute >> <%= deploy_to %>/shared/log/cron/each_minute.txt | |
| 00 * * * * RAILS_ENV=production rake -f <%= current_path %>/Rakefile chores:hourly >> <%= deploy_to %>/shared/log/cron/hourly.txt | |
| 01 0 * * * RAILS_ENV=production rake -f <%= current_path %>/Rakefile chores:daily >> <%= deploy_to %>/shared/log/cron/daily.txt | |
| 02 0 * * 1 RAILS_ENV=production rake -f <%= current_path %>/Rakefile chores:weekly >> <%= deploy_to %>/shared/log/cron/weekly.txt |
OlderNewer