Created
February 22, 2010 08:34
-
-
Save madpilot/310930 to your computer and use it in GitHub Desktop.
Some sample test setup files
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 'machinist/active_record' | |
require 'sham' | |
require 'faker' | |
Sham.define do | |
title { Faker::Lorem.words(2).join(' ') } | |
permalink { Faker::Lorem.words(2).join('-') } | |
status(:unique => false) do | |
case(rand(3)) | |
when 0: | |
'draft' | |
when 1: | |
'published' | |
when 2: | |
'archived' | |
end | |
end | |
description { Faker::Lorem.words(12).join(' ') } | |
keywords { Faker::Lorem.words(8).join(',') } | |
copy { Faker::Lorem.words(1024).join(' ') } | |
path { Faker::Lorem.words(2).join('/') } | |
link { Faker::Internet.domain_name } | |
integer { rand(100) } | |
login { Faker::Name.first_name.underscore } | |
first_name { Faker::Name.first_name } | |
last_name { Faker::Name.last_name } | |
email { Faker::Internet.email } | |
password { (0..6).inject('') { |t, c| t += (rand(?z - ?a) + ?a).floor.chr } } | |
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
gem install shoulda | |
gem intstall mocha | |
gem install faker | |
gem install machinist | |
(All on gemcutter) |
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 'redgreen' | |
require 'test/unit' | |
ENV["RAILS_ENV"] = "test" | |
require File.expand_path(File.dirname(__FILE__) + "/../config/environment") | |
require 'test_help' | |
require 'blueprints' | |
require 'mocha' | |
class ActiveSupport::TestCase | |
# Add more helper methods to be used by all tests here... | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment