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 '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! |
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
describe "searching with an empty query" do | |
before(:each) { get :show, :q => '' } | |
it { response.should be_redirect } | |
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
= f.label :gender_male do | |
= f.radio_button, 'Male' | |
= f.label :gender_male, 'Male' | |
= f.radio_button, 'Female' | |
= f.label :gender_female, 'Female' |
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 '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) |
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
module Sinefunc | |
module SpecHelpers | |
module Sugar | |
def its(attribute, &block) | |
describe(attribute) do | |
define_method(:subject) { super().send(attribute) } | |
it(&block) | |
end | |
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
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 |
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
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 |
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
class Retweet | |
include StatusUpdateConcerns | |
template "RT @:username: %.54s :url #boughtstuff" | |
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
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\]" |
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 'spec_helper' | |
describe Reply do | |
it_should_behave_like AnActiveModel | |
it { should validate_length_of(:body, :within => 1..140) } | |
end |