MYSQLSafe 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -3,7 +3,7 @@ require 'mysql'
3
3
  module MYSQLSafe
4
4
  class Base
5
5
  attr_accessor :encoding
6
- attr_reader :host, :database, :user, :password
6
+ attr_reader :host, :database, :user
7
7
 
8
8
  def host=(host_string)
9
9
  @host = esc_enc_string(host_string)
@@ -20,7 +20,7 @@ module MYSQLSafe
20
20
 
21
21
  def connect_safe(raw_sql)
22
22
  sql = esc_enc_string(raw_sql)
23
- if @host && @database && @user && password
23
+ if @host && @database && @user && @password
24
24
  begin
25
25
  @cxtn = Mysql.new(@host, @db, @user, @password)
26
26
  table_names = get_table_names
@@ -1,3 +1,3 @@
1
1
  module MYSQLSafe
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
@@ -0,0 +1,38 @@
1
+ require_relative '../../test_helper.rb'
2
+
3
+ describe MYSQLSafe::Base do
4
+
5
+ obj { MYSQLSafe::Base }
6
+
7
+ it "should allow enconding to be set and read" do
8
+ enconding_name = 'utf-8'
9
+ obj.enconding = enconding_name
10
+ obj.enconding.should_equal enconding_name
11
+ end
12
+ it "should allow username to be set and read" do
13
+ username = 'sam'
14
+ obj.user = username
15
+ obj.user.should_equal username
16
+ end
17
+ it "should allow host to be set and read" do
18
+ hostname = 'localhost'
19
+ obj.host = hostname
20
+ obj.host.should_equal hostname
21
+ end
22
+ it "should allow database to be set and read" do
23
+ database_name = 'test'
24
+ obj.database = database_name
25
+ obj.database.should_equal database_name
26
+ end
27
+
28
+ it "must allow password to be set, but not read" do
29
+ password_key = $MYSQLPASSWORD
30
+ obj.password = password_key
31
+ obj.password.must_be_kind_of Exception
32
+ end
33
+
34
+ it "should allow connections to be made" do
35
+ obj.connect_safe("SELECT * FROM test LIMIT 1")
36
+ obj.database.should_be_type_of Array
37
+ end
38
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: MYSQLSafe
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: