From adb917a0d883ede5e1da1208077420cda978fdd2 Mon Sep 17 00:00:00 2001 From: Alexey Muranov Date: Mon, 19 Dec 2011 16:07:02 +0100 Subject: Fix a fixtures test case with table prefix/suffix Make sure the table name of a model is reset in a test case after assigning ActiveRecord::Base.table_name_prefix and ActiveRecord::Base.table_name_suffix. This was somebody else's test case, so an independent opinion on the change can be helpful. --- activerecord/test/fixtures/other_topics.yml | 42 +++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 activerecord/test/fixtures/other_topics.yml (limited to 'activerecord/test/fixtures') diff --git a/activerecord/test/fixtures/other_topics.yml b/activerecord/test/fixtures/other_topics.yml new file mode 100644 index 0000000000..93f48aedc4 --- /dev/null +++ b/activerecord/test/fixtures/other_topics.yml @@ -0,0 +1,42 @@ +first: + id: 1 + title: The First Topic + author_name: David + author_email_address: david@loudthinking.com + written_on: 2003-07-16t15:28:11.2233+01:00 + last_read: 2004-04-15 + bonus_time: 2005-01-30t15:28:00.00+01:00 + content: Have a nice day + approved: false + replies_count: 1 + +second: + id: 2 + title: The Second Topic of the day + author_name: Mary + written_on: 2004-07-15t15:28:00.0099+01:00 + content: Have a nice day + approved: true + replies_count: 0 + parent_id: 1 + type: Reply + +third: + id: 3 + title: The Third Topic of the day + author_name: Carl + written_on: 2005-07-15t15:28:00.0099+01:00 + content: I'm a troll + approved: true + replies_count: 1 + +fourth: + id: 4 + title: The Fourth Topic of the day + author_name: Carl + written_on: 2006-07-15t15:28:00.0099+01:00 + content: Why not? + approved: true + type: Reply + parent_id: 3 + -- cgit v1.2.3 From 91681c281b0693d376342e3cc1ebeb86449ef197 Mon Sep 17 00:00:00 2001 From: Jon Leighton Date: Thu, 22 Dec 2011 17:04:01 +0000 Subject: Revert "Merge pull request #4114 from alexeymuranov/my_fix_for_prefix_suffix_fixtures_test" This reverts commit f8e484d0f71114675ed04e987914d3f2815cb868, reversing changes made to fa5adfb1e884bf21a7071ade634a820e37ac4db4. Reason: broke the postgres tests. --- activerecord/test/fixtures/other_topics.yml | 42 ----------------------------- 1 file changed, 42 deletions(-) delete mode 100644 activerecord/test/fixtures/other_topics.yml (limited to 'activerecord/test/fixtures') diff --git a/activerecord/test/fixtures/other_topics.yml b/activerecord/test/fixtures/other_topics.yml deleted file mode 100644 index 93f48aedc4..0000000000 --- a/activerecord/test/fixtures/other_topics.yml +++ /dev/null @@ -1,42 +0,0 @@ -first: - id: 1 - title: The First Topic - author_name: David - author_email_address: david@loudthinking.com - written_on: 2003-07-16t15:28:11.2233+01:00 - last_read: 2004-04-15 - bonus_time: 2005-01-30t15:28:00.00+01:00 - content: Have a nice day - approved: false - replies_count: 1 - -second: - id: 2 - title: The Second Topic of the day - author_name: Mary - written_on: 2004-07-15t15:28:00.0099+01:00 - content: Have a nice day - approved: true - replies_count: 0 - parent_id: 1 - type: Reply - -third: - id: 3 - title: The Third Topic of the day - author_name: Carl - written_on: 2005-07-15t15:28:00.0099+01:00 - content: I'm a troll - approved: true - replies_count: 1 - -fourth: - id: 4 - title: The Fourth Topic of the day - author_name: Carl - written_on: 2006-07-15t15:28:00.0099+01:00 - content: Why not? - approved: true - type: Reply - parent_id: 3 - -- cgit v1.2.3 From 649869557a9592af5767b0ad3ae65d84fa0c0eb9 Mon Sep 17 00:00:00 2001 From: Jon Leighton Date: Fri, 23 Dec 2011 21:47:58 +0000 Subject: Fixtures support for ActiveRecord::Model --- activerecord/test/fixtures/teapots.yml | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 activerecord/test/fixtures/teapots.yml (limited to 'activerecord/test/fixtures') diff --git a/activerecord/test/fixtures/teapots.yml b/activerecord/test/fixtures/teapots.yml new file mode 100644 index 0000000000..ff515beb45 --- /dev/null +++ b/activerecord/test/fixtures/teapots.yml @@ -0,0 +1,3 @@ +bob: + id: 1 + name: Bob -- cgit v1.2.3 From ae8bb118427780828134cfaf92a9515e9a5c1671 Mon Sep 17 00:00:00 2001 From: Alexey Muranov Date: Mon, 19 Dec 2011 16:07:02 +0100 Subject: Fix a fixtures test case with table prefix/suffix Make sure the table name of a model is reset in a test case after assigning ActiveRecord::Base.table_name_prefix and ActiveRecord::Base.table_name_suffix. --- activerecord/test/fixtures/other_topics.yml | 42 +++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 activerecord/test/fixtures/other_topics.yml (limited to 'activerecord/test/fixtures') diff --git a/activerecord/test/fixtures/other_topics.yml b/activerecord/test/fixtures/other_topics.yml new file mode 100644 index 0000000000..93f48aedc4 --- /dev/null +++ b/activerecord/test/fixtures/other_topics.yml @@ -0,0 +1,42 @@ +first: + id: 1 + title: The First Topic + author_name: David + author_email_address: david@loudthinking.com + written_on: 2003-07-16t15:28:11.2233+01:00 + last_read: 2004-04-15 + bonus_time: 2005-01-30t15:28:00.00+01:00 + content: Have a nice day + approved: false + replies_count: 1 + +second: + id: 2 + title: The Second Topic of the day + author_name: Mary + written_on: 2004-07-15t15:28:00.0099+01:00 + content: Have a nice day + approved: true + replies_count: 0 + parent_id: 1 + type: Reply + +third: + id: 3 + title: The Third Topic of the day + author_name: Carl + written_on: 2005-07-15t15:28:00.0099+01:00 + content: I'm a troll + approved: true + replies_count: 1 + +fourth: + id: 4 + title: The Fourth Topic of the day + author_name: Carl + written_on: 2006-07-15t15:28:00.0099+01:00 + content: Why not? + approved: true + type: Reply + parent_id: 3 + -- cgit v1.2.3 From 6468ff41971b69be9c02f33d05e94e4f8845266b Mon Sep 17 00:00:00 2001 From: Alexey Muranov Date: Mon, 19 Dec 2011 16:00:24 +0100 Subject: Test fixtures with custom model and table names Test using fixtures with random names and model names, that is not following naming conventions but using set_fixture_class instead. It is expected that the table name be defined in the model, but this is not explicitly tested here. This will need to be fixed. --- activerecord/test/fixtures/admin/randomly_named_a9.yml | 7 +++++++ activerecord/test/fixtures/admin/randomly_named_b0.yml | 7 +++++++ activerecord/test/fixtures/randomly_named_a9.yml | 7 +++++++ 3 files changed, 21 insertions(+) create mode 100644 activerecord/test/fixtures/admin/randomly_named_a9.yml create mode 100644 activerecord/test/fixtures/admin/randomly_named_b0.yml create mode 100644 activerecord/test/fixtures/randomly_named_a9.yml (limited to 'activerecord/test/fixtures') diff --git a/activerecord/test/fixtures/admin/randomly_named_a9.yml b/activerecord/test/fixtures/admin/randomly_named_a9.yml new file mode 100644 index 0000000000..bc51c83112 --- /dev/null +++ b/activerecord/test/fixtures/admin/randomly_named_a9.yml @@ -0,0 +1,7 @@ +first_instance: + some_attribute: AAA + another_attribute: 000 + +second_instance: + some_attribute: BBB + another_attribute: 999 diff --git a/activerecord/test/fixtures/admin/randomly_named_b0.yml b/activerecord/test/fixtures/admin/randomly_named_b0.yml new file mode 100644 index 0000000000..bc51c83112 --- /dev/null +++ b/activerecord/test/fixtures/admin/randomly_named_b0.yml @@ -0,0 +1,7 @@ +first_instance: + some_attribute: AAA + another_attribute: 000 + +second_instance: + some_attribute: BBB + another_attribute: 999 diff --git a/activerecord/test/fixtures/randomly_named_a9.yml b/activerecord/test/fixtures/randomly_named_a9.yml new file mode 100644 index 0000000000..bc51c83112 --- /dev/null +++ b/activerecord/test/fixtures/randomly_named_a9.yml @@ -0,0 +1,7 @@ +first_instance: + some_attribute: AAA + another_attribute: 000 + +second_instance: + some_attribute: BBB + another_attribute: 999 -- cgit v1.2.3