Created
August 7, 2008 18:28
-
-
Save arthurschreiber/4460 to your computer and use it in GitHub Desktop.
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
<?php | |
namespace FsckUnit; | |
require_once(dirname(__FILE__) . "/spec_helper.php"); | |
describe("ActiveRecord::Base::table_name()", function() { | |
it("returns the table name for the class", function() { | |
expect(::News::table_name())->to("==", "news"); | |
expect(::Post::table_name())->to("==", "posts"); | |
expect(::Person::table_name())->to("==", "people"); | |
}); | |
}); | |
describe("ActiveRecord::Base::find() when passed 'first'", function() { | |
it("returns the first row from the Database", function() { | |
expect(::News::find("first"))->to("==", 'SELECT * FROM "news" LIMIT 1'); | |
expect(::Post::find("first"))->to("==", 'SELECT * FROM "posts" LIMIT 1'); | |
expect(::Person::find("first"))->to("==", 'SELECT * FROM "people" LIMIT 1'); | |
}); | |
}); | |
describe("ActiveRecord::Base::find() when passed 'all'", function() { | |
it("returns all rows from the Database", function() { | |
expect(::News::find("all"))->to("==", 'SELECT * FROM "news"'); | |
expect(::Post::find("all"))->to("==", 'SELECT * FROM "posts"'); | |
expect(::Person::find("all"))->to("==", 'SELECT * FROM "people"'); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment