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
| # Will display dates in human readable format when returned in irb | |
| class Date | |
| def inspect | |
| to_s | |
| end | |
| end |
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
| if (root = (defined?(Rails.root) && Rails.root) || RAILS_ROOT) | |
| # load in the 3rd party macros from vendorized plugins and gems | |
| Shoulda.autoload_macros root, File.join("vendor", "{plugins,gems}", "*") | |
| end |
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
| # Update :path for your local machine | |
| gem "factory_girl", :path => '/Users/john/projects/factory_girl' |
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
| john-mbp:fg john$ gem bundle | |
| Calculating dependencies... | |
| /Users/john/.rvm/gems/ruby-1.8.7-p248/gems/bundler-0.8.1/lib/bundler/source.rb:231:in `locate_gemspecs': /Users/john/.rvm/rubies/ruby-1.8.7-p248/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require': no such file to load -- treetop/version (LoadError) | |
| from /Users/john/.rvm/rubies/ruby-1.8.7-p248/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require' | |
| from (eval):1:in `locate_gemspecs' | |
| from /Users/john/.rvm/rubies/ruby-1.8.7-p248/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:95:in `eval' | |
| from /Users/john/.rvm/gems/ruby-1.8.7-p248/gems/bundler-0.8.1/lib/bundler/source.rb:231:in `locate_gemspecs' | |
| from /Users/john/.rvm/rubies/ruby-1.8.7-p248/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:95:in `inject' | |
| from /Users/john/.rvm/gems/ruby-1.8.7-p248/gems/bundler-0.8.1/lib/bundler/source.rb:229:in `each' | |
| from /Users/john/.rvm/gems/ruby-1.8.7-p248/gems/bundler-0.8.1/lib/bundler/source.rb:229:in `inject' |
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
| # Edit this Gemfile to bundle your application's dependencies. | |
| gem "rails", "3.0.pre" | |
| ## Bundle edge rails: | |
| # gem "rails", :git => "git://github.com/rails/rails.git" | |
| ## Bundle the gems you use: | |
| # gem "bj" | |
| # gem "hpricot", "0.6" |
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
| From ff49afda3beb5bb20dd43f05e301bee7b3c57a06 Mon Sep 17 00:00:00 2001 | |
| From: John Trupiano <[email protected]> | |
| Date: Sat, 16 Jan 2010 15:17:10 -0500 | |
| Subject: [PATCH 3/3] Don't allow database access in rails3 | |
| * Override Stub#class to return a dup'd class instance that mocks #active_relation | |
| --- | |
| lib/factory_girl/proxy/stub.rb | 14 ++++++++++++-- | |
| 1 files changed, 12 insertions(+), 2 deletions(-) |
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
| def initialize(klass) | |
| @instance = klass.new | |
| @instance.id = next_id | |
| @instance.instance_eval do | |
| def new_record? | |
| id.nil? | |
| end | |
| def connection | |
| raise "stubbed models are not allowed to access the database" |
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
| john-mbp:rails john$ gem install timecop | |
| /Users/john/.rvm/ruby-1.8.7-p248/lib/ruby/site_ruby/1.8/rubygems/spec_fetcher.rb:232: warning: getc is obsolete; use STDIN.getc instead | |
| ^CERROR: Interrupted | |
| john-mbp:rails john$ gem install timecop --no-rdoc --no-ri | |
| Successfully installed timecop-0.3.4 | |
| 1 gem installed | |
| john-mbp:rails john$ gem install rails --no-rdoc --no-ri | |
| /Users/john/.rvm/ruby-1.8.7-p248/lib/ruby/site_ruby/1.8/rubygems/spec_fetcher.rb:245: [BUG] Segmentation fault | |
| ruby 1.8.7 (2009-12-24 patchlevel 248) [i686-darwin9.8.0] |
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
| john-mbp:playground john$ irb | |
| irb(main):001:0> Time.now | |
| => Fri Jan 15 08:40:05 -0500 2010 | |
| irb(main):002:0> ENV['TZ'] = 'GMT' | |
| => "GMT" | |
| irb(main):003:0> Time.now | |
| => Fri Jan 15 13:40:11 +0000 2010 |
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
| Factory.define :icon do |i| | |
| i.sequence(:name) {|n| "Icon #{n}"} | |
| i.description "Icon description" | |
| i.content "Icon content" | |
| i.image File.new(File.join(RAILS_ROOT, "test", "fixtures", "smaller_cat.jpg")) | |
| end |