deployment_test 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,6 @@
1
+ == 0.0.5 (December 14, 2011)
2
+ * add check for postgres database existance
3
+
1
4
  == 0.0.4 (December 12, 2011)
2
5
  * add shell command to perform check
3
6
 
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{deployment_test}
5
- s.version = "0.0.4"
5
+ s.version = "0.0.5"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = [%q{Marcin Nowicki}]
9
- s.date = %q{2011-12-12}
9
+ s.date = %q{2011-12-14}
10
10
  s.description = %q{Gem to perform common deployment testing}
11
11
  s.email = %q{pr0d1r2@gmail.com}
12
12
  s.executables = [%q{deployment_test}]
@@ -25,6 +25,10 @@ module DeploymentTest
25
25
  end
26
26
  end
27
27
 
28
+ def database_exist?(name)
29
+ database_count(name).entries[0]['count'] != '0'
30
+ end
31
+
28
32
  private
29
33
 
30
34
  def postgres_connection
@@ -39,5 +43,9 @@ module DeploymentTest
39
43
  postgres_exec("SELECT COUNT(*) FROM pg_user WHERE usename='#{name}'")
40
44
  end
41
45
 
46
+ def database_count(name)
47
+ postgres_exec("SELECT COUNT(*) FROM pg_database WHERE datname='#{name}'")
48
+ end
49
+
42
50
  end
43
51
  end
@@ -2,7 +2,7 @@ module DeploymentTest
2
2
  module Version #:nodoc:
3
3
  MAJOR = 0
4
4
  MINOR = 0
5
- TINY = 4
5
+ TINY = 5
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join(".")
8
8
  end
@@ -53,4 +53,20 @@ describe DeploymentTest::Postgres do
53
53
  end
54
54
  end
55
55
 
56
+ describe "#database_exist?" do
57
+ subject { the_object.database_exist?(database_name) }
58
+
59
+ context "when database exist" do
60
+ let(:database_name) { "postgres" }
61
+
62
+ it { should be_true }
63
+ end
64
+
65
+ context "when database not exist" do
66
+ let(:database_name) { "example_not_existing_database" }
67
+
68
+ it { should be_false }
69
+ end
70
+ end
71
+
56
72
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: deployment_test
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:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-12-12 00:00:00.000000000Z
12
+ date: 2011-12-14 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: pg
16
- requirement: &70286759481160 !ruby/object:Gem::Requirement
16
+ requirement: &70265607299440 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,7 +21,7 @@ dependencies:
21
21
  version: 0.11.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70286759481160
24
+ version_requirements: *70265607299440
25
25
  description: Gem to perform common deployment testing
26
26
  email: pr0d1r2@gmail.com
27
27
  executables: