Created
November 12, 2015 17:01
-
-
Save anonymous/564e3f12d0b0c46a4533 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gem 'cucumber' | |
def is_palindrome(str) | |
if str.downcase.reverse == str.downcase | |
puts('palindrome') | |
else | |
puts('NOT a palindrome') | |
end | |
end | |
puts 'Enter a string' | |
input_str = gets | |
is_palindrome(input_str.chomp) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Feature: lower case palindromes | |
This is testing the input of lower case strings | |
that may be palindromes | |
Scenario: testing lowercase | |
Given is_Palindrome is run | |
When the input string is "oofoo" | |
Then the result should be "palindrome" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Given(/^isPalindrome is run$/) do | |
@isPalindrome = isPalindrome.new | |
end | |
When(/^the input string is "([^"]*)"$/) do |arg1| | |
result = isPalindrome.is_palindrome(arg1) | |
end | |
Then(/^the result should be "([^"]*)"$/) do |expected_result| | |
result == expected_result.chomp | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment