MYSQLSafe 0.1.5 → 0.1.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/MYSQLSafe/version.rb +1 -1
- data/test/lib/MYSQLSafe/base_test.rb +27 -3
- data/test/test_helper.rb +2 -2
- metadata +11 -19
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 0992494309829764f3b6e72074e2e3b31ec08c17
|
4
|
+
data.tar.gz: 1b53e078d5aed603c311e2d0a9579076da4ea06a
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 0f6d6bb6314772f077a07b5677fef1545ff66f3c44b0f3fe82e7d7233773dca0a69752c1d5946d547dd46639487dcbdea2dd00e1fb39061431198b65c0e9a17e
|
7
|
+
data.tar.gz: c68b7162384a9c5c6cc2dbae0ce938ebacf3183184506385987e86d03072470d6ffbcdd7a15c41a58bc358fda5e3f1c3620d9cd189eb2f04b3f71f4043f190f1
|
data/lib/MYSQLSafe/version.rb
CHANGED
@@ -14,7 +14,7 @@ describe MYSQLSafe::Base do
|
|
14
14
|
@obj.encoding.must_equal encoding_name
|
15
15
|
end
|
16
16
|
it "should allow username to be set and read" do
|
17
|
-
username = '
|
17
|
+
username = ENV['MYSQLUSERNAME']
|
18
18
|
@obj.user = username
|
19
19
|
@obj.user.must_equal username
|
20
20
|
end
|
@@ -24,7 +24,7 @@ describe MYSQLSafe::Base do
|
|
24
24
|
@obj.host.must_equal hostname
|
25
25
|
end
|
26
26
|
it "should allow database to be set and read" do
|
27
|
-
database_name = '
|
27
|
+
database_name = 'gem_test_mysqlsafe'
|
28
28
|
@obj.database = database_name
|
29
29
|
@obj.database.must_equal database_name
|
30
30
|
end
|
@@ -63,9 +63,33 @@ describe MYSQLSafe::Base do
|
|
63
63
|
success.must_be_instance_of Array
|
64
64
|
end
|
65
65
|
|
66
|
+
it "should allow database and test specification" do
|
67
|
+
@obj = help.set_variables(@obj)
|
68
|
+
success = @obj.connect_safe("SELECT `test_int`, `test_varchar` FROM `gem_test_mysqlsafe`.`performance_test` WHERE `test_int` = 1 LIMIT 1")
|
69
|
+
success.to_s.wont_include "MYSQL Error"
|
70
|
+
success.must_be_instance_of Array
|
71
|
+
end
|
72
|
+
|
73
|
+
it "should allow order by" do
|
74
|
+
@obj = help.set_variables(@obj)
|
75
|
+
success = @obj.connect_safe("SELECT `test_int`, `test_varchar` FROM `gem_test_mysqlsafe`.`performance_test` WHERE `test_int` = 1 ORDER BY `test_int` LIMIT 1")
|
76
|
+
success.to_s.wont_include "MYSQL Error"
|
77
|
+
success.must_be_instance_of Array
|
78
|
+
end
|
79
|
+
it "should allow order by direction indication" do
|
80
|
+
@obj = help.set_variables(@obj)
|
81
|
+
success = @obj.connect_safe("SELECT `test_int`, `test_varchar` FROM `gem_test_mysqlsafe`.`performance_test` WHERE `test_int` = 1 ORDER BY `test_int` DESC LIMIT 1")
|
82
|
+
success.to_s.wont_include "MYSQL Error"
|
83
|
+
success.must_be_instance_of Array
|
84
|
+
end
|
85
|
+
|
66
86
|
it "should allow insert into syntax" do
|
67
87
|
@obj = help.set_variables(@obj)
|
68
|
-
|
88
|
+
|
89
|
+
max_id = @obj.connect_safe("SELECT MAX( test_int ) FROM `performance_test`")
|
90
|
+
next_id = max_id[0][0].to_i + 1
|
91
|
+
|
92
|
+
success = @obj.connect_safe("INSERT INTO `performance_test` SELECT * FROM `performance_test` WHERE `test_int` = #{next_id} LIMIT 1")
|
69
93
|
success.to_s.wont_include "MYSQL Error"
|
70
94
|
success.must_be_instance_of Array
|
71
95
|
end
|
data/test/test_helper.rb
CHANGED
@@ -11,7 +11,7 @@ class TestHelpers
|
|
11
11
|
return obj
|
12
12
|
end
|
13
13
|
def set_user(obj)
|
14
|
-
@user_name = '
|
14
|
+
@user_name = ENV['MYSQLUSERNAME']
|
15
15
|
obj.user = @user_name
|
16
16
|
return obj
|
17
17
|
end
|
@@ -21,7 +21,7 @@ class TestHelpers
|
|
21
21
|
return obj
|
22
22
|
end
|
23
23
|
def set_database(obj)
|
24
|
-
@database_name = '
|
24
|
+
@database_name = 'gem_test_mysqlsafe'
|
25
25
|
obj.database = @database_name
|
26
26
|
return obj
|
27
27
|
end
|
metadata
CHANGED
@@ -1,20 +1,18 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: MYSQLSafe
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.5
|
5
|
-
prerelease:
|
4
|
+
version: 0.1.5.1
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Sam NIssen
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2013-
|
11
|
+
date: 2013-12-12 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: bundler
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
17
|
- - ~>
|
20
18
|
- !ruby/object:Gem::Version
|
@@ -22,7 +20,6 @@ dependencies:
|
|
22
20
|
type: :development
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
24
|
- - ~>
|
28
25
|
- !ruby/object:Gem::Version
|
@@ -30,33 +27,29 @@ dependencies:
|
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: rake
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
|
-
- -
|
31
|
+
- - '>='
|
36
32
|
- !ruby/object:Gem::Version
|
37
33
|
version: '0'
|
38
34
|
type: :development
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
|
-
- -
|
38
|
+
- - '>='
|
44
39
|
- !ruby/object:Gem::Version
|
45
40
|
version: '0'
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
42
|
name: mysql
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
|
-
- -
|
45
|
+
- - '>='
|
52
46
|
- !ruby/object:Gem::Version
|
53
47
|
version: '0'
|
54
48
|
type: :runtime
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
|
-
- -
|
52
|
+
- - '>='
|
60
53
|
- !ruby/object:Gem::Version
|
61
54
|
version: '0'
|
62
55
|
description: Connect to MYSQL more easily
|
@@ -81,27 +74,26 @@ files:
|
|
81
74
|
homepage: ''
|
82
75
|
licenses:
|
83
76
|
- MIT
|
77
|
+
metadata: {}
|
84
78
|
post_install_message:
|
85
79
|
rdoc_options: []
|
86
80
|
require_paths:
|
87
81
|
- lib
|
88
82
|
required_ruby_version: !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
83
|
requirements:
|
91
|
-
- -
|
84
|
+
- - '>='
|
92
85
|
- !ruby/object:Gem::Version
|
93
86
|
version: '0'
|
94
87
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
95
|
-
none: false
|
96
88
|
requirements:
|
97
|
-
- -
|
89
|
+
- - '>='
|
98
90
|
- !ruby/object:Gem::Version
|
99
91
|
version: '0'
|
100
92
|
requirements: []
|
101
93
|
rubyforge_project:
|
102
|
-
rubygems_version: 1.
|
94
|
+
rubygems_version: 2.1.5
|
103
95
|
signing_key:
|
104
|
-
specification_version:
|
96
|
+
specification_version: 4
|
105
97
|
summary: An abstraction of the MYSQL gem to automatically close connections, return
|
106
98
|
arrays and sanatize some of the inputs
|
107
99
|
test_files:
|