Permalink
Browse files

don't let tests choose what kind of access to use

  • Loading branch information...
1 parent 717c4da commit d5c274bb317b448e07ad7e9beab772f89cda51ae @rcarver committed Mar 11, 2012
View
4 test/helper.rb
@@ -59,10 +59,10 @@ def drop_mysql_database
MysqlUtils.drop_mysql_database(database_name)
end
- # Get access to the mysql database via the CLI interface.
+ # Get access to the mysql database.
#
# Returns a MysqlInspector:Access.
- def cli_access
+ def access
MysqlInspector::Access.new(database_name, "root", nil, "mysql")
end
View
8 test/helper_ar.rb
@@ -2,7 +2,7 @@
require 'mysql2'
require 'helper'
-class MysqlInspectorActiveRecordpec < MysqlInspectorSpec
+class MysqlInspectorActiveRecordSpec < MysqlInspectorSpec
register_spec_type(self) { |desc| desc =~ /activerecord/ }
@@ -26,10 +26,10 @@ def run_active_record_migrations!
ActiveRecord::Migrator.migrate(["test/fixtures/migrate"])
end
- # Get access to the mysql database via the AR interface.
+ # Get access to the mysql database.
#
- # Returns a MysqlInspector:Access::AR.
- def ar_access
+ # Returns a MysqlInspector:AR::Access.
+ def access
MysqlInspector::AR::Access.new(ActiveRecord::Base.connection)
end
View
4 test/mysql_inspector/cli_load_test.rb
@@ -29,15 +29,15 @@
create_mysql_database schema_b
inspect_database "write #{database_name}"
create_mysql_database ideas_schema
- cli_access.table_names.size.must_equal 1
+ access.table_names.size.must_equal 1
it "outputs nothing"
stdout.must_equal ""
stderr.must_equal ""
status.must_equal 0
it "creates all tables"
- cli_access.table_names.size.must_equal 3
+ access.table_names.size.must_equal 3
end
end
end
View
12 test/mysql_inspector/dump_test.rb
@@ -21,7 +21,7 @@
describe "when written" do
before do
create_mysql_database(schema_b)
- subject.write!(cli_access)
+ subject.write!(access)
end
it "does exist" do
subject.must_be :exists?
@@ -43,19 +43,19 @@
describe "when loaded" do
before do
create_mysql_database(schema_b)
- subject.write!(cli_access)
+ subject.write!(access)
create_mysql_database(ideas_schema)
end
it "recreates all of the tables, even ones that already exist" do
- cli_access.table_names.must_equal ["ideas"]
- subject.load!(cli_access)
- cli_access.table_names.sort.must_equal ["ideas", "things", "users"]
+ access.table_names.must_equal ["ideas"]
+ subject.load!(access)
+ access.table_names.sort.must_equal ["ideas", "things", "users"]
end
end
describe "when written but a database does not exist" do
it "fails" do
- proc { subject.write!(cli_access) }.must_raise MysqlInspector::Access::Error
+ proc { subject.write!(access) }.must_raise MysqlInspector::Access::Error
end
end
end
View
8 test/mysql_inspector_ar/ar_dump_test.rb
@@ -12,7 +12,7 @@
describe "when written" do
before do
- subject.write!(ar_access)
+ subject.write!(access)
end
it "has tables" do
subject.tables.size.must_equal 3
@@ -36,12 +36,12 @@
describe "when loaded" do
before do
- subject.write!(ar_access)
+ subject.write!(access)
create_mysql_database
- subject.load!(ar_access)
+ subject.load!(access)
end
it "recreates all of the tables" do
- ar_access.table_names.sort.must_equal ["schema_migrations", "things", "users"]
+ access.table_names.sort.must_equal ["schema_migrations", "things", "users"]
end
it "loads migrations" do
values = ActiveRecord::Base.connection.select_values("select * from schema_migrations")

0 comments on commit d5c274b

Please sign in to comment.