Changesets can be listed by changeset number.
The Git repository is here.
- Revision:
- 373
- Log:
Initial import of Radiant 0.9.1, which is now packaged as a gem. This is an
import of the tagged 0.9.1 source checked out from GitHub, which isn't quite
the same as the gem distribution - but it doesn't seem to be available in an
archived form and the installed gem already has modifications, so this is
the closest I can get.
- Author:
- rool
- Date:
- Mon Mar 21 13:40:05 +0000 2011
- Size:
- 1921 Bytes
1 | require 'cases/helper' |
2 | |
3 | class MyReader < ActiveRecord::Base |
4 | has_and_belongs_to_many :my_books |
5 | end |
6 | |
7 | class MyBook < ActiveRecord::Base |
8 | has_and_belongs_to_many :my_readers |
9 | end |
10 | |
11 | class HabtmJoinTableTest < ActiveRecord::TestCase |
12 | def setup |
13 | ActiveRecord::Base.connection.create_table :my_books, :force => true do |t| |
14 | t.string :name |
15 | end |
16 | assert ActiveRecord::Base.connection.table_exists?(:my_books) |
17 | |
18 | ActiveRecord::Base.connection.create_table :my_readers, :force => true do |t| |
19 | t.string :name |
20 | end |
21 | assert ActiveRecord::Base.connection.table_exists?(:my_readers) |
22 | |
23 | ActiveRecord::Base.connection.create_table :my_books_my_readers, :force => true do |t| |
24 | t.integer :my_book_id |
25 | t.integer :my_reader_id |
26 | end |
27 | assert ActiveRecord::Base.connection.table_exists?(:my_books_my_readers) |
28 | end |
29 | |
30 | def teardown |
31 | ActiveRecord::Base.connection.drop_table :my_books |
32 | ActiveRecord::Base.connection.drop_table :my_readers |
33 | ActiveRecord::Base.connection.drop_table :my_books_my_readers |
34 | end |
35 | |
36 | uses_transaction :test_should_raise_exception_when_join_table_has_a_primary_key |
37 | def test_should_raise_exception_when_join_table_has_a_primary_key |
38 | if ActiveRecord::Base.connection.supports_primary_key? |
39 | assert_raise ActiveRecord::ConfigurationError do |
40 | jaime = MyReader.create(:name=>"Jaime") |
41 | jaime.my_books << MyBook.create(:name=>'Great Expectations') |
42 | end |
43 | end |
44 | end |
45 | |
46 | uses_transaction :test_should_cache_result_of_primary_key_check |
47 | def test_should_cache_result_of_primary_key_check |
48 | if ActiveRecord::Base.connection.supports_primary_key? |
49 | ActiveRecord::Base.connection.stubs(:primary_key).with('my_books_my_readers').returns(false).once |
50 | weaz = MyReader.create(:name=>'Weaz') |
51 | |
52 | weaz.my_books << MyBook.create(:name=>'Great Expectations') |
53 | weaz.my_books << MyBook.create(:name=>'Greater Expectations') |
54 | end |
55 | end |
56 | end |