Instructions
Use it to call methods on the block parameter.
Create a function upcase_all that converts each string to uppercase.
Instead of:
ruby
words.map { |w| w.upcase }
Use:
ruby
words.map { it.upcase }
Hints:
- Use .map { it.upcase }
- 'it' is the block parameter
- You can call any method on 'it'
Your Code
def upcase_all(words)
words.map { it.upcase }
end
RSpec.describe "upcase_all with 'it'" do
it "upcases each word" do
expect(upcase_all(["hello", "world"])).to eq(["HELLO", "WORLD"])
end
it "handles mixed case" do
expect(upcase_all(["Ruby", "RAILS"])).to eq(["RUBY", "RAILS"])
end
end
Results
Click "Run Tests" to see results