Skip to content

Commit

Permalink
Ensures no test.db is created in root folder.
Browse files Browse the repository at this point in the history
  • Loading branch information
blambeau committed Aug 1, 2010
1 parent 04bec06 commit f7391a7
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 21 deletions.
18 changes: 7 additions & 11 deletions test/commands/db/add.spec
Original file line number Diff line number Diff line change
@@ -1,34 +1,30 @@
shared_examples_for("The db:add command") do

it "should return the new database" do
dba.db_add(%w{test sqlite://test.db}).should be_kind_of(DbAgile::Core::Database)
end

it "should accept a sqlite relative database" do
dba.db_add(%w{test test.db}).should be_kind_of(DbAgile::Core::Database)
end

it "should accept a sqlite absolute database" do
dba.db_add(%w{test sqlite://test.db}).should be_kind_of(DbAgile::Core::Database)
it "should accept an absolute database" do
dba.db_add(%w{test postgres://dbagile@localhost/unexisting}).should be_kind_of(DbAgile::Core::Database)
end

it "should raise an error when the name is already in use" do
dba.db_add(%w{test sqlite://test.db})
lambda{ dba.db_add(%w{test sqlite://test.db}) }.should raise_error(DbAgile::DatabaseNameConflictError)
dba.db_add(%w{test test.db})
lambda{ dba.db_add(%w{test test.db}) }.should raise_error(DbAgile::DatabaseNameConflictError)
end

it "should save the repository" do
dba.db_add(%w{test sqlite://test.db})
dba.db_add(%w{test test.db})
dba.dup.repository.has_database?(:test).should be_true
end

it "should set the database as the current one by default" do
dba.db_add(%w{test sqlite://test.db})
dba.db_add(%w{test test.db})
dba.dup.repository.current?(:test).should be_true
end

it "should not set the database as the current one with --no-current" do
dba.db_add(%w{--no-current test sqlite://test.db})
dba.db_add(%w{--no-current test test.db})
dba.dup.repository.current?(:test).should be_false
end

Expand Down
4 changes: 2 additions & 2 deletions test/commands/db/rm.spec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
shared_examples_for("The db:rm command") do

it "should return the repository" do
dba.db_add(%w{test sqlite://test.db})
dba.db_add(%w{test test.db})
dba.db_rm(%w{test}).should be_kind_of(::DbAgile::Core::Repository)
end

Expand All @@ -10,7 +10,7 @@ shared_examples_for("The db:rm command") do
end

it "should save the repository" do
dba.db_add(%w{test sqlite://test.db})
dba.db_add(%w{test test.db})
dba.db_rm(%w{test})
dba.dup.repository.has_database?(:test).should be_false
end
Expand Down
4 changes: 2 additions & 2 deletions test/commands/db/use.spec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
shared_examples_for("The db:use command") do

it "should return the current database" do
dba.db_add(%w{test sqlite://test.db})
dba.db_add(%w{test test.db})
dba.db_use(%w{test}).should be_kind_of(::DbAgile::Core::Database)
end

Expand All @@ -10,7 +10,7 @@ shared_examples_for("The db:use command") do
end

it "should save the repository" do
dba.db_add(%w{--no-current test sqlite://test.db})
dba.db_add(%w{--no-current test test.db})
dba.db_use(%w{test})
dba.dup.repository.current?(:test).should be_true
end
Expand Down
12 changes: 6 additions & 6 deletions test/fixtures/basics/dbagile.idx
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
---
version: 0.0.1
databases:
unexisting:
uri: postgres://dbagile@localhost/dbagile_unexisting
sqlite:
uri: test.db
announced_schema:
- fixtures.yaml
unexisting:
uri: postgres://dbagile@localhost/dbagile_unexisting
postgres:
uri: postgres://dbagile@localhost/dbagile_test
announced_schema:
- fixtures.yaml
robust:
uri: robust.db
announced_schema:
- fixtures.yaml
plugins:
- DbAgile::Contract::Robust::Optimistic
postgres:
uri: postgres://dbagile@localhost/dbagile_test
announced_schema:
- fixtures.yaml
current: sqlite

0 comments on commit f7391a7

Please sign in to comment.