Hello,

I have come up with the following code.  It involves checking a sentence 
with some conditions.  I am in need of writing a RSpec for this particular 
file.

Class Sentence
def test(sen)

first = sen[0]
last = sen.split('').last
rest = sen[1..-1]
word_arr = sen.split
word_arr_len = word_arr.length

unless first == first.upcase then
puts "The first letter is not in uppercase"
end

if  word_arr_len == 1 then
puts "There must be spaces between words"
end

unless last == "." || last = last.upcase then
puts "The sentence should end with a full stop"
end

unless (sen =~ /[A-Z]{2,}/) == nil then
puts "No two consecutive upper case letters are allowed"
end

unless sen == word_arr.join(" ")  then
puts "No two consecutive spaces are allowed"
end
end
end


#test("Simple sentence.")

I want to write a simple RSpec code that passes a value to the test method 
[Similar to the last commented line].  Kindly help me out!

Thanks in advance.

-- 
You received this message because you are subscribed to the Google Groups 
"rspec" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rspec/68cfabb6-e197-47ea-a1fe-e9dc87ee151b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to