appoxy-simple_record 1.0.20 → 1.0.22
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/lib/simple_record.rb +5 -1
- data/test/my_model.rb +4 -4
- data/test/test_simple_record.rb +10 -5
- metadata +1 -1
    
        data/lib/simple_record.rb
    CHANGED
    
    | @@ -49,6 +49,10 @@ module SimpleRecord | |
| 49 49 | 
             
                    RightAws::ActiveSdb.establish_connection(aws_access_key, aws_secret_key, params)
         | 
| 50 50 | 
             
                end
         | 
| 51 51 |  | 
| 52 | 
            +
                def self.close_connection()
         | 
| 53 | 
            +
                            RightAws::ActiveSdb.close_connection
         | 
| 54 | 
            +
                end
         | 
| 55 | 
            +
             | 
| 52 56 | 
             
                class Base < RightAws::ActiveSdb::Base
         | 
| 53 57 |  | 
| 54 58 | 
             
                    attr_accessor :errors
         | 
| @@ -750,7 +754,7 @@ This is done on getters now | |
| 750 754 | 
             
                            results=super(*params)
         | 
| 751 755 | 
             
                            cache_results(results)
         | 
| 752 756 | 
             
                        rescue RightAws::AwsError, RightAws::ActiveSdb::ActiveSdbError
         | 
| 753 | 
            -
                            puts "RESCUED: " +  | 
| 757 | 
            +
                            puts "RESCUED: " + $!.message
         | 
| 754 758 | 
             
                            if ($!.message().index("NoSuchDomain") != nil)
         | 
| 755 759 | 
             
                                # this is ok
         | 
| 756 760 | 
             
                            elsif ($!.message() =~ @@regex_no_id)
         | 
    
        data/test/my_model.rb
    CHANGED
    
    | @@ -2,10 +2,10 @@ require File.expand_path(File.dirname(__FILE__) + "/../lib/simple_record") | |
| 2 2 |  | 
| 3 3 | 
             
            class MyModel < SimpleRecord::Base
         | 
| 4 4 |  | 
| 5 | 
            -
                has_attributes : | 
| 6 | 
            -
                 | 
| 7 | 
            -
                 | 
| 8 | 
            -
                 | 
| 5 | 
            +
                has_attributes :name
         | 
| 6 | 
            +
                has_ints :age
         | 
| 7 | 
            +
                has_booleans :cool
         | 
| 8 | 
            +
                has_dates :created, :updated, :birthday
         | 
| 9 9 |  | 
| 10 10 |  | 
| 11 11 | 
             
            end
         | 
    
        data/test/test_simple_record.rb
    CHANGED
    
    | @@ -1,4 +1,4 @@ | |
| 1 | 
            -
            require ' | 
| 1 | 
            +
            require 'test/unit'
         | 
| 2 2 | 
             
            require File.expand_path(File.dirname(__FILE__) + "/../lib/simple_record")
         | 
| 3 3 | 
             
            require "yaml"
         | 
| 4 4 | 
             
            require 'right_aws'
         | 
| @@ -8,9 +8,12 @@ require 'my_child_model' | |
| 8 8 | 
             
            class TestSimpleRecord < Test::Unit::TestCase
         | 
| 9 9 |  | 
| 10 10 | 
             
                def setup
         | 
| 11 | 
            -
                     | 
| 12 | 
            -
                    puts  | 
| 13 | 
            -
                     | 
| 11 | 
            +
                    f = File.expand_path("~/.amazon/#{"simple_record_tests.yml"}")
         | 
| 12 | 
            +
                    puts f.inspect
         | 
| 13 | 
            +
                    @config = YAML::load(File.open(File.expand_path("~/.amazon/#{"simple_record_tests.yml"}")))
         | 
| 14 | 
            +
                    puts @config.inspect
         | 
| 15 | 
            +
                    #puts 'akey=' + @config['amazon']['access_key']
         | 
| 16 | 
            +
                    #puts 'skey=' + @config['amazon']['secret_key']
         | 
| 14 17 | 
             
                    RightAws::ActiveSdb.establish_connection(@config['amazon']['access_key'], @config['amazon']['secret_key'], :port=>80, :protocol=>"http")
         | 
| 15 18 | 
             
                    SimpleRecord::Base.set_domain_prefix("simplerecord_tests_")
         | 
| 16 19 | 
             
                end
         | 
| @@ -37,7 +40,9 @@ class TestSimpleRecord < Test::Unit::TestCase | |
| 37 40 | 
             
                end
         | 
| 38 41 |  | 
| 39 42 | 
             
                def test_bad_query
         | 
| 40 | 
            -
                     | 
| 43 | 
            +
                    assert_raise RightAws::AwsError do
         | 
| 44 | 
            +
                        mm2 = MyModel.find(:all, :conditions=>["name =4?", "1"])
         | 
| 45 | 
            +
                    end
         | 
| 41 46 | 
             
                end
         | 
| 42 47 |  | 
| 43 48 | 
             
                def test_batch_save
         |