forked from ianwhite/nested_has_many_through
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Removed the need for an actual rails application to run the spec-suite - Added three specs for a rails association that should be working with or without the plugin (which fail at the moment)
- Loading branch information
Maran Hidskes
committed
Aug 13, 2009
1 parent
7cce087
commit 44c06c3
Showing
5 changed files
with
84 additions
and
32 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
spec/log/test.log | ||
.garlic | ||
doc/* |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
ActiveRecord::Schema.define(:version => 0) do | ||
create_table :users, :force => true do |t| | ||
t.column "type", :string | ||
end | ||
|
||
create_table :posts, :force => true do |t| | ||
t.column "author_id", :integer | ||
t.column "category_id", :integer | ||
t.column "inflamatory", :boolean | ||
end | ||
|
||
create_table :categories, :force => true do |t| | ||
end | ||
|
||
create_table :comments, :force => true do |t| | ||
t.column "user_id", :integer | ||
t.column "post_id", :integer | ||
end | ||
|
||
create_table :assistants, :force => true do |t| | ||
t.column "author_id", :integer | ||
t.column "name", :string | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
require File.expand_path(File.join(File.dirname(__FILE__), '../spec_helper')) | ||
require File.expand_path(File.join(File.dirname(__FILE__), '../app')) | ||
|
||
describe Assistant do | ||
before(:each) do | ||
@assistant = Assistant.create!(:name => "Jeroen") | ||
@author = @assistant.create_author | ||
|
||
@p1, @p2, @p3 = (1..3).map { @author.posts.create! } | ||
end | ||
|
||
it "should return correct number of posts" do | ||
@assistant.posts.size.should == 3 | ||
end | ||
|
||
it "should return the same posts as its author" do | ||
@assistant.posts.should == @author.posts | ||
end | ||
|
||
it "should return the posts in the same order " do | ||
@assistant.posts.should == [@p1, @p2, @p3] | ||
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