spec/kumogata_diff_spec.rb in kumogata-0.2.7 vs spec/kumogata_diff_spec.rb in kumogata-0.2.8
- old
+ new
@@ -10,11 +10,11 @@
end
it 'compare templates logically' do
json_template = drupal_single_instance_template
json_template.sub!('localhost', '127.0.0.1')
- json_template.sub!('"ToPort": "80"', '"ToPort": "8080"')
+ json_template.sub!('"ToPort" : "80"', '"ToPort" : "8080"')
tempfile(json_template, '.templates') do |js|
tempfile(drupal_single_instance_template_rb, '.rb') do |rb|
diff = ruby_template = run_client(:diff, :arguments => [js.path, rb.path], :options => {:color => false})
diff = diff.split(/\n/).slice(2..-1).join("\n")
@@ -27,10 +27,89 @@
- "'@'127.0.0.1' IDENTIFIED BY '",
+ "'@'localhost' IDENTIFIED BY '",
{
"Ref": "DBPassword"
},
+@@ -437,7 +437,7 @@
+ {
+ "IpProtocol": "tcp",
+ "FromPort": "80",
+- "ToPort": "8080",
++ "ToPort": "80",
+ "CidrIp": "0.0.0.0/0"
+ },
+ {
EOS
+ end
+ end
+ end
+
+ it 'compare templates logically with "-w"' do
+ json_template = drupal_single_instance_template
+ json_template.sub!('localhost', '127.0.0.1')
+ json_template.sub!('"ToPort" : "80"', '"ToPort" : "8080"')
+
+ tempfile(json_template, '.templates') do |js|
+ tempfile(drupal_single_instance_template_rb, '.rb') do |rb|
+ diff = ruby_template = run_client(:diff, :arguments => [js.path, rb.path], :options => {:color => false, :ignore_all_space => true})
+ diff = diff.split(/\n/).slice(2..-1).join("\n")
+
+ expect(diff).to eq((<<-EOS).chomp)
+@@ -257,7 +257,7 @@
+ {
+ "Ref": "DBUsername"
+ },
+- "'@'127.0.0.1' IDENTIFIED BY '",
++ "'@'localhost' IDENTIFIED BY '",
+ {
+ "Ref": "DBPassword"
+ },
+@@ -437,7 +437,7 @@
+ {
+ "IpProtocol": "tcp",
+ "FromPort": "80",
+- "ToPort": "8080",
++ "ToPort": "80",
+ "CidrIp": "0.0.0.0/0"
+ },
+ {
+ EOS
+ end
+ end
+ end
+
+ it 'compare templates logically with whitespace' do
+ json_template = drupal_single_instance_template
+ json_template.sub!('localhost', 'local host')
+
+ tempfile(json_template, '.templates') do |js|
+ tempfile(drupal_single_instance_template_rb, '.rb') do |rb|
+ diff = ruby_template = run_client(:diff, :arguments => [js.path, rb.path], :options => {:color => false})
+ diff = diff.split(/\n/).slice(2..-1).join("\n")
+
+ expect(diff).to eq((<<-EOS).chomp)
+@@ -257,7 +257,7 @@
+ {
+ "Ref": "DBUsername"
+ },
+- "'@'local host' IDENTIFIED BY '",
++ "'@'localhost' IDENTIFIED BY '",
+ {
+ "Ref": "DBPassword"
+ },
+ EOS
+ end
+ end
+ end
+
+ it 'compare templates logically with whitespace and "-w"' do
+ json_template = drupal_single_instance_template
+ json_template.sub!('localhost', 'local host')
+
+ tempfile(json_template, '.templates') do |js|
+ tempfile(drupal_single_instance_template_rb, '.rb') do |rb|
+ diff = ruby_template = run_client(:diff, :arguments => [js.path, rb.path], :options => {:color => false, :ignore_all_space => true})
+ expect(diff).to be_empty
end
end
end
end