Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: James McCarthy <james2mccarthy@gmail.com>
- Loading branch information
Showing
3 changed files
with
29 additions
and
0 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 |
---|---|---|
@@ -0,0 +1 @@ | ||
User.create(:email => 'user@example.com') |
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,3 @@ | ||
after :dependency do | ||
Post.create(:title => 'title') | ||
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,25 @@ | ||
require 'test_helper' | ||
|
||
describe Seedbank::Runner do | ||
|
||
describe "seeds with dependency" do | ||
|
||
subject { Rake::Task['db:seed:dependent'] } | ||
|
||
before do | ||
subject.reenable | ||
Rake::Task['db:seed:dependent:body'].reenable if Rake::Task.task_defined?('db:seed:dependent:body') | ||
Rake::Task['db:seed:dependency'].reenable | ||
end | ||
|
||
it "runs the dependent seed" do | ||
Post.expects(:create).with(:title => 'title').returns(true) | ||
subject.invoke | ||
end | ||
|
||
it "runs the dependency" do | ||
User.expects(:create).with(:email => 'user@example.com').returns(true) | ||
subject.invoke | ||
end | ||
end | ||
end |