my_annotations 0.5.0 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +6 -0
 - data/.rvmrc +1 -0
 - data/AUTHORS.rdoc +5 -0
 - data/CHANGELOG.rdoc +64 -0
 - data/INDEX.rdoc +17 -0
 - data/generators/annotations_migration/annotations_migration_generator.rb +32 -0
 - data/generators/annotations_migration/templates/migration_v1.rb +60 -0
 - data/generators/annotations_migration/templates/migration_v2.rb +9 -0
 - data/generators/annotations_migration/templates/migration_v3.rb +74 -0
 - data/generators/annotations_migration/templates/migration_v4.rb +13 -0
 - data/install.rb +1 -0
 - data/lib/annotations/acts_as_annotatable.rb +271 -0
 - data/lib/annotations/acts_as_annotation_source.rb +117 -0
 - data/lib/annotations/acts_as_annotation_value.rb +115 -0
 - data/lib/annotations/config.rb +148 -0
 - data/lib/annotations/routing.rb +8 -0
 - data/lib/annotations/util.rb +82 -0
 - data/lib/annotations_version_fu.rb +119 -0
 - data/lib/app/controllers/annotations_controller.rb +162 -0
 - data/lib/app/controllers/application_controller.rb +2 -0
 - data/lib/app/helpers/application_helper.rb +2 -0
 - data/lib/app/models/annotation.rb +413 -0
 - data/lib/app/models/annotation_attribute.rb +37 -0
 - data/lib/app/models/annotation_value_seed.rb +48 -0
 - data/lib/app/models/number_value.rb +23 -0
 - data/lib/app/models/text_value.rb +23 -0
 - data/my_annotations.gemspec +4 -9
 - data/rails/init.rb +8 -0
 - data/test/acts_as_annotatable_test.rb +186 -0
 - data/test/acts_as_annotation_source_test.rb +84 -0
 - data/test/acts_as_annotation_value_test.rb +17 -0
 - data/test/annotation_attribute_test.rb +22 -0
 - data/test/annotation_test.rb +213 -0
 - data/test/annotation_value_seed_test.rb +14 -0
 - data/test/annotation_version_test.rb +39 -0
 - data/test/annotations_controller_test.rb +27 -0
 - data/test/app_root/app/controllers/application_controller.rb +9 -0
 - data/test/app_root/app/models/book.rb +5 -0
 - data/test/app_root/app/models/chapter.rb +5 -0
 - data/test/app_root/app/models/group.rb +3 -0
 - data/test/app_root/app/models/tag.rb +6 -0
 - data/test/app_root/app/models/user.rb +3 -0
 - data/test/app_root/app/views/annotations/edit.html.erb +12 -0
 - data/test/app_root/app/views/annotations/index.html.erb +1 -0
 - data/test/app_root/app/views/annotations/new.html.erb +11 -0
 - data/test/app_root/app/views/annotations/show.html.erb +3 -0
 - data/test/app_root/config/boot.rb +115 -0
 - data/test/app_root/config/environment.rb +16 -0
 - data/test/app_root/config/environments/mysql.rb +0 -0
 - data/test/app_root/config/routes.rb +4 -0
 - data/test/app_root/db/migrate/001_create_test_models.rb +38 -0
 - data/test/app_root/db/migrate/002_annotations_migration_v1.rb +60 -0
 - data/test/app_root/db/migrate/003_annotations_migration_v2.rb +9 -0
 - data/test/app_root/db/migrate/004_annotations_migration_v3.rb +72 -0
 - data/test/config_test.rb +383 -0
 - data/test/fixtures/annotation_attributes.yml +49 -0
 - data/test/fixtures/annotation_value_seeds.csv +16 -0
 - data/test/fixtures/annotation_versions.yml +259 -0
 - data/test/fixtures/annotations.yml +239 -0
 - data/test/fixtures/books.yml +13 -0
 - data/test/fixtures/chapters.yml +27 -0
 - data/test/fixtures/groups.yml +7 -0
 - data/test/fixtures/number_value_versions.csv +2 -0
 - data/test/fixtures/number_values.csv +2 -0
 - data/test/fixtures/text_value_versions.csv +35 -0
 - data/test/fixtures/text_values.csv +35 -0
 - data/test/fixtures/users.yml +8 -0
 - data/test/number_value_version_test.rb +40 -0
 - data/test/routing_test.rb +27 -0
 - data/test/test_helper.rb +41 -0
 - data/test/text_value_version_test.rb +40 -0
 - metadata +77 -7
 
| 
         @@ -0,0 +1,239 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            bh_summary_1:
         
     | 
| 
      
 2 
     | 
    
         
            +
              annotatable_type: Book
         
     | 
| 
      
 3 
     | 
    
         
            +
              annotatable_id: 1
         
     | 
| 
      
 4 
     | 
    
         
            +
              attribute_id: 2
         
     | 
| 
      
 5 
     | 
    
         
            +
              value_type: TextValue
         
     | 
| 
      
 6 
     | 
    
         
            +
              value_id: 16
         
     | 
| 
      
 7 
     | 
    
         
            +
              source_type: User
         
     | 
| 
      
 8 
     | 
    
         
            +
              source_id: 1
         
     | 
| 
      
 9 
     | 
    
         
            +
              version: 1
         
     | 
| 
      
 10 
     | 
    
         
            +
              created_at: <%= 1.minute.ago.to_s(:db) %>
         
     | 
| 
      
 11 
     | 
    
         
            +
              updated_at: <%= 1.minute.ago.to_s(:db) %>
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
            bh_length_1:
         
     | 
| 
      
 14 
     | 
    
         
            +
              annotatable_type: Book
         
     | 
| 
      
 15 
     | 
    
         
            +
              annotatable_id: 1
         
     | 
| 
      
 16 
     | 
    
         
            +
              attribute_id: 3
         
     | 
| 
      
 17 
     | 
    
         
            +
              value_type: NumberValue
         
     | 
| 
      
 18 
     | 
    
         
            +
              value_id: 1
         
     | 
| 
      
 19 
     | 
    
         
            +
              source_type: Group
         
     | 
| 
      
 20 
     | 
    
         
            +
              source_id: 2
         
     | 
| 
      
 21 
     | 
    
         
            +
              version: 1
         
     | 
| 
      
 22 
     | 
    
         
            +
              created_at: <%= 1.minute.ago.to_s(:db) %>
         
     | 
| 
      
 23 
     | 
    
         
            +
              updated_at: <%= 1.minute.ago.to_s(:db) %>
         
     | 
| 
      
 24 
     | 
    
         
            +
              
         
     | 
| 
      
 25 
     | 
    
         
            +
            bh_title_1:
         
     | 
| 
      
 26 
     | 
    
         
            +
              annotatable_type: Book
         
     | 
| 
      
 27 
     | 
    
         
            +
              annotatable_id: 1
         
     | 
| 
      
 28 
     | 
    
         
            +
              attribute_id: 4
         
     | 
| 
      
 29 
     | 
    
         
            +
              value_type: TextValue
         
     | 
| 
      
 30 
     | 
    
         
            +
              value_id: 17
         
     | 
| 
      
 31 
     | 
    
         
            +
              source_type: User
         
     | 
| 
      
 32 
     | 
    
         
            +
              source_id: 1
         
     | 
| 
      
 33 
     | 
    
         
            +
              version: 1
         
     | 
| 
      
 34 
     | 
    
         
            +
              created_at: <%= 1.minute.ago.to_s(:db) %>
         
     | 
| 
      
 35 
     | 
    
         
            +
              updated_at: <%= 1.minute.ago.to_s(:db) %>
         
     | 
| 
      
 36 
     | 
    
         
            +
             
     | 
| 
      
 37 
     | 
    
         
            +
            bh_rating_1:
         
     | 
| 
      
 38 
     | 
    
         
            +
              annotatable_type: Book
         
     | 
| 
      
 39 
     | 
    
         
            +
              annotatable_id: 1
         
     | 
| 
      
 40 
     | 
    
         
            +
              attribute_id: 9
         
     | 
| 
      
 41 
     | 
    
         
            +
              value_type: TextValue
         
     | 
| 
      
 42 
     | 
    
         
            +
              value_id: 18
         
     | 
| 
      
 43 
     | 
    
         
            +
              source_type: User
         
     | 
| 
      
 44 
     | 
    
         
            +
              source_id: 2
         
     | 
| 
      
 45 
     | 
    
         
            +
              version: 1
         
     | 
| 
      
 46 
     | 
    
         
            +
              created_at: <%= 1.minute.ago.to_s(:db) %>
         
     | 
| 
      
 47 
     | 
    
         
            +
              updated_at: <%= 1.minute.ago.to_s(:db) %>
         
     | 
| 
      
 48 
     | 
    
         
            +
             
     | 
| 
      
 49 
     | 
    
         
            +
            bh_tag_1:
         
     | 
| 
      
 50 
     | 
    
         
            +
              annotatable_type: Book
         
     | 
| 
      
 51 
     | 
    
         
            +
              annotatable_id: 1
         
     | 
| 
      
 52 
     | 
    
         
            +
              attribute_id: 1
         
     | 
| 
      
 53 
     | 
    
         
            +
              value_type: TextValue
         
     | 
| 
      
 54 
     | 
    
         
            +
              value_id: 19
         
     | 
| 
      
 55 
     | 
    
         
            +
              source_type: Group
         
     | 
| 
      
 56 
     | 
    
         
            +
              source_id: 2
         
     | 
| 
      
 57 
     | 
    
         
            +
              version: 1
         
     | 
| 
      
 58 
     | 
    
         
            +
              created_at: <%= 1.minute.ago.to_s(:db) %>
         
     | 
| 
      
 59 
     | 
    
         
            +
              updated_at: <%= 1.minute.ago.to_s(:db) %>
         
     | 
| 
      
 60 
     | 
    
         
            +
             
     | 
| 
      
 61 
     | 
    
         
            +
            bh_tag_2:
         
     | 
| 
      
 62 
     | 
    
         
            +
              annotatable_type: Book
         
     | 
| 
      
 63 
     | 
    
         
            +
              annotatable_id: 1
         
     | 
| 
      
 64 
     | 
    
         
            +
              attribute_id: 1
         
     | 
| 
      
 65 
     | 
    
         
            +
              value_type: TextValue
         
     | 
| 
      
 66 
     | 
    
         
            +
              value_id: 20
         
     | 
| 
      
 67 
     | 
    
         
            +
              source_type: User
         
     | 
| 
      
 68 
     | 
    
         
            +
              source_id: 2
         
     | 
| 
      
 69 
     | 
    
         
            +
              version: 1
         
     | 
| 
      
 70 
     | 
    
         
            +
              created_at: <%= 1.minute.ago.to_s(:db) %>
         
     | 
| 
      
 71 
     | 
    
         
            +
              updated_at: <%= 1.minute.ago.to_s(:db) %>
         
     | 
| 
      
 72 
     | 
    
         
            +
             
     | 
| 
      
 73 
     | 
    
         
            +
            br_summary_1:
         
     | 
| 
      
 74 
     | 
    
         
            +
              annotatable_type: Book
         
     | 
| 
      
 75 
     | 
    
         
            +
              annotatable_id: 2
         
     | 
| 
      
 76 
     | 
    
         
            +
              attribute_id: 2
         
     | 
| 
      
 77 
     | 
    
         
            +
              value_type: TextValue
         
     | 
| 
      
 78 
     | 
    
         
            +
              value_id: 21
         
     | 
| 
      
 79 
     | 
    
         
            +
              source_type: User
         
     | 
| 
      
 80 
     | 
    
         
            +
              source_id: 1
         
     | 
| 
      
 81 
     | 
    
         
            +
              version: 1
         
     | 
| 
      
 82 
     | 
    
         
            +
              created_at: <%= 1.minute.ago.to_s(:db) %>
         
     | 
| 
      
 83 
     | 
    
         
            +
              updated_at: <%= 1.minute.ago.to_s(:db) %>
         
     | 
| 
      
 84 
     | 
    
         
            +
              
         
     | 
| 
      
 85 
     | 
    
         
            +
            br_summary_2:
         
     | 
| 
      
 86 
     | 
    
         
            +
              annotatable_type: Book
         
     | 
| 
      
 87 
     | 
    
         
            +
              annotatable_id: 2
         
     | 
| 
      
 88 
     | 
    
         
            +
              attribute_id: 2
         
     | 
| 
      
 89 
     | 
    
         
            +
              value_type: TextValue
         
     | 
| 
      
 90 
     | 
    
         
            +
              value_id: 22
         
     | 
| 
      
 91 
     | 
    
         
            +
              source_type: Group
         
     | 
| 
      
 92 
     | 
    
         
            +
              source_id: 1
         
     | 
| 
      
 93 
     | 
    
         
            +
              version: 1
         
     | 
| 
      
 94 
     | 
    
         
            +
              created_at: <%= 1.minute.ago.to_s(:db) %>
         
     | 
| 
      
 95 
     | 
    
         
            +
              updated_at: <%= 1.minute.ago.to_s(:db) %>
         
     | 
| 
      
 96 
     | 
    
         
            +
              
         
     | 
| 
      
 97 
     | 
    
         
            +
            br_author_1:
         
     | 
| 
      
 98 
     | 
    
         
            +
              annotatable_type: Book
         
     | 
| 
      
 99 
     | 
    
         
            +
              annotatable_id: 2
         
     | 
| 
      
 100 
     | 
    
         
            +
              attribute_id: 8
         
     | 
| 
      
 101 
     | 
    
         
            +
              value_type: TextValue
         
     | 
| 
      
 102 
     | 
    
         
            +
              value_id: 23
         
     | 
| 
      
 103 
     | 
    
         
            +
              source_type: User
         
     | 
| 
      
 104 
     | 
    
         
            +
              source_id: 1
         
     | 
| 
      
 105 
     | 
    
         
            +
              version: 1
         
     | 
| 
      
 106 
     | 
    
         
            +
              created_at: <%= 1.minute.ago.to_s(:db) %>
         
     | 
| 
      
 107 
     | 
    
         
            +
              updated_at: <%= 1.minute.ago.to_s(:db) %>
         
     | 
| 
      
 108 
     | 
    
         
            +
              
         
     | 
| 
      
 109 
     | 
    
         
            +
            br_tag_1:
         
     | 
| 
      
 110 
     | 
    
         
            +
              annotatable_type: Book
         
     | 
| 
      
 111 
     | 
    
         
            +
              annotatable_id: 2
         
     | 
| 
      
 112 
     | 
    
         
            +
              attribute_id: 1
         
     | 
| 
      
 113 
     | 
    
         
            +
              value_type: TextValue
         
     | 
| 
      
 114 
     | 
    
         
            +
              value_id: 24
         
     | 
| 
      
 115 
     | 
    
         
            +
              source_type: User
         
     | 
| 
      
 116 
     | 
    
         
            +
              source_id: 2
         
     | 
| 
      
 117 
     | 
    
         
            +
              version: 1
         
     | 
| 
      
 118 
     | 
    
         
            +
              created_at: <%= 1.minute.ago.to_s(:db) %>
         
     | 
| 
      
 119 
     | 
    
         
            +
              updated_at: <%= 1.minute.ago.to_s(:db) %>
         
     | 
| 
      
 120 
     | 
    
         
            +
              
         
     | 
| 
      
 121 
     | 
    
         
            +
            br_note_1:
         
     | 
| 
      
 122 
     | 
    
         
            +
              annotatable_type: Book
         
     | 
| 
      
 123 
     | 
    
         
            +
              annotatable_id: 2
         
     | 
| 
      
 124 
     | 
    
         
            +
              attribute_id: 7
         
     | 
| 
      
 125 
     | 
    
         
            +
              value_type: TextValue
         
     | 
| 
      
 126 
     | 
    
         
            +
              value_id: 25
         
     | 
| 
      
 127 
     | 
    
         
            +
              source_type: User
         
     | 
| 
      
 128 
     | 
    
         
            +
              source_id: 2
         
     | 
| 
      
 129 
     | 
    
         
            +
              version: 1
         
     | 
| 
      
 130 
     | 
    
         
            +
              created_at: <%= 1.minute.ago.to_s(:db) %>
         
     | 
| 
      
 131 
     | 
    
         
            +
              updated_at: <%= 1.minute.ago.to_s(:db) %>
         
     | 
| 
      
 132 
     | 
    
         
            +
             
     | 
| 
      
 133 
     | 
    
         
            +
            bh_c10_endingtype_1:  
         
     | 
| 
      
 134 
     | 
    
         
            +
              annotatable_type: Chapter
         
     | 
| 
      
 135 
     | 
    
         
            +
              annotatable_id: 2
         
     | 
| 
      
 136 
     | 
    
         
            +
              attribute_id: 6
         
     | 
| 
      
 137 
     | 
    
         
            +
              value_type: TextValue
         
     | 
| 
      
 138 
     | 
    
         
            +
              value_id: 26
         
     | 
| 
      
 139 
     | 
    
         
            +
              source_type: Group
         
     | 
| 
      
 140 
     | 
    
         
            +
              source_id: 1
         
     | 
| 
      
 141 
     | 
    
         
            +
              version: 1
         
     | 
| 
      
 142 
     | 
    
         
            +
              created_at: <%= 1.minute.ago.to_s(:db) %>
         
     | 
| 
      
 143 
     | 
    
         
            +
              updated_at: <%= 1.minute.ago.to_s(:db) %>
         
     | 
| 
      
 144 
     | 
    
         
            +
              
         
     | 
| 
      
 145 
     | 
    
         
            +
            bh_c10_title_1:  
         
     | 
| 
      
 146 
     | 
    
         
            +
              annotatable_type: Chapter
         
     | 
| 
      
 147 
     | 
    
         
            +
              annotatable_id: 2
         
     | 
| 
      
 148 
     | 
    
         
            +
              attribute_id: 4
         
     | 
| 
      
 149 
     | 
    
         
            +
              value_type: TextValue
         
     | 
| 
      
 150 
     | 
    
         
            +
              value_id: 27
         
     | 
| 
      
 151 
     | 
    
         
            +
              source_type: User
         
     | 
| 
      
 152 
     | 
    
         
            +
              source_id: 2
         
     | 
| 
      
 153 
     | 
    
         
            +
              version: 1
         
     | 
| 
      
 154 
     | 
    
         
            +
              created_at: <%= 1.minute.ago.to_s(:db) %>
         
     | 
| 
      
 155 
     | 
    
         
            +
              updated_at: <%= 1.minute.ago.to_s(:db) %>
         
     | 
| 
      
 156 
     | 
    
         
            +
              
         
     | 
| 
      
 157 
     | 
    
         
            +
            br_c2_title_1:
         
     | 
| 
      
 158 
     | 
    
         
            +
              annotatable_type: Chapter
         
     | 
| 
      
 159 
     | 
    
         
            +
              annotatable_id: 3
         
     | 
| 
      
 160 
     | 
    
         
            +
              attribute_id: 4
         
     | 
| 
      
 161 
     | 
    
         
            +
              value_type: TextValue
         
     | 
| 
      
 162 
     | 
    
         
            +
              value_id: 28
         
     | 
| 
      
 163 
     | 
    
         
            +
              source_type: User
         
     | 
| 
      
 164 
     | 
    
         
            +
              source_id: 1
         
     | 
| 
      
 165 
     | 
    
         
            +
              version: 1
         
     | 
| 
      
 166 
     | 
    
         
            +
              created_at: <%= 1.minute.ago.to_s(:db) %>
         
     | 
| 
      
 167 
     | 
    
         
            +
              updated_at: <%= 1.minute.ago.to_s(:db) %>
         
     | 
| 
      
 168 
     | 
    
         
            +
              
         
     | 
| 
      
 169 
     | 
    
         
            +
            br_c2_tag_1:
         
     | 
| 
      
 170 
     | 
    
         
            +
              annotatable_type: Chapter
         
     | 
| 
      
 171 
     | 
    
         
            +
              annotatable_id: 3
         
     | 
| 
      
 172 
     | 
    
         
            +
              attribute_id: 1
         
     | 
| 
      
 173 
     | 
    
         
            +
              value_type: TextValue
         
     | 
| 
      
 174 
     | 
    
         
            +
              value_id: 29
         
     | 
| 
      
 175 
     | 
    
         
            +
              source_type: Group
         
     | 
| 
      
 176 
     | 
    
         
            +
              source_id: 2
         
     | 
| 
      
 177 
     | 
    
         
            +
              version: 1
         
     | 
| 
      
 178 
     | 
    
         
            +
              created_at: <%= 1.minute.ago.to_s(:db) %>
         
     | 
| 
      
 179 
     | 
    
         
            +
              updated_at: <%= 1.minute.ago.to_s(:db) %>
         
     | 
| 
      
 180 
     | 
    
         
            +
              
         
     | 
| 
      
 181 
     | 
    
         
            +
            br_c2_tag_2:
         
     | 
| 
      
 182 
     | 
    
         
            +
              annotatable_type: Chapter
         
     | 
| 
      
 183 
     | 
    
         
            +
              annotatable_id: 3
         
     | 
| 
      
 184 
     | 
    
         
            +
              attribute_id: 1
         
     | 
| 
      
 185 
     | 
    
         
            +
              value_type: TextValue
         
     | 
| 
      
 186 
     | 
    
         
            +
              value_id: 30
         
     | 
| 
      
 187 
     | 
    
         
            +
              source_type: User
         
     | 
| 
      
 188 
     | 
    
         
            +
              source_id: 1
         
     | 
| 
      
 189 
     | 
    
         
            +
              version: 1
         
     | 
| 
      
 190 
     | 
    
         
            +
              created_at: <%= 1.minute.ago.to_s(:db) %>
         
     | 
| 
      
 191 
     | 
    
         
            +
              updated_at: <%= 1.minute.ago.to_s(:db) %>
         
     | 
| 
      
 192 
     | 
    
         
            +
              
         
     | 
| 
      
 193 
     | 
    
         
            +
            br_c2_title_2:
         
     | 
| 
      
 194 
     | 
    
         
            +
              annotatable_type: Chapter
         
     | 
| 
      
 195 
     | 
    
         
            +
              annotatable_id: 3
         
     | 
| 
      
 196 
     | 
    
         
            +
              attribute_id: 4
         
     | 
| 
      
 197 
     | 
    
         
            +
              value_type: TextValue
         
     | 
| 
      
 198 
     | 
    
         
            +
              value_id: 31
         
     | 
| 
      
 199 
     | 
    
         
            +
              source_type: User
         
     | 
| 
      
 200 
     | 
    
         
            +
              source_id: 2
         
     | 
| 
      
 201 
     | 
    
         
            +
              version: 1
         
     | 
| 
      
 202 
     | 
    
         
            +
              created_at: <%= 1.minute.ago.to_s(:db) %>
         
     | 
| 
      
 203 
     | 
    
         
            +
              updated_at: <%= 1.minute.ago.to_s(:db) %>
         
     | 
| 
      
 204 
     | 
    
         
            +
              
         
     | 
| 
      
 205 
     | 
    
         
            +
            br_c202_complexity_1:
         
     | 
| 
      
 206 
     | 
    
         
            +
              annotatable_type: Chapter
         
     | 
| 
      
 207 
     | 
    
         
            +
              annotatable_id: 4
         
     | 
| 
      
 208 
     | 
    
         
            +
              attribute_id: 5
         
     | 
| 
      
 209 
     | 
    
         
            +
              value_type: TextValue
         
     | 
| 
      
 210 
     | 
    
         
            +
              value_id: 32
         
     | 
| 
      
 211 
     | 
    
         
            +
              source_type: Group
         
     | 
| 
      
 212 
     | 
    
         
            +
              source_id: 1
         
     | 
| 
      
 213 
     | 
    
         
            +
              version: 1
         
     | 
| 
      
 214 
     | 
    
         
            +
              created_at: <%= 1.minute.ago.to_s(:db) %>
         
     | 
| 
      
 215 
     | 
    
         
            +
              updated_at: <%= 1.minute.ago.to_s(:db) %>
         
     | 
| 
      
 216 
     | 
    
         
            +
             
     | 
| 
      
 217 
     | 
    
         
            +
            br_c202_title_1:
         
     | 
| 
      
 218 
     | 
    
         
            +
              annotatable_type: Chapter
         
     | 
| 
      
 219 
     | 
    
         
            +
              annotatable_id: 4
         
     | 
| 
      
 220 
     | 
    
         
            +
              attribute_id: 4
         
     | 
| 
      
 221 
     | 
    
         
            +
              value_type: TextValue
         
     | 
| 
      
 222 
     | 
    
         
            +
              value_id: 33
         
     | 
| 
      
 223 
     | 
    
         
            +
              source_type: User
         
     | 
| 
      
 224 
     | 
    
         
            +
              source_id: 1
         
     | 
| 
      
 225 
     | 
    
         
            +
              version: 1
         
     | 
| 
      
 226 
     | 
    
         
            +
              created_at: <%= 1.minute.ago.to_s(:db) %>
         
     | 
| 
      
 227 
     | 
    
         
            +
              updated_at: <%= 1.minute.ago.to_s(:db) %>
         
     | 
| 
      
 228 
     | 
    
         
            +
              
         
     | 
| 
      
 229 
     | 
    
         
            +
            br_c202_tag_1:
         
     | 
| 
      
 230 
     | 
    
         
            +
              annotatable_type: Chapter
         
     | 
| 
      
 231 
     | 
    
         
            +
              annotatable_id: 4
         
     | 
| 
      
 232 
     | 
    
         
            +
              attribute_id: 1
         
     | 
| 
      
 233 
     | 
    
         
            +
              value_type: TextValue
         
     | 
| 
      
 234 
     | 
    
         
            +
              value_id: 34
         
     | 
| 
      
 235 
     | 
    
         
            +
              source_type: Group
         
     | 
| 
      
 236 
     | 
    
         
            +
              source_id: 2
         
     | 
| 
      
 237 
     | 
    
         
            +
              version: 1
         
     | 
| 
      
 238 
     | 
    
         
            +
              created_at: <%= 1.minute.ago.to_s(:db) %>
         
     | 
| 
      
 239 
     | 
    
         
            +
              updated_at: <%= 1.minute.ago.to_s(:db) %>
         
     | 
| 
         @@ -0,0 +1,13 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            h:
         
     | 
| 
      
 2 
     | 
    
         
            +
              id: 1
         
     | 
| 
      
 3 
     | 
    
         
            +
              title: Harry Pooter and the Exploding Gentlemen's Lavatory
         
     | 
| 
      
 4 
     | 
    
         
            +
              author_name: Rich Woman
         
     | 
| 
      
 5 
     | 
    
         
            +
              pub_year: 2056
         
     | 
| 
      
 6 
     | 
    
         
            +
              summary: Wonderfully delightful!
         
     | 
| 
      
 7 
     | 
    
         
            +
              
         
     | 
| 
      
 8 
     | 
    
         
            +
            r:
         
     | 
| 
      
 9 
     | 
    
         
            +
              id: 2
         
     | 
| 
      
 10 
     | 
    
         
            +
              title: Learning Ruby in 2 Seconds
         
     | 
| 
      
 11 
     | 
    
         
            +
              author_name: Too Much Time
         
     | 
| 
      
 12 
     | 
    
         
            +
              pub_year: 1854
         
     | 
| 
      
 13 
     | 
    
         
            +
              isbn: 1688HH979BLAH
         
     | 
| 
         @@ -0,0 +1,27 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            bh_c1:
         
     | 
| 
      
 2 
     | 
    
         
            +
              id: 1
         
     | 
| 
      
 3 
     | 
    
         
            +
              chapter_number: 1
         
     | 
| 
      
 4 
     | 
    
         
            +
              title: The Beginning
         
     | 
| 
      
 5 
     | 
    
         
            +
              book_id: 1
         
     | 
| 
      
 6 
     | 
    
         
            +
              
         
     | 
| 
      
 7 
     | 
    
         
            +
            bh_c10:
         
     | 
| 
      
 8 
     | 
    
         
            +
              id: 2
         
     | 
| 
      
 9 
     | 
    
         
            +
              chapter_number: 10
         
     | 
| 
      
 10 
     | 
    
         
            +
              title: The End
         
     | 
| 
      
 11 
     | 
    
         
            +
              summary: Exciting and enthralling end to a exquisite experiment in ecology
         
     | 
| 
      
 12 
     | 
    
         
            +
              book_id: 1
         
     | 
| 
      
 13 
     | 
    
         
            +
              
         
     | 
| 
      
 14 
     | 
    
         
            +
            br_c2:
         
     | 
| 
      
 15 
     | 
    
         
            +
              id: 3
         
     | 
| 
      
 16 
     | 
    
         
            +
              chapter_number: 2
         
     | 
| 
      
 17 
     | 
    
         
            +
              title: Hashing It Up
         
     | 
| 
      
 18 
     | 
    
         
            +
              summary: Talking about Ruby Hashes
         
     | 
| 
      
 19 
     | 
    
         
            +
              book_id: 2
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
            br_c202:
         
     | 
| 
      
 22 
     | 
    
         
            +
              id: 4
         
     | 
| 
      
 23 
     | 
    
         
            +
              chapter_number: 202
         
     | 
| 
      
 24 
     | 
    
         
            +
              title: Sorry, Did I Say 2 Seconds? I Meant 2 Years!
         
     | 
| 
      
 25 
     | 
    
         
            +
              book_id: 2
         
     | 
| 
      
 26 
     | 
    
         
            +
              
         
     | 
| 
      
 27 
     | 
    
         
            +
              
         
     | 
| 
         @@ -0,0 +1,35 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            id,text_value_id,version,text
         
     | 
| 
      
 2 
     | 
    
         
            +
            1,1,1,glorious
         
     | 
| 
      
 3 
     | 
    
         
            +
            2,2,1,dramatic
         
     | 
| 
      
 4 
     | 
    
         
            +
            3,3,1,exotic
         
     | 
| 
      
 5 
     | 
    
         
            +
            4,4,1,cryptic
         
     | 
| 
      
 6 
     | 
    
         
            +
            5,5,1,wizardry
         
     | 
| 
      
 7 
     | 
    
         
            +
            6,6,1,programming
         
     | 
| 
      
 8 
     | 
    
         
            +
            7,7,1,software development
         
     | 
| 
      
 9 
     | 
    
         
            +
            8,8,1,fiction
         
     | 
| 
      
 10 
     | 
    
         
            +
            9,9,1,scripting languages
         
     | 
| 
      
 11 
     | 
    
         
            +
            10,10,1,non-fiction
         
     | 
| 
      
 12 
     | 
    
         
            +
            11,11,1,Brad Pitta
         
     | 
| 
      
 13 
     | 
    
         
            +
            12,12,1,Angelina Jolly
         
     | 
| 
      
 14 
     | 
    
         
            +
            13,13,1,Douglas Michaels
         
     | 
| 
      
 15 
     | 
    
         
            +
            14,14,1,Nicole Mankid
         
     | 
| 
      
 16 
     | 
    
         
            +
            15,15,1,"J. K. Rowing"
         
     | 
| 
      
 17 
     | 
    
         
            +
            16,16,1,Something interesting happens
         
     | 
| 
      
 18 
     | 
    
         
            +
            17,17,1,Harry Potter and the Exploding Men's Locker Room
         
     | 
| 
      
 19 
     | 
    
         
            +
            18,18,1,"4/5"
         
     | 
| 
      
 20 
     | 
    
         
            +
            19,19,1,amusing rhetoric
         
     | 
| 
      
 21 
     | 
    
         
            +
            20,20,1,wizadry
         
     | 
| 
      
 22 
     | 
    
         
            +
            21,21,1,"Covers the absolute basics of the Ruby programming language."
         
     | 
| 
      
 23 
     | 
    
         
            +
            22,22,1,"Difficult and rocky trek into the complex language that is Ruby, covering detailed logic and mind numbing syntax."
         
     | 
| 
      
 24 
     | 
    
         
            +
            23,23,1,Too Little Time
         
     | 
| 
      
 25 
     | 
    
         
            +
            24,24,1,programming
         
     | 
| 
      
 26 
     | 
    
         
            +
            25,25,1,"Remember to buy milk!"
         
     | 
| 
      
 27 
     | 
    
         
            +
            26,26,1,"Thriller+Suspense+Supernatural"
         
     | 
| 
      
 28 
     | 
    
         
            +
            27,27,1,And It All Falls Down
         
     | 
| 
      
 29 
     | 
    
         
            +
            28,28,1,Hashes and U
         
     | 
| 
      
 30 
     | 
    
         
            +
            29,29,1,complex
         
     | 
| 
      
 31 
     | 
    
         
            +
            30,30,1,dynamic languages
         
     | 
| 
      
 32 
     | 
    
         
            +
            31,31,1,Ruby Hashes
         
     | 
| 
      
 33 
     | 
    
         
            +
            32,32,1,"O(x^2)"
         
     | 
| 
      
 34 
     | 
    
         
            +
            33,33,1,"Conclusion (finally!)"
         
     | 
| 
      
 35 
     | 
    
         
            +
            34,34,1,long
         
     | 
| 
         @@ -0,0 +1,35 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            id,version,version_creator_id,text
         
     | 
| 
      
 2 
     | 
    
         
            +
            1,1,,glorious
         
     | 
| 
      
 3 
     | 
    
         
            +
            2,1,,dramatic
         
     | 
| 
      
 4 
     | 
    
         
            +
            3,1,,exotic
         
     | 
| 
      
 5 
     | 
    
         
            +
            4,1,,cryptic
         
     | 
| 
      
 6 
     | 
    
         
            +
            5,1,,wizardry
         
     | 
| 
      
 7 
     | 
    
         
            +
            6,1,,programming
         
     | 
| 
      
 8 
     | 
    
         
            +
            7,1,,software development
         
     | 
| 
      
 9 
     | 
    
         
            +
            8,1,,fiction
         
     | 
| 
      
 10 
     | 
    
         
            +
            9,1,,scripting languages
         
     | 
| 
      
 11 
     | 
    
         
            +
            10,1,,non-fiction
         
     | 
| 
      
 12 
     | 
    
         
            +
            11,1,,Brad Pitta
         
     | 
| 
      
 13 
     | 
    
         
            +
            12,1,,Angelina Jolly
         
     | 
| 
      
 14 
     | 
    
         
            +
            13,1,,Douglas Michaels
         
     | 
| 
      
 15 
     | 
    
         
            +
            14,1,,Nicole Mankid
         
     | 
| 
      
 16 
     | 
    
         
            +
            15,1,,"J. K. Rowing"
         
     | 
| 
      
 17 
     | 
    
         
            +
            16,1,,Something interesting happens
         
     | 
| 
      
 18 
     | 
    
         
            +
            17,1,,Harry Potter and the Exploding Men's Locker Room
         
     | 
| 
      
 19 
     | 
    
         
            +
            18,1,,"4/5"
         
     | 
| 
      
 20 
     | 
    
         
            +
            19,1,,amusing rhetoric
         
     | 
| 
      
 21 
     | 
    
         
            +
            20,1,,wizadry
         
     | 
| 
      
 22 
     | 
    
         
            +
            21,1,,"Covers the absolute basics of the Ruby programming language."
         
     | 
| 
      
 23 
     | 
    
         
            +
            22,1,,"Difficult and rocky trek into the complex language that is Ruby, covering detailed logic and mind numbing syntax."
         
     | 
| 
      
 24 
     | 
    
         
            +
            23,1,,Too Little Time
         
     | 
| 
      
 25 
     | 
    
         
            +
            24,1,,programming
         
     | 
| 
      
 26 
     | 
    
         
            +
            25,1,,"Remember to buy milk!"
         
     | 
| 
      
 27 
     | 
    
         
            +
            26,1,,"Thriller+Suspense+Supernatural"
         
     | 
| 
      
 28 
     | 
    
         
            +
            27,1,,And It All Falls Down
         
     | 
| 
      
 29 
     | 
    
         
            +
            28,1,,Hashes and U
         
     | 
| 
      
 30 
     | 
    
         
            +
            29,1,,complex
         
     | 
| 
      
 31 
     | 
    
         
            +
            30,1,,dynamic languages
         
     | 
| 
      
 32 
     | 
    
         
            +
            31,1,,Ruby Hashes
         
     | 
| 
      
 33 
     | 
    
         
            +
            32,1,,"O(x^2)"
         
     | 
| 
      
 34 
     | 
    
         
            +
            33,1,,"Conclusion (finally!)"
         
     | 
| 
      
 35 
     | 
    
         
            +
            34,1,,long
         
     | 
| 
         @@ -0,0 +1,40 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require File.dirname(__FILE__) + '/test_helper.rb'
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            class NumberValueVersionTest < ActiveSupport::TestCase
         
     | 
| 
      
 4 
     | 
    
         
            +
              
         
     | 
| 
      
 5 
     | 
    
         
            +
              def test_text_value_version_class_loaded
         
     | 
| 
      
 6 
     | 
    
         
            +
                assert_kind_of NumberValue::Version, NumberValue::Version.new
         
     | 
| 
      
 7 
     | 
    
         
            +
              end
         
     | 
| 
      
 8 
     | 
    
         
            +
              
         
     | 
| 
      
 9 
     | 
    
         
            +
              def test_versioning_on_update
         
     | 
| 
      
 10 
     | 
    
         
            +
                ann = annotations(:bh_length_1)
         
     | 
| 
      
 11 
     | 
    
         
            +
                val = ann.value
         
     | 
| 
      
 12 
     | 
    
         
            +
                orig_content = val.number
         
     | 
| 
      
 13 
     | 
    
         
            +
                new_content = 10000
         
     | 
| 
      
 14 
     | 
    
         
            +
                
         
     | 
| 
      
 15 
     | 
    
         
            +
                assert_kind_of NumberValue, val
         
     | 
| 
      
 16 
     | 
    
         
            +
                
         
     | 
| 
      
 17 
     | 
    
         
            +
                # Check number of versions
         
     | 
| 
      
 18 
     | 
    
         
            +
                assert_equal 1, val.versions.length
         
     | 
| 
      
 19 
     | 
    
         
            +
                
         
     | 
| 
      
 20 
     | 
    
         
            +
                # Update the value and check that a version has been created
         
     | 
| 
      
 21 
     | 
    
         
            +
                
         
     | 
| 
      
 22 
     | 
    
         
            +
                val.number = new_content
         
     | 
| 
      
 23 
     | 
    
         
            +
                val.version_creator = users(:john)
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
                assert val.valid?
         
     | 
| 
      
 26 
     | 
    
         
            +
                
         
     | 
| 
      
 27 
     | 
    
         
            +
                assert val.save
         
     | 
| 
      
 28 
     | 
    
         
            +
                
         
     | 
| 
      
 29 
     | 
    
         
            +
                assert_equal 2, val.versions.length
         
     | 
| 
      
 30 
     | 
    
         
            +
                assert_equal new_content, val.number
         
     | 
| 
      
 31 
     | 
    
         
            +
                assert_equal 2, val.versions.latest.version
         
     | 
| 
      
 32 
     | 
    
         
            +
                assert_equal new_content, val.versions.latest.number
         
     | 
| 
      
 33 
     | 
    
         
            +
                assert_equal 1, val.versions.latest.previous.version
         
     | 
| 
      
 34 
     | 
    
         
            +
                assert_equal orig_content, val.versions.latest.previous.number
         
     | 
| 
      
 35 
     | 
    
         
            +
                assert_equal users(:john).id, val.version_creator_id
         
     | 
| 
      
 36 
     | 
    
         
            +
                assert_equal users(:john).id, val.versions.latest.version_creator_id
         
     | 
| 
      
 37 
     | 
    
         
            +
                assert_equal nil, val.versions.latest.previous.version_creator_id
         
     | 
| 
      
 38 
     | 
    
         
            +
              end
         
     | 
| 
      
 39 
     | 
    
         
            +
              
         
     | 
| 
      
 40 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,27 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require "#{File.dirname(__FILE__)}/test_helper"
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            class RoutingTest < ActiveSupport::TestCase
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
              def setup
         
     | 
| 
      
 6 
     | 
    
         
            +
                ActionController::Routing::Routes.draw do |map|
         
     | 
| 
      
 7 
     | 
    
         
            +
                  Annotations.map_routes(map)
         
     | 
| 
      
 8 
     | 
    
         
            +
                end
         
     | 
| 
      
 9 
     | 
    
         
            +
              end
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
              def test_annotations_route
         
     | 
| 
      
 12 
     | 
    
         
            +
                assert_recognition :get, "/annotations", :controller => "annotations", :action => "index"
         
     | 
| 
      
 13 
     | 
    
         
            +
              end
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
              private
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
                # From: http://guides.rubyonrails.org/creating_plugins.html#_add_a_custom_route 
         
     | 
| 
      
 18 
     | 
    
         
            +
                #
         
     | 
| 
      
 19 
     | 
    
         
            +
                # yes, I know about assert_recognizes, but it has proven problematic to
         
     | 
| 
      
 20 
     | 
    
         
            +
                # use in these tests, since it uses RouteSet#recognize (which actually
         
     | 
| 
      
 21 
     | 
    
         
            +
                # tries to instantiate the controller) and because it uses an awkward
         
     | 
| 
      
 22 
     | 
    
         
            +
                # parameter order.
         
     | 
| 
      
 23 
     | 
    
         
            +
                def assert_recognition(method, path, options)
         
     | 
| 
      
 24 
     | 
    
         
            +
                  result = ActionController::Routing::Routes.recognize_path(path, :method => method)
         
     | 
| 
      
 25 
     | 
    
         
            +
                  assert_equal options, result
         
     | 
| 
      
 26 
     | 
    
         
            +
                end
         
     | 
| 
      
 27 
     | 
    
         
            +
            end
         
     | 
    
        data/test/test_helper.rb
    ADDED
    
    | 
         @@ -0,0 +1,41 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            Dir.chdir(File.join(File.dirname(__FILE__), "..")) do
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
              ENV['RAILS_ENV'] = 'mysql'
         
     | 
| 
      
 4 
     | 
    
         
            +
              RAILS_ENV = 'mysql'
         
     | 
| 
      
 5 
     | 
    
         
            +
              
         
     | 
| 
      
 6 
     | 
    
         
            +
              RAILS_GEM_VERSION = '2.3.2' unless defined? RAILS_GEM_VERSION
         
     | 
| 
      
 7 
     | 
    
         
            +
              
         
     | 
| 
      
 8 
     | 
    
         
            +
              HELPER_RAILS_ROOT = File.join(Dir.pwd, "test", "app_root")
         
     | 
| 
      
 9 
     | 
    
         
            +
              RAILS_ROOT = File.join(Dir.pwd, "test", "app_root")
         
     | 
| 
      
 10 
     | 
    
         
            +
              
         
     | 
| 
      
 11 
     | 
    
         
            +
              # Load the plugin testing framework
         
     | 
| 
      
 12 
     | 
    
         
            +
              require 'rubygems'
         
     | 
| 
      
 13 
     | 
    
         
            +
              require 'plugin_test_helper'
         
     | 
| 
      
 14 
     | 
    
         
            +
              
         
     | 
| 
      
 15 
     | 
    
         
            +
              # Run the migrations (optional)
         
     | 
| 
      
 16 
     | 
    
         
            +
              ActiveRecord::Migrator.migrate("#{Rails.root}/db/migrate")
         
     | 
| 
      
 17 
     | 
    
         
            +
              
         
     | 
| 
      
 18 
     | 
    
         
            +
              require 'init'
         
     | 
| 
      
 19 
     | 
    
         
            +
              
         
     | 
| 
      
 20 
     | 
    
         
            +
              ActiveSupport::TestCase.class_eval do
         
     | 
| 
      
 21 
     | 
    
         
            +
                self.use_transactional_fixtures = true
         
     | 
| 
      
 22 
     | 
    
         
            +
                self.use_instantiated_fixtures  = false
         
     | 
| 
      
 23 
     | 
    
         
            +
                self.fixture_path = File.join(Dir.pwd, "test", "fixtures")
         
     | 
| 
      
 24 
     | 
    
         
            +
              
         
     | 
| 
      
 25 
     | 
    
         
            +
                set_fixture_class :books => Book,
         
     | 
| 
      
 26 
     | 
    
         
            +
                                  :chapters => Chapter,
         
     | 
| 
      
 27 
     | 
    
         
            +
                                  :users => User,
         
     | 
| 
      
 28 
     | 
    
         
            +
                                  :groups => Group,
         
     | 
| 
      
 29 
     | 
    
         
            +
                                  :annotations => Annotation,
         
     | 
| 
      
 30 
     | 
    
         
            +
                                  :annotation_versions => Annotation::Version,
         
     | 
| 
      
 31 
     | 
    
         
            +
                                  :annotation_attributes => AnnotationAttribute,
         
     | 
| 
      
 32 
     | 
    
         
            +
                                  :annotation_value_seeds => AnnotationValueSeed,
         
     | 
| 
      
 33 
     | 
    
         
            +
                                  :text_values => TextValue,
         
     | 
| 
      
 34 
     | 
    
         
            +
                                  :text_value_versions => TextValue::Version,
         
     | 
| 
      
 35 
     | 
    
         
            +
                                  :number_values => NumberValue,
         
     | 
| 
      
 36 
     | 
    
         
            +
                                  :number_value_versions => NumberValue::Version
         
     | 
| 
      
 37 
     | 
    
         
            +
              
         
     | 
| 
      
 38 
     | 
    
         
            +
                fixtures :all
         
     | 
| 
      
 39 
     | 
    
         
            +
              end
         
     | 
| 
      
 40 
     | 
    
         
            +
             
     | 
| 
      
 41 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,40 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require File.dirname(__FILE__) + '/test_helper.rb'
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            class TextValueVersionTest < ActiveSupport::TestCase
         
     | 
| 
      
 4 
     | 
    
         
            +
              
         
     | 
| 
      
 5 
     | 
    
         
            +
              def test_text_value_version_class_loaded
         
     | 
| 
      
 6 
     | 
    
         
            +
                assert_kind_of TextValue::Version, TextValue::Version.new
         
     | 
| 
      
 7 
     | 
    
         
            +
              end
         
     | 
| 
      
 8 
     | 
    
         
            +
              
         
     | 
| 
      
 9 
     | 
    
         
            +
              def test_versioning_on_update
         
     | 
| 
      
 10 
     | 
    
         
            +
                ann = annotations(:bh_title_1)
         
     | 
| 
      
 11 
     | 
    
         
            +
                val = ann.value
         
     | 
| 
      
 12 
     | 
    
         
            +
                orig_content = val.text
         
     | 
| 
      
 13 
     | 
    
         
            +
                new_content = "Harry Potter IIIIIII"
         
     | 
| 
      
 14 
     | 
    
         
            +
                
         
     | 
| 
      
 15 
     | 
    
         
            +
                assert_kind_of TextValue, val
         
     | 
| 
      
 16 
     | 
    
         
            +
                
         
     | 
| 
      
 17 
     | 
    
         
            +
                # Check number of versions
         
     | 
| 
      
 18 
     | 
    
         
            +
                assert_equal 1, val.versions.length
         
     | 
| 
      
 19 
     | 
    
         
            +
                
         
     | 
| 
      
 20 
     | 
    
         
            +
                # Update the value and check that a version has been created
         
     | 
| 
      
 21 
     | 
    
         
            +
                
         
     | 
| 
      
 22 
     | 
    
         
            +
                val.text = new_content
         
     | 
| 
      
 23 
     | 
    
         
            +
                val.version_creator = users(:john)
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
                assert val.valid?
         
     | 
| 
      
 26 
     | 
    
         
            +
                
         
     | 
| 
      
 27 
     | 
    
         
            +
                assert val.save
         
     | 
| 
      
 28 
     | 
    
         
            +
                
         
     | 
| 
      
 29 
     | 
    
         
            +
                assert_equal 2, val.versions.length
         
     | 
| 
      
 30 
     | 
    
         
            +
                assert_equal new_content, val.text
         
     | 
| 
      
 31 
     | 
    
         
            +
                assert_equal 2, val.versions.latest.version
         
     | 
| 
      
 32 
     | 
    
         
            +
                assert_equal new_content, val.versions.latest.text
         
     | 
| 
      
 33 
     | 
    
         
            +
                assert_equal 1, val.versions.latest.previous.version
         
     | 
| 
      
 34 
     | 
    
         
            +
                assert_equal orig_content, val.versions.latest.previous.text
         
     | 
| 
      
 35 
     | 
    
         
            +
                assert_equal users(:john).id, val.version_creator_id
         
     | 
| 
      
 36 
     | 
    
         
            +
                assert_equal users(:john).id, val.versions.latest.version_creator_id
         
     | 
| 
      
 37 
     | 
    
         
            +
                assert_equal nil, val.versions.latest.previous.version_creator_id
         
     | 
| 
      
 38 
     | 
    
         
            +
              end
         
     | 
| 
      
 39 
     | 
    
         
            +
              
         
     | 
| 
      
 40 
     | 
    
         
            +
            end
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,13 +1,13 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification 
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: my_annotations
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version 
         
     | 
| 
       4 
     | 
    
         
            -
              hash:  
     | 
| 
      
 4 
     | 
    
         
            +
              hash: 9
         
     | 
| 
       5 
5 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       6 
6 
     | 
    
         
             
              segments: 
         
     | 
| 
       7 
7 
     | 
    
         
             
              - 0
         
     | 
| 
       8 
8 
     | 
    
         
             
              - 5
         
     | 
| 
       9 
     | 
    
         
            -
              -  
     | 
| 
       10 
     | 
    
         
            -
              version: 0.5. 
     | 
| 
      
 9 
     | 
    
         
            +
              - 1
         
     | 
| 
      
 10 
     | 
    
         
            +
              version: 0.5.1
         
     | 
| 
       11 
11 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       12 
12 
     | 
    
         
             
            authors: 
         
     | 
| 
       13 
13 
     | 
    
         
             
            - Jiten Bhagat
         
     | 
| 
         @@ -30,14 +30,84 @@ extensions: [] 
     | 
|
| 
       30 
30 
     | 
    
         
             
            extra_rdoc_files: []
         
     | 
| 
       31 
31 
     | 
    
         | 
| 
       32 
32 
     | 
    
         
             
            files: 
         
     | 
| 
       33 
     | 
    
         
            -
            -  
     | 
| 
       34 
     | 
    
         
            -
            -  
     | 
| 
       35 
     | 
    
         
            -
            -  
     | 
| 
      
 33 
     | 
    
         
            +
            - .gitignore
         
     | 
| 
      
 34 
     | 
    
         
            +
            - .rvmrc
         
     | 
| 
      
 35 
     | 
    
         
            +
            - AUTHORS.rdoc
         
     | 
| 
      
 36 
     | 
    
         
            +
            - CHANGELOG.rdoc
         
     | 
| 
      
 37 
     | 
    
         
            +
            - INDEX.rdoc
         
     | 
| 
       36 
38 
     | 
    
         
             
            - LICENSE
         
     | 
| 
       37 
     | 
    
         
            -
            - script/console
         
     | 
| 
       38 
39 
     | 
    
         
             
            - README.rdoc
         
     | 
| 
       39 
40 
     | 
    
         
             
            - RUNNING_TESTS.rdoc
         
     | 
| 
      
 41 
     | 
    
         
            +
            - RakeFile
         
     | 
| 
      
 42 
     | 
    
         
            +
            - VERSION.yml
         
     | 
| 
      
 43 
     | 
    
         
            +
            - generators/annotations_migration/annotations_migration_generator.rb
         
     | 
| 
      
 44 
     | 
    
         
            +
            - generators/annotations_migration/templates/migration_v1.rb
         
     | 
| 
      
 45 
     | 
    
         
            +
            - generators/annotations_migration/templates/migration_v2.rb
         
     | 
| 
      
 46 
     | 
    
         
            +
            - generators/annotations_migration/templates/migration_v3.rb
         
     | 
| 
      
 47 
     | 
    
         
            +
            - generators/annotations_migration/templates/migration_v4.rb
         
     | 
| 
      
 48 
     | 
    
         
            +
            - install.rb
         
     | 
| 
      
 49 
     | 
    
         
            +
            - lib/annotations/acts_as_annotatable.rb
         
     | 
| 
      
 50 
     | 
    
         
            +
            - lib/annotations/acts_as_annotation_source.rb
         
     | 
| 
      
 51 
     | 
    
         
            +
            - lib/annotations/acts_as_annotation_value.rb
         
     | 
| 
      
 52 
     | 
    
         
            +
            - lib/annotations/config.rb
         
     | 
| 
      
 53 
     | 
    
         
            +
            - lib/annotations/routing.rb
         
     | 
| 
      
 54 
     | 
    
         
            +
            - lib/annotations/util.rb
         
     | 
| 
      
 55 
     | 
    
         
            +
            - lib/annotations_version_fu.rb
         
     | 
| 
      
 56 
     | 
    
         
            +
            - lib/app/controllers/annotations_controller.rb
         
     | 
| 
      
 57 
     | 
    
         
            +
            - lib/app/controllers/application_controller.rb
         
     | 
| 
      
 58 
     | 
    
         
            +
            - lib/app/helpers/application_helper.rb
         
     | 
| 
      
 59 
     | 
    
         
            +
            - lib/app/models/annotation.rb
         
     | 
| 
      
 60 
     | 
    
         
            +
            - lib/app/models/annotation_attribute.rb
         
     | 
| 
      
 61 
     | 
    
         
            +
            - lib/app/models/annotation_value_seed.rb
         
     | 
| 
      
 62 
     | 
    
         
            +
            - lib/app/models/number_value.rb
         
     | 
| 
      
 63 
     | 
    
         
            +
            - lib/app/models/text_value.rb
         
     | 
| 
      
 64 
     | 
    
         
            +
            - lib/my_annotations.rb
         
     | 
| 
       40 
65 
     | 
    
         
             
            - my_annotations.gemspec
         
     | 
| 
      
 66 
     | 
    
         
            +
            - rails/init.rb
         
     | 
| 
      
 67 
     | 
    
         
            +
            - script/console
         
     | 
| 
      
 68 
     | 
    
         
            +
            - test/acts_as_annotatable_test.rb
         
     | 
| 
      
 69 
     | 
    
         
            +
            - test/acts_as_annotation_source_test.rb
         
     | 
| 
      
 70 
     | 
    
         
            +
            - test/acts_as_annotation_value_test.rb
         
     | 
| 
      
 71 
     | 
    
         
            +
            - test/annotation_attribute_test.rb
         
     | 
| 
      
 72 
     | 
    
         
            +
            - test/annotation_test.rb
         
     | 
| 
      
 73 
     | 
    
         
            +
            - test/annotation_value_seed_test.rb
         
     | 
| 
      
 74 
     | 
    
         
            +
            - test/annotation_version_test.rb
         
     | 
| 
      
 75 
     | 
    
         
            +
            - test/annotations_controller_test.rb
         
     | 
| 
      
 76 
     | 
    
         
            +
            - test/app_root/app/controllers/application_controller.rb
         
     | 
| 
      
 77 
     | 
    
         
            +
            - test/app_root/app/models/book.rb
         
     | 
| 
      
 78 
     | 
    
         
            +
            - test/app_root/app/models/chapter.rb
         
     | 
| 
      
 79 
     | 
    
         
            +
            - test/app_root/app/models/group.rb
         
     | 
| 
      
 80 
     | 
    
         
            +
            - test/app_root/app/models/tag.rb
         
     | 
| 
      
 81 
     | 
    
         
            +
            - test/app_root/app/models/user.rb
         
     | 
| 
      
 82 
     | 
    
         
            +
            - test/app_root/app/views/annotations/edit.html.erb
         
     | 
| 
      
 83 
     | 
    
         
            +
            - test/app_root/app/views/annotations/index.html.erb
         
     | 
| 
      
 84 
     | 
    
         
            +
            - test/app_root/app/views/annotations/new.html.erb
         
     | 
| 
      
 85 
     | 
    
         
            +
            - test/app_root/app/views/annotations/show.html.erb
         
     | 
| 
      
 86 
     | 
    
         
            +
            - test/app_root/config/boot.rb
         
     | 
| 
      
 87 
     | 
    
         
            +
            - test/app_root/config/environment.rb
         
     | 
| 
      
 88 
     | 
    
         
            +
            - test/app_root/config/environments/mysql.rb
         
     | 
| 
      
 89 
     | 
    
         
            +
            - test/app_root/config/routes.rb
         
     | 
| 
      
 90 
     | 
    
         
            +
            - test/app_root/db/migrate/001_create_test_models.rb
         
     | 
| 
      
 91 
     | 
    
         
            +
            - test/app_root/db/migrate/002_annotations_migration_v1.rb
         
     | 
| 
      
 92 
     | 
    
         
            +
            - test/app_root/db/migrate/003_annotations_migration_v2.rb
         
     | 
| 
      
 93 
     | 
    
         
            +
            - test/app_root/db/migrate/004_annotations_migration_v3.rb
         
     | 
| 
      
 94 
     | 
    
         
            +
            - test/config_test.rb
         
     | 
| 
      
 95 
     | 
    
         
            +
            - test/fixtures/annotation_attributes.yml
         
     | 
| 
      
 96 
     | 
    
         
            +
            - test/fixtures/annotation_value_seeds.csv
         
     | 
| 
      
 97 
     | 
    
         
            +
            - test/fixtures/annotation_versions.yml
         
     | 
| 
      
 98 
     | 
    
         
            +
            - test/fixtures/annotations.yml
         
     | 
| 
      
 99 
     | 
    
         
            +
            - test/fixtures/books.yml
         
     | 
| 
      
 100 
     | 
    
         
            +
            - test/fixtures/chapters.yml
         
     | 
| 
      
 101 
     | 
    
         
            +
            - test/fixtures/groups.yml
         
     | 
| 
      
 102 
     | 
    
         
            +
            - test/fixtures/number_value_versions.csv
         
     | 
| 
      
 103 
     | 
    
         
            +
            - test/fixtures/number_values.csv
         
     | 
| 
      
 104 
     | 
    
         
            +
            - test/fixtures/text_value_versions.csv
         
     | 
| 
      
 105 
     | 
    
         
            +
            - test/fixtures/text_values.csv
         
     | 
| 
      
 106 
     | 
    
         
            +
            - test/fixtures/users.yml
         
     | 
| 
      
 107 
     | 
    
         
            +
            - test/number_value_version_test.rb
         
     | 
| 
      
 108 
     | 
    
         
            +
            - test/routing_test.rb
         
     | 
| 
      
 109 
     | 
    
         
            +
            - test/test_helper.rb
         
     | 
| 
      
 110 
     | 
    
         
            +
            - test/text_value_version_test.rb
         
     | 
| 
       41 
111 
     | 
    
         
             
            has_rdoc: true
         
     | 
| 
       42 
112 
     | 
    
         
             
            homepage: https://github.com/myGrid/annotations
         
     | 
| 
       43 
113 
     | 
    
         
             
            licenses: []
         
     |