diff options
Diffstat (limited to 'actionpack/test/fixtures')
-rw-r--r-- | actionpack/test/fixtures/companies.yml | 24 | ||||
-rw-r--r-- | actionpack/test/fixtures/company.rb | 9 | ||||
-rw-r--r-- | actionpack/test/fixtures/db_definitions/sqlite.sql | 42 | ||||
-rw-r--r-- | actionpack/test/fixtures/developer.rb | 7 | ||||
-rw-r--r-- | actionpack/test/fixtures/developers.yml | 21 | ||||
-rw-r--r-- | actionpack/test/fixtures/developers_projects.yml | 13 | ||||
-rw-r--r-- | actionpack/test/fixtures/project.rb | 3 | ||||
-rw-r--r-- | actionpack/test/fixtures/projects.yml | 7 | ||||
-rw-r--r-- | actionpack/test/fixtures/replies.yml | 13 | ||||
-rw-r--r-- | actionpack/test/fixtures/reply.rb | 5 | ||||
-rw-r--r-- | actionpack/test/fixtures/topic.rb | 3 | ||||
-rw-r--r-- | actionpack/test/fixtures/topics.yml | 22 |
12 files changed, 169 insertions, 0 deletions
diff --git a/actionpack/test/fixtures/companies.yml b/actionpack/test/fixtures/companies.yml new file mode 100644 index 0000000000..707f72abc6 --- /dev/null +++ b/actionpack/test/fixtures/companies.yml @@ -0,0 +1,24 @@ +thirty_seven_signals: + id: 1 + name: 37Signals + rating: 4 + +TextDrive: + id: 2 + name: TextDrive + rating: 4 + +PlanetArgon: + id: 3 + name: Planet Argon + rating: 4 + +Google: + id: 4 + name: Google + rating: 4 + +Ionist: + id: 5 + name: Ioni.st + rating: 4
\ No newline at end of file diff --git a/actionpack/test/fixtures/company.rb b/actionpack/test/fixtures/company.rb new file mode 100644 index 0000000000..0d1c29b906 --- /dev/null +++ b/actionpack/test/fixtures/company.rb @@ -0,0 +1,9 @@ +class Company < ActiveRecord::Base + attr_protected :rating + set_sequence_name :companies_nonstd_seq + + validates_presence_of :name + def validate + errors.add('rating', 'rating should not be 2') if rating == 2 + end +end
\ No newline at end of file diff --git a/actionpack/test/fixtures/db_definitions/sqlite.sql b/actionpack/test/fixtures/db_definitions/sqlite.sql new file mode 100644 index 0000000000..b4e7539d16 --- /dev/null +++ b/actionpack/test/fixtures/db_definitions/sqlite.sql @@ -0,0 +1,42 @@ +CREATE TABLE 'companies' ( + 'id' INTEGER PRIMARY KEY NOT NULL, + 'name' TEXT DEFAULT NULL, + 'rating' INTEGER DEFAULT 1 +); + +CREATE TABLE 'replies' ( + 'id' INTEGER PRIMARY KEY NOT NULL, + 'content' text, + 'created_at' datetime, + 'updated_at' datetime, + 'topic_id' integer +); + +CREATE TABLE 'topics' ( + 'id' INTEGER PRIMARY KEY NOT NULL, + 'title' varchar(255), + 'subtitle' varchar(255), + 'content' text, + 'created_at' datetime, + 'updated_at' datetime +); + +CREATE TABLE 'developers' ( + 'id' INTEGER PRIMARY KEY NOT NULL, + 'name' TEXT DEFAULT NULL, + 'salary' INTEGER DEFAULT 70000, + 'created_at' DATETIME DEFAULT NULL, + 'updated_at' DATETIME DEFAULT NULL +); + +CREATE TABLE 'projects' ( + 'id' INTEGER PRIMARY KEY NOT NULL, + 'name' TEXT DEFAULT NULL +); + +CREATE TABLE 'developers_projects' ( + 'developer_id' INTEGER NOT NULL, + 'project_id' INTEGER NOT NULL, + 'joined_on' DATE DEFAULT NULL, + 'access_level' INTEGER DEFAULT 1 +); diff --git a/actionpack/test/fixtures/developer.rb b/actionpack/test/fixtures/developer.rb new file mode 100644 index 0000000000..f5e5b901fd --- /dev/null +++ b/actionpack/test/fixtures/developer.rb @@ -0,0 +1,7 @@ +class Developer < ActiveRecord::Base + has_and_belongs_to_many :projects +end + +class DeVeLoPeR < ActiveRecord::Base + set_table_name "developers" +end diff --git a/actionpack/test/fixtures/developers.yml b/actionpack/test/fixtures/developers.yml new file mode 100644 index 0000000000..308bf75de2 --- /dev/null +++ b/actionpack/test/fixtures/developers.yml @@ -0,0 +1,21 @@ +david: + id: 1 + name: David + salary: 80000 + +jamis: + id: 2 + name: Jamis + salary: 150000 + +<% for digit in 3..10 %> +dev_<%= digit %>: + id: <%= digit %> + name: fixture_<%= digit %> + salary: 100000 +<% end %> + +poor_jamis: + id: 11 + name: Jamis + salary: 9000
\ No newline at end of file diff --git a/actionpack/test/fixtures/developers_projects.yml b/actionpack/test/fixtures/developers_projects.yml new file mode 100644 index 0000000000..cee359c7cf --- /dev/null +++ b/actionpack/test/fixtures/developers_projects.yml @@ -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
\ No newline at end of file diff --git a/actionpack/test/fixtures/project.rb b/actionpack/test/fixtures/project.rb new file mode 100644 index 0000000000..2b53d39ed5 --- /dev/null +++ b/actionpack/test/fixtures/project.rb @@ -0,0 +1,3 @@ +class Project < ActiveRecord::Base + has_and_belongs_to_many :developers, :uniq => true +end diff --git a/actionpack/test/fixtures/projects.yml b/actionpack/test/fixtures/projects.yml new file mode 100644 index 0000000000..02800c7824 --- /dev/null +++ b/actionpack/test/fixtures/projects.yml @@ -0,0 +1,7 @@ +action_controller: + id: 2 + name: Active Controller + +active_record: + id: 1 + name: Active Record diff --git a/actionpack/test/fixtures/replies.yml b/actionpack/test/fixtures/replies.yml new file mode 100644 index 0000000000..284c9c0796 --- /dev/null +++ b/actionpack/test/fixtures/replies.yml @@ -0,0 +1,13 @@ +witty_retort: + id: 1 + topic_id: 1 + content: Birdman is better! + created_at: <%= 6.hours.ago.to_s(:db) %> + updated_at: nil + +another: + id: 2 + topic_id: 2 + content: Nuh uh! + created_at: <%= 1.hour.ago.to_s(:db) %> + updated_at: nil
\ No newline at end of file diff --git a/actionpack/test/fixtures/reply.rb b/actionpack/test/fixtures/reply.rb new file mode 100644 index 0000000000..ea84042b9a --- /dev/null +++ b/actionpack/test/fixtures/reply.rb @@ -0,0 +1,5 @@ +class Reply < ActiveRecord::Base + belongs_to :topic, :include => [:replies] + + validates_presence_of :content +end diff --git a/actionpack/test/fixtures/topic.rb b/actionpack/test/fixtures/topic.rb new file mode 100644 index 0000000000..0929de7e08 --- /dev/null +++ b/actionpack/test/fixtures/topic.rb @@ -0,0 +1,3 @@ +class Topic < ActiveRecord::Base + has_many :replies, :include => [:user], :dependent => true +end
\ No newline at end of file diff --git a/actionpack/test/fixtures/topics.yml b/actionpack/test/fixtures/topics.yml new file mode 100644 index 0000000000..61ea02d76f --- /dev/null +++ b/actionpack/test/fixtures/topics.yml @@ -0,0 +1,22 @@ +futurama: + id: 1 + title: Isnt futurama awesome? + subtitle: It really is, isnt it. + content: I like futurama + created_at: <%= 1.day.ago.to_s(:db) %> + updated_at: + +harvey_birdman: + id: 2 + title: Harvey Birdman is the king of all men + subtitle: yup + content: It really is + created_at: <%= 2.hours.ago.to_s(:db) %> + updated_at: + +rails: + id: 3 + title: Rails is nice + subtitle: It makes me happy + content: except when I have to hack internals to fix pagination. even then really. + created_at: <%= 20.minutes.ago.to_s(:db) %> |