Skip to content

Instantly share code, notes, and snippets.

require 'factory_girl'
require 'spec/support/factories'
Factory(:patient)
Factory(:specialty, :name => "Neurology")
PatientClassified.create!( :patient => Patient.last, :specialty => Specialty.last, :concern => "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum." )
PatientClassified.last.post!
describe "searching with an empty query" do
before(:each) { get :show, :q => '' }
it { response.should be_redirect }
end
= f.label :gender_male do
= f.radio_button, 'Male'
= f.label :gender_male, 'Male'
= f.radio_button, 'Female'
= f.label :gender_female, 'Female'
require 'factory_girl'
require 'spec/support/factories'
existing = User.all
users = 20.times.map { Factory(:user) }
existing.each do |e|
users.each do |u|
Lifeline.create(:source => e, :target => u)
@cyx
cyx / its.rb
Created February 24, 2010 08:55
module Sinefunc
module SpecHelpers
module Sugar
def its(attribute, &block)
describe(attribute) do
define_method(:subject) { super().send(attribute) }
it(&block)
end
end
end
describe Item do
it { should validate_presence_of(:name) }
it { should validate_presence_of(:price_in_dollars) }
it { should validate_numericality_of(:price_in_dollars, :allow_blank => true) }
it { should validate_attachment_presence(:photo) }
it { should validate_length_of(:name, :maximum => 255) }
it { should belong_to(:user) }
end
describe "given today is April fools" do
before(:each) { Timecop.freeze Time.utc( 2010, 04, 01 ) }
describe Item, "bought yesterday" do
subject { Item.new(:when => 'Yesterday') }
its(:when) { should == Date.new( 2010, 03, 31 ) }
end
describe Item, "bought today" do
class Retweet
include StatusUpdateConcerns
template "RT @:username: %.54s :url #boughtstuff"
end
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
PS1="\[\033[1;33m\]\w\[\033[0;32m\] \$(parse_git_branch) $ \[\033[00m\]"
require 'spec_helper'
describe Reply do
it_should_behave_like AnActiveModel
it { should validate_length_of(:body, :within => 1..140) }
end