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
[user] | |
name = Arthur Klepchukov | |
email = [email protected] | |
[alias] | |
co = checkout | |
st = status | |
ci = commit | |
a = add | |
b = branch | |
d = diff |
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 'test_helper' | |
class PatientTest < ActiveSupport::TestCase | |
def test_should_create_patient | |
assert_difference 'Patient.count' do | |
patient = create_patient | |
assert !patient.new_record?, "#{patient.errors.full_messages.to_sentence}" | |
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
# Here's a sample from one of my controllers: | |
def create | |
@feed_search = FeedSearch.new(params[:feed_search]) | |
@feed_search.feeds = params[:feeds].delete_if{|url| url==""}.map{|url| Feed.find_or_initialize_by_url(url)} | |
@user = (logged_in?) ? current_user : User.find_by_email_or_register(params[:feed_search][:email]) | |
# search needs activation if user isn't logged in | |
@feed_search.state = (logged_in?) ? 'active' : 'pending' | |
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 Idea < ActiveRecord::Base | |
has_many :comments | |
acts_as_rateable | |
after_save :default_rating | |
validates_presence_of :name | |
validates_presence_of :body |
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
test "an idea should start with a rating of 3" do | |
idea = create_idea | |
idea.save! | |
assert idea.rating == 3 | |
end |
NewerOlder