Sometimes you may need to change the month names that appear in the date_select (or anywhere in your application). One way of doing it is the following (setting Polish months names):
RSpec Stories, steps with parameters
class Date
MONTHNAMES = %w{Styczeń Luty Marzec Kwiecień
Maj Czerwiec Lipiec Sierpień
Wrzesień Październik Listopad Grudzień}
end
There is an easy way of reusing steps in RSpec stories.
Let's say you had a following step:
Given a search for chess
which was implemented with a hardcoded value like that:
Given "a search for chess" do
@search_term = 'chess'
end
And now you'd like to add another, very similar scenario:
Given a search for bridge
You can reuse the previously implemented step by changing the implementation to:
Given "a search for $term" do |term|
@search_term = term
end
Thanks to that, you can now reuse this step in as many scenarios as you want.
You can find a nice explanation of RSpec stories on Edd Dumbill's blog.
No comments:
Post a Comment