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
# ZOMG RAILS TEMPLATE | |
def replace_line(path, options = {}) | |
lines = File.open(path).readlines | |
lines.map! do |line| | |
if line.match(options[:match]) | |
line = "#{options[:with].rstrip}\n" | |
end | |
line | |
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
describe '#_saveAppointment', -> | |
beforeEach -> | |
@view = new Iora.Views.Appointments.WalkInForm | |
@appointment = new Iora.Models.Appointment | |
patient_id: 5 | |
doctor_id: 2 | |
php_id: 3 | |
at: '2012-04-07T00:00:00-04:00' | |
@saveSpy = sinon.collection.stub(@appointment, 'save') |
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
collection = new Backbone.Collection | |
model = new Backbone.Model {title: 'fun times'} | |
fetchStub = sinon.collection.stub(collection, 'fetch').yieldsTo 'success', model |
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
#rails c production | |
Patient.all.each do |patient| | |
Rails.cache.delete("#{Rails.env}-patient-#{patient.id}") | |
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
Iora.Presenters.Patients.Edit = function() { | |
this.initialize.apply(this, arguments); | |
}; | |
_.extend(Iora.Presenters.Patients.Edit.prototype, function() { | |
checkSomeBox: function() { | |
//dom manipulation here | |
} | |
}); |
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
class User < ActiveRecord::Base | |
validates :name, presence: true | |
end | |
#spec | |
require 'spec_helper' | |
Describe User do | |
it { should validate_presence_of :name } #AMG RAILS IS WORKING!!!!!!!! | |
it { should_not validate_presence_of :nickname } |
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
class User < ActiveRecord::Base | |
has_many :cars | |
end | |
class Color < ActiveRecord::Base | |
belongs_to :car | |
delegate :name, :to => :car, :prefix => true | |
end | |
class Car < ActiveRecord::Base |
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 'uri' | |
class IoraBot::Hangout < IoraBot::Observer | |
def matcher | |
/^(hangout|standup)(.*)$/mi | |
end | |
def handle(message, match_data) | |
person = message[:user][:name].split(' ')[0] | |
command = match_data[1] | |
if command == 'standup' | |
reply = "All: time for standup: #{link('iora_standup')}" |
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
describe "GET /users" do | |
it "lists users if you are logged in" do | |
user1 = Factory(:user, name: "Elliot Stabler") | |
user2 = Factory(:user, name: "Olivia Benson") | |
login_user(user1) | |
login_user(user2) | |
visit users_path | |
page.should_have content(user1.name) |
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
Background: | |
Given the following user: | |
| first name | last name | email | | |
| Fred | Friend | [email protected] | | |
Scenario: I follow a User from their profile | |
Given I am logged in | |
When I go to the profile page for "[email protected]" | |
And I press "Follow" | |
Then I should be following "Fred Friend" |