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.
- data/CHANGELOG.rdoc +3 -0
- data/deployment_test.gemspec +2 -2
- data/lib/deployment_test/postgres.rb +8 -0
- data/lib/deployment_test/version.rb +1 -1
- data/spec/deployment_test/postgres_spec.rb +16 -0
- metadata +4 -4
data/CHANGELOG.rdoc
CHANGED
data/deployment_test.gemspec
CHANGED
@@ -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.
|
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-
|
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
|
@@ -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
|
+
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
|
+
date: 2011-12-14 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: pg
|
16
|
-
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: *
|
24
|
+
version_requirements: *70265607299440
|
25
25
|
description: Gem to perform common deployment testing
|
26
26
|
email: pr0d1r2@gmail.com
|
27
27
|
executables:
|