mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
Added a db2 adapter that only depends on the Ruby/DB2 bindings (http://raa.ruby-lang.org/project/ruby-db2/) #386 [Maik Schmidt]. Converted all the fixtures to YAML style ones.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@303 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
@@ -519,7 +519,7 @@ class HasAndBelongsToManyAssociationsTest < Test::Unit::TestCase
|
||||
|
||||
def test_removing_associations_on_destroy
|
||||
Developer.find(1).destroy
|
||||
assert Developer.connection.select_all("SELECT * FROM developers_projects WHERE developer_id = '1'").empty?
|
||||
assert Developer.connection.select_all("SELECT * FROM developers_projects WHERE developer_id = 1").empty?
|
||||
end
|
||||
|
||||
def test_additional_columns_from_join_table
|
||||
|
||||
@@ -119,7 +119,7 @@ class BasicsTest < Test::Unit::TestCase
|
||||
def test_update
|
||||
topic = Topic.new
|
||||
topic.title = "Another New Topic"
|
||||
topic.written_on = "2003-12-12 23:23"
|
||||
topic.written_on = "2003-12-12 23:23:00"
|
||||
topic.save
|
||||
id = topic.id
|
||||
assert_equal(id, topic.id)
|
||||
@@ -162,7 +162,7 @@ class BasicsTest < Test::Unit::TestCase
|
||||
def test_destroy
|
||||
topic = Topic.new
|
||||
topic.title = "Yet Another New Topic"
|
||||
topic.written_on = "2003-12-12 23:23"
|
||||
topic.written_on = "2003-12-12 23:23:00"
|
||||
topic.save
|
||||
id = topic.id
|
||||
topic.destroy
|
||||
@@ -585,4 +585,4 @@ class BasicsTest < Test::Unit::TestCase
|
||||
assert_raises(ActiveRecord::RecordNotFound) { Topic.find(1) }
|
||||
assert_nothing_raised { Reply.find(should_be_destroyed_reply.id) }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
24
activerecord/test/connections/native_db2/connection.rb
Normal file
24
activerecord/test/connections/native_db2/connection.rb
Normal file
@@ -0,0 +1,24 @@
|
||||
print "Using native DB2\n"
|
||||
require 'fixtures/course'
|
||||
require 'logger'
|
||||
|
||||
ActiveRecord::Base.logger = Logger.new("debug.log")
|
||||
|
||||
db1 = 'arunit'
|
||||
db2 = 'arunit2'
|
||||
|
||||
ActiveRecord::Base.establish_connection(
|
||||
:adapter => "db2",
|
||||
:host => "localhost",
|
||||
:username => "arunit",
|
||||
:password => "arunit",
|
||||
:database => db1
|
||||
)
|
||||
|
||||
Course.establish_connection(
|
||||
:adapter => "db2",
|
||||
:host => "localhost",
|
||||
:username => "arunit2",
|
||||
:password => "arunit2",
|
||||
:database => db2
|
||||
)
|
||||
21
activerecord/test/fixtures/companies.yml
vendored
Normal file
21
activerecord/test/fixtures/companies.yml
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
first_client:
|
||||
id: 2
|
||||
type: Client
|
||||
firm_id: 1
|
||||
client_of: 2
|
||||
name: Summit
|
||||
ruby_type: Client
|
||||
|
||||
first_firm:
|
||||
id: 1
|
||||
type: Firm
|
||||
name: 37signals
|
||||
ruby_type: Firm
|
||||
|
||||
second_client:
|
||||
id: 3
|
||||
type: Client
|
||||
firm_id: 1
|
||||
client_of: 1
|
||||
name: Microsoft
|
||||
ruby_type: Client
|
||||
@@ -1,6 +0,0 @@
|
||||
id => 2
|
||||
type => Client
|
||||
firm_id => 1
|
||||
client_of => 2
|
||||
name => Summit
|
||||
ruby_type => Client
|
||||
@@ -1,4 +0,0 @@
|
||||
id => 1
|
||||
type => Firm
|
||||
name => 37signals
|
||||
ruby_type => Firm
|
||||
@@ -1,6 +0,0 @@
|
||||
id => 3
|
||||
type => Client
|
||||
firm_id => 1
|
||||
client_of => 1
|
||||
name => Microsoft
|
||||
ruby_type => Client
|
||||
7
activerecord/test/fixtures/courses.yml
vendored
Normal file
7
activerecord/test/fixtures/courses.yml
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
java:
|
||||
id: 2
|
||||
name: Java Development
|
||||
|
||||
ruby:
|
||||
id: 1
|
||||
name: Ruby Development
|
||||
2
activerecord/test/fixtures/courses/java
vendored
2
activerecord/test/fixtures/courses/java
vendored
@@ -1,2 +0,0 @@
|
||||
id => 2
|
||||
name => Java Development
|
||||
2
activerecord/test/fixtures/courses/ruby
vendored
2
activerecord/test/fixtures/courses/ruby
vendored
@@ -1,2 +0,0 @@
|
||||
id => 1
|
||||
name => Ruby Development
|
||||
7
activerecord/test/fixtures/customers.yml
vendored
Normal file
7
activerecord/test/fixtures/customers.yml
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
david:
|
||||
id: 1
|
||||
name: David
|
||||
balance: 50
|
||||
address_street: Funny Street
|
||||
address_city: Scary Town
|
||||
address_country: Loony Land
|
||||
6
activerecord/test/fixtures/customers/david
vendored
6
activerecord/test/fixtures/customers/david
vendored
@@ -1,6 +0,0 @@
|
||||
id => 1
|
||||
name => David
|
||||
balance => 50
|
||||
address_street => Funny Street
|
||||
address_city => Scary Town
|
||||
address_country => Loony Land
|
||||
112
activerecord/test/fixtures/db_definitions/db2.sql
vendored
Normal file
112
activerecord/test/fixtures/db_definitions/db2.sql
vendored
Normal file
@@ -0,0 +1,112 @@
|
||||
CREATE TABLE accounts (
|
||||
id int generated by default as identity (start with +10000),
|
||||
firm_id int default NULL,
|
||||
credit_limit int default NULL,
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
|
||||
CREATE TABLE companies (
|
||||
id int generated by default as identity (start with +10000),
|
||||
type varchar(50) default NULL,
|
||||
ruby_type varchar(50) default NULL,
|
||||
firm_id int default NULL,
|
||||
name varchar(50) default NULL,
|
||||
client_of int default NULL,
|
||||
rating int default 1,
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
|
||||
CREATE TABLE topics (
|
||||
id int generated by default as identity (start with +10000),
|
||||
title varchar(255) default NULL,
|
||||
author_name varchar(255) default NULL,
|
||||
author_email_address varchar(255) default NULL,
|
||||
written_on timestamp default NULL,
|
||||
bonus_time time default NULL,
|
||||
last_read date default NULL,
|
||||
content varchar(3000),
|
||||
approved smallint default 1,
|
||||
replies_count int default 0,
|
||||
parent_id int default NULL,
|
||||
type varchar(50) default NULL,
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
|
||||
CREATE TABLE developers (
|
||||
id int generated by default as identity (start with +10000),
|
||||
name varchar(100) default NULL,
|
||||
salary int default 70000,
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
|
||||
CREATE TABLE projects (
|
||||
id int generated by default as identity (start with +10000),
|
||||
name varchar(100) default NULL,
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
|
||||
CREATE TABLE developers_projects (
|
||||
developer_id int NOT NULL,
|
||||
project_id int NOT NULL,
|
||||
joined_on date default NULL
|
||||
);
|
||||
|
||||
CREATE TABLE customers (
|
||||
id int generated by default as identity (start with +10000),
|
||||
name varchar(100) default NULL,
|
||||
balance int default 0,
|
||||
address_street varchar(100) default NULL,
|
||||
address_city varchar(100) default NULL,
|
||||
address_country varchar(100) default NULL,
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
|
||||
CREATE TABLE movies (
|
||||
movieid int generated by default as identity (start with +10000),
|
||||
name varchar(100) default NULL,
|
||||
PRIMARY KEY (movieid)
|
||||
);
|
||||
|
||||
CREATE TABLE subscribers (
|
||||
nick varchar(100) NOT NULL,
|
||||
name varchar(100) default NULL,
|
||||
PRIMARY KEY (nick)
|
||||
);
|
||||
|
||||
CREATE TABLE booleantests (
|
||||
id int generated by default as identity (start with +10000),
|
||||
value int default NULL,
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
|
||||
CREATE TABLE auto_id_tests (
|
||||
auto_id int generated by default as identity (start with +10000),
|
||||
value int default NULL,
|
||||
PRIMARY KEY (auto_id)
|
||||
);
|
||||
|
||||
CREATE TABLE entrants (
|
||||
id int NOT NULL PRIMARY KEY,
|
||||
name varchar(255) NOT NULL,
|
||||
course_id int NOT NULL
|
||||
);
|
||||
|
||||
CREATE TABLE colnametests (
|
||||
id int generated by default as identity (start with +10000),
|
||||
references int NOT NULL,
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
|
||||
CREATE TABLE mixins (
|
||||
id int generated by default as identity (start with +10000),
|
||||
parent_id int default NULL,
|
||||
pos int default NULL,
|
||||
created_at timestamp default NULL,
|
||||
updated_at timestamp default NULL,
|
||||
lft int default NULL,
|
||||
rgt int default NULL,
|
||||
root_id int default NULL,
|
||||
type varchar(40) default NULL,
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
|
||||
4
activerecord/test/fixtures/db_definitions/db22.sql
vendored
Normal file
4
activerecord/test/fixtures/db_definitions/db22.sql
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
CREATE TABLE courses (
|
||||
id int NOT NULL PRIMARY KEY,
|
||||
name varchar(255) NOT NULL
|
||||
);
|
||||
13
activerecord/test/fixtures/developers_projects.yml
vendored
Normal file
13
activerecord/test/fixtures/developers_projects.yml
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
david_action_controller:
|
||||
developer_id: 1
|
||||
project_id: 2
|
||||
joined_on: 2004-10-10
|
||||
|
||||
david_active_record:
|
||||
developer_id: 1
|
||||
project_id: 1
|
||||
joined_on: 2004-10-10
|
||||
|
||||
jamis_active_record:
|
||||
developer_id: 2
|
||||
project_id: 1
|
||||
14
activerecord/test/fixtures/entrants.yml
vendored
Normal file
14
activerecord/test/fixtures/entrants.yml
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
first:
|
||||
id: 1
|
||||
course_id: 1
|
||||
name: Ruby Developer
|
||||
|
||||
second:
|
||||
id: 2
|
||||
course_id: 1
|
||||
name: Ruby Guru
|
||||
|
||||
third:
|
||||
id: 3
|
||||
course_id: 2
|
||||
name: Java Lover
|
||||
3
activerecord/test/fixtures/entrants/first
vendored
3
activerecord/test/fixtures/entrants/first
vendored
@@ -1,3 +0,0 @@
|
||||
id => 1
|
||||
course_id => 1
|
||||
name => Ruby Developer
|
||||
3
activerecord/test/fixtures/entrants/second
vendored
3
activerecord/test/fixtures/entrants/second
vendored
@@ -1,3 +0,0 @@
|
||||
id => 2
|
||||
course_id => 1
|
||||
name => Ruby Guru
|
||||
3
activerecord/test/fixtures/entrants/third
vendored
3
activerecord/test/fixtures/entrants/third
vendored
@@ -1,3 +0,0 @@
|
||||
id => 3
|
||||
course_id => 2
|
||||
name => Java Lover
|
||||
7
activerecord/test/fixtures/movies.yml
vendored
Normal file
7
activerecord/test/fixtures/movies.yml
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
first:
|
||||
movieid: 1
|
||||
name: Terminator
|
||||
|
||||
second:
|
||||
movieid: 2
|
||||
name: Gladiator
|
||||
2
activerecord/test/fixtures/movies/first
vendored
2
activerecord/test/fixtures/movies/first
vendored
@@ -1,2 +0,0 @@
|
||||
movieid => 1
|
||||
name => Terminator
|
||||
2
activerecord/test/fixtures/movies/second
vendored
2
activerecord/test/fixtures/movies/second
vendored
@@ -1,2 +0,0 @@
|
||||
movieid => 2
|
||||
name => Gladiator
|
||||
7
activerecord/test/fixtures/projects.yml
vendored
Normal file
7
activerecord/test/fixtures/projects.yml
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
action_controller:
|
||||
id: 2
|
||||
name: Active Controller
|
||||
|
||||
active_record:
|
||||
id: 1
|
||||
name: Active Record
|
||||
@@ -1,2 +0,0 @@
|
||||
id => 2
|
||||
name => Active Controller
|
||||
@@ -1,2 +0,0 @@
|
||||
id => 1
|
||||
name => Active Record
|
||||
21
activerecord/test/fixtures/topics.yml
vendored
Normal file
21
activerecord/test/fixtures/topics.yml
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
first:
|
||||
id: 1
|
||||
title: The First Topic
|
||||
author_name: David
|
||||
author_email_address: david@loudthinking.com
|
||||
written_on: 2003-07-16 15:28:00
|
||||
bonus_time: 12:13:14
|
||||
last_read: 2004-04-15
|
||||
content: Have a nice day
|
||||
approved: 0
|
||||
replies_count: 0
|
||||
|
||||
second:
|
||||
id: 2
|
||||
title: The Second Topic's of the day
|
||||
author_name: Mary
|
||||
written_on: 2003-07-15 15:28:00
|
||||
content: Have a great day!
|
||||
approved: 1
|
||||
replies_count: 2
|
||||
parent_id: 1
|
||||
10
activerecord/test/fixtures/topics/first
vendored
10
activerecord/test/fixtures/topics/first
vendored
@@ -1,10 +0,0 @@
|
||||
id => 1
|
||||
title => The First Topic
|
||||
author_name => David
|
||||
author_email_address => david@loudthinking.com
|
||||
written_on => 2003-07-16 15:28
|
||||
bonus_time => 12:13:14
|
||||
last_read => 2004-04-15
|
||||
content => Have a nice day
|
||||
approved => 0
|
||||
replies_count => 0
|
||||
8
activerecord/test/fixtures/topics/second
vendored
8
activerecord/test/fixtures/topics/second
vendored
@@ -1,8 +0,0 @@
|
||||
id => 2
|
||||
title => The Second Topic's of the day
|
||||
author_name => Mary
|
||||
written_on => 2003-07-15 15:28
|
||||
content => Have a great day!
|
||||
approved => 1
|
||||
replies_count => 2
|
||||
parent_id => 1
|
||||
Reference in New Issue
Block a user