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 '#save' do | |
describe 'with a new resource' do | |
it "should save child assosciations" | |
it "should set defaults before create" | |
it "should create when the resource is dirty" do | |
zoo = Zoo.new | |
zoo.name = "San Diego" | |
zoo.should_receive(:create) |
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
it "should save child assosciations" do | |
repository(ADAPTER) do | |
animal = Animal.new | |
@zoo.animals << animal | |
@zoo.save | |
animal.new_record?.should be_false | |
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
it "should create when dirty" do | |
pending | |
lambda do | |
Zoo.new(:city => "San Diego").save | |
end.should change(Zoo, :all).by(1) | |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>Label</key> | |
<string>PostgreSQL</string> | |
<key>OnDemand</key> | |
<false/> | |
<key>ProgramArguments</key> | |
<array> |
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 File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper_new')) | |
describe "I don't know what's going on" do | |
load_models_for_metaphor :zoo | |
before(:each) do | |
DataMapper.auto_migrate! | |
repository(:secondary) { DataMapper.auto_migrate! } | |
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
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'dm-core' | |
class Zoo | |
include DataMapper::Resource | |
property :id, Serial | |
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
require File.join(File.dirname(__FILE__), "spec_helper") | |
describe Merb::Router do | |
describe "#match" do | |
it "should raise an error if the routes were not compiled yet" do | |
lambda { Merb::Router.match(simple_request) }.should raise_error(Merb::Router::NotCompiledError) | |
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
it "should allow creating conditions that proceed a glob" do | |
Merb::Router.prepare do |r| | |
r.match!("/:foo/bar/:glob", :glob => /.*/) | |
end | |
%w(somewhere somewhere/somehow 123/456/789 i;just/dont-understand).each do |path| | |
route_to("/superblog/bar/#{path}").should have_route(:foo => "superblog", :glob => path) | |
route_to("/notablog/foo/#{path}").should have_nil_route | |
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
it "should allow greedy matches to preceed conditions" do | |
Merb::Router.prepare do |r| | |
r.match!("/foo/:bar/something/:else", :bar => /.*/) | |
end | |
%w(somewhere somewhere/somehow 123/456/789 i;just/dont-understand).each do |path| | |
route_to("/foo/#{path}/something/wonderful").should have_route(:bar => path, :else => "wonderful") | |
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
it "should match only if all mixed conditions are satisied" do | |
Merb::Router.prepare do |r| | |
r.match!("/:blog/post/:id", :blog => %r{[a-zA-Z]}, :id => %r{[0-9]}) | |
end | |
route_to("/superblog/post/123").should have_route(:blog => "superblog", :id => "123") | |
route_to("/superblawg/post/321").should have_route(:blog => "superblawg", :id => "321") | |
route_to("/superblog/post/asdf").should have_nil_route | |
route_to("/superblog1/post/123").should have_nil_route | |
route_to("/ab/12").should have_nil_route |
OlderNewer