ansible_spec 0.2 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e07abc240db36cb4184a4e946f019a330bd78716
4
- data.tar.gz: db7a9f7a615c072f922927aed321e35233e018d0
3
+ metadata.gz: 97d3791daa7f2224554c8c7a361d4c3a19f6e0f9
4
+ data.tar.gz: 31bfe5f3c915b3797917b67ce0d21bad52debf9b
5
5
  SHA512:
6
- metadata.gz: fe5e7d75a375f5dd0bc9aeeecf37f0f2409ee819bb496dcd5e657cd880196b6dbbc80747383ee03447cfdfcb07ab775edf14d2c5ac6ad81142b303700f41aabe
7
- data.tar.gz: a3b2e12c8ae73ff2aeafd5bb0990def9433bda0031ce3b0b2d4e121dba13f04db119acdcd4830e0dab7190b3a7d619d4b5fc0a58d19479ee70fb984537606d97
6
+ metadata.gz: 38975c66323cf9b219d7fce75ac7e40582d3573fc4fe145657db1db982727f39ae2bd93c8739fd8e5ffeb57550acd247d39c75adf136311819c15bf1658f4cbb
7
+ data.tar.gz: 1d6c2cda3f7dc488c7a6f4e0822bfd2105780b46b338a720513ea5ede2955938c49d9d0b0d47be197f8f4e13db4a30a3979f698994de32a37796f77a0bb4a6fe
data/.travis.yml CHANGED
@@ -3,9 +3,7 @@ sudo: false
3
3
  rvm:
4
4
  - 1.9.3
5
5
  - 2.0.0
6
- - 2.1.0
7
- - 2.1.1
8
- - 2.2.0
9
- - 2.2.1
6
+ - 2.1.6
7
+ - 2.2.2
10
8
  script:
11
9
  - rspec spec
data/CHANGELOG.md CHANGED
@@ -1,3 +1,14 @@
1
+ # v0.2.1
2
+ - fix #27 check name on playbook
3
+ - Add Test
4
+ - 2.1.6
5
+ - 2.2.2
6
+ - Delete Test
7
+ - 2.1.0
8
+ - 2.1.1
9
+ - 2.2.0
10
+ - 2.2.1
11
+
1
12
  # v0.2
2
13
  - fix #24 Support ENV
3
14
 
@@ -162,7 +162,22 @@ module AnsibleSpec
162
162
  properties.push site
163
163
  end
164
164
  end
165
- return properties
165
+ if name_exist?(properties)
166
+ return properties
167
+ else
168
+ fail "Please insert name on playbook"
169
+ end
170
+ end
171
+
172
+ # Issue 27
173
+ # param: array
174
+ # return: boolean
175
+ # true: name is exist on playbook
176
+ # false: name is not exist on playbook
177
+ def self.name_exist?(array)
178
+ array.each do |site|
179
+ return site.has_key?("name") ? true : false
180
+ end
166
181
  end
167
182
 
168
183
  # return: json
@@ -1,3 +1,3 @@
1
1
  module AnsibleSpec
2
- VERSION = "0.2"
2
+ VERSION = "0.2.1"
3
3
  end
@@ -527,6 +527,59 @@ EOF
527
527
  File.delete(tmp_pb)
528
528
  end
529
529
  end
530
+
531
+ context '異常系(playbook内にnameがない場合)' do
532
+ require 'yaml'
533
+ tmp_pb = 'playbook'
534
+ before do
535
+ content = <<'EOF'
536
+ - hosts: server
537
+ user: root
538
+ roles:
539
+ - nginx
540
+ - mariadb
541
+ EOF
542
+ create_file(tmp_pb,content)
543
+ end
544
+
545
+ it 'exitする' do
546
+ expect{ AnsibleSpec.load_playbook(tmp_pb) }.to raise_error("Please insert name on playbook")
547
+ end
548
+
549
+ after do
550
+ File.delete(tmp_pb)
551
+ end
552
+ end
553
+ end
554
+
555
+ describe "name_exist?の実行" do
556
+ context '正常系' do
557
+ before do
558
+ h = Hash.new
559
+ h["name"] = "test"
560
+ ar = Array.new
561
+ ar << h
562
+ @res_t = AnsibleSpec.name_exist?(ar)
563
+ end
564
+
565
+ it 'res_t is true' do
566
+ expect(@res_t).to be_truthy
567
+ end
568
+ end
569
+
570
+ context '異常系' do
571
+ before do
572
+ h = Hash.new
573
+ h["var"] = "test"
574
+ ar = Array.new
575
+ ar << h
576
+ @res_f = AnsibleSpec.name_exist?(ar)
577
+ end
578
+
579
+ it 'res_f is false' do
580
+ expect(@res_f).to be_falsey
581
+ end
582
+ end
530
583
  end
531
584
 
532
585
  describe "load_ansiblespecの実行" do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ansible_spec
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.2'
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - volanja
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-16 00:00:00.000000000 Z
11
+ date: 2015-07-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler