appoxy-simple_record 1.0.20 → 1.0.22

Sign up to get free protection for your applications and to get access to all the features.
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 :created, :updated, :name, :age, :cool, :birthday
6
- are_ints :age
7
- are_booleans :cool
8
- are_dates :created, :updated, :birthday
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
@@ -1,4 +1,4 @@
1
- require 'minitest/unit'
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
- @config = YAML::load(File.read('test-config.yml'))
12
- puts 'akey=' + @config['amazon']['access_key']
13
- puts 'skey=' + @config['amazon']['secret_key']
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
- mm2 = MyModel.find(:all, :conditions=>["name =4?", "1"])
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: appoxy-simple_record
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.20
4
+ version: 1.0.22
5
5
  platform: ruby
6
6
  authors:
7
7
  - Travis Reeder