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 Company < ActiveRecord::Base | |
has_many :employees | |
end | |
class Employee < ActiveRecord::Base | |
has_one :position | |
belongs_to :company | |
end | |
class Position < 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
puts build_date | |
# Sun Dec 19 10:35:26 -0600 2010 | |
puts build_date.class | |
# Time | |
# This works | |
feed.update_attributes!(:name => name, :last_build_date => build_date.to_s) | |
# This fails with wrong number of arguments (1 for 0) |
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
DEPRECATION WARNING: RAILS_ROOT is deprecated. Please use ::Rails.root.to_s. (called from join at /Users/obtiva/dev/personal/lifestreams/vendor/plugins/lazy_developer/lib/tasks/rcov.rake:3) |
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
let(:test) { puts "Hello" } | |
it "should print hello" do | |
test | |
end | |
it "should not print hello" do | |
end | |
#output |
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
--- | |
- !ruby/struct:VCR::HTTPInteraction | |
request: !ruby/struct:VCR::Request | |
method: :get | |
uri: http://api.bit.ly:80/v3/clicks?apiKey=R_504029652b3e3b641ac2ad781723c96a&hash=fXEv5E&login=jonhoman | |
body: | |
headers: | |
response: !ruby/struct:VCR::Response | |
status: !ruby/struct:VCR::ResponseStatus | |
code: 200 |
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 'connect'" do | |
before do | |
stub_oauth_request_token! | |
end | |
it "should redirect to twitter authorization url" do | |
get 'connect' | |
session[:request_token].should == 't' | |
session[:request_token_secret].should == 's' |
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
Given /^I have a feed I want to edit$/ do | |
VCR.use_cassette("feed") do | |
@feed = Factory :feed | |
end | |
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 Feed do | |
let :feed do | |
Factory :feed | |
end | |
it "is not valid without a name" do | |
feed.name = nil | |
feed.should_not be_valid | |
end | |
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
WebMock.should have_requested(:get, "www.example.com") | |
WebMock.should have_requested(:get, "www.example.com").twice | |
WebMock.should have_requested(:post, "www.example.com").with(:headers => 'Content-Type' => 'application/json') |
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
# app/models/user.rb | |
class User < ActiveRecord::Base | |
has_many :profiles | |
accepts_nested_attributes_for :profiles | |
end | |
# app/models/profile.rb | |
class Profile < ActiveRecord::Base | |
belongs_to :user | |
end |
OlderNewer