palindrome-jagzzs 0.0.0 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 96383db46b14cad567a660623320eb3446d8e2d9
4
- data.tar.gz: e89276db497c8cf427cb05241ee693b9ef503d1e
3
+ metadata.gz: f6655bfa3047471610dafb18babdedea07241366
4
+ data.tar.gz: 79e6bb90322c83e26eeec6276f15f009150150e2
5
5
  SHA512:
6
- metadata.gz: 0bed6db19adfb5dff1c90bbfc5692443cf2964c6684c7916b2c33ad3333dab1474ec641d21c42ecef7966a176a48007c5270db7e0652f13fdf152861e0a83913
7
- data.tar.gz: 348f268325d7c07d0c602f91e3b91662ab2b8e4fd025b9d8f2212ddbd5cdc8acd0393e2d8cf74f13d9ccc9b96623bc5b377218723607db3611cb92fd89b61016
6
+ metadata.gz: e33e1aed9732393c5321ad6a81894aa9d91d1a16e4fd121eeabbca672a46ba17502ac80944d90b0b1901d5b7021f11fad5327e92ba59225b9b46784033f95142
7
+ data.tar.gz: c96a8969a71c7fc76c8f79283ef25f8e3cc6ef35f331810b6ff817e7ae142560527aa9a7aeb2dcf7dc9798429d70ee8f707324d1f0c8c91c8950c407ad7b5d9c
@@ -29,7 +29,9 @@ def evaluate_input(input)
29
29
  end
30
30
 
31
31
  if !input.palindrome?
32
- abort "Not a palindrome"
32
+ abort "Input is not a palindrome"
33
+ else
34
+ puts "Input is a palindrome"
33
35
  end
34
36
 
35
37
  exit 0
@@ -1,4 +1,4 @@
1
- require_relative "palindrome"
1
+ require "palindrome"
2
2
  require "test/unit"
3
3
 
4
4
  class TestPalindrome < Test::Unit::TestCase
@@ -41,8 +41,14 @@ class TestPalindrome < Test::Unit::TestCase
41
41
  assert_equal(phrase.palindrome?, false, "The phrase \"" + phrase + "\" returned that's a palindrome")
42
42
  end
43
43
 
44
- def test_invalid_input_exits
45
- assert_raise(SystemExit) { evaluate_input("This is clearly not a palindrome") }
44
+ def test_invalid_input_exits_with_1
45
+ assert_raise(SystemExit) do
46
+ begin
47
+ evaluate_input("This is clearly not a palindrome")
48
+ rescue SystemExit => e
49
+ raise e if e.status == 1
50
+ end
51
+ end
46
52
  end
47
53
 
48
54
  #positive tests
@@ -83,7 +89,14 @@ class TestPalindrome < Test::Unit::TestCase
83
89
  assert_equal(phrase.palindrome?, true, "The phrase \"" + phrase + "\" returned that's not a palindrome")
84
90
  end
85
91
 
86
- def test_valid_input_does_not_exits
87
- assert_nothing_raised(SystemExit) { evaluate_input("abba") }
92
+ def test_valid_input_exits_with_0
93
+ assert_nothing_raised(SystemExit) do
94
+ begin
95
+ evaluate_input("abba")
96
+ rescue SystemExit => e
97
+ raise e unless e.status == 0
98
+ end
99
+ end
88
100
  end
101
+
89
102
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: palindrome-jagzzs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jesus Gonzalez
@@ -14,12 +14,10 @@ description: Simple algorithm for analyzing if user's input is a palindrome.
14
14
  email: jagzzs21@gmail.com
15
15
  executables:
16
16
  - palindrome
17
- - palindromo
18
17
  extensions: []
19
18
  extra_rdoc_files: []
20
19
  files:
21
20
  - bin/palindrome
22
- - bin/palindromo
23
21
  - lib/palindrome.rb
24
22
  - test/tc_palindrome.rb
25
23
  homepage: http://rubygems.org/gems/palindrome_jagzzs
@@ -1,5 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require_relative '../lib/palindrome'
4
-
5
- evaluate_input(ARGV.empty? ? nil : ARGV[0])