Hello folks,
I am trying to learn Cucumber and testing in general.
I am working on a app fo lingustic studies, but for the purpose of
testing it can be compared to a "guess the song" app. When a new quiz
is
take, a page shows a number of flash players, each one with a single
track. The app works, but I cannot pass the cucumber test.
Here is my step definition:
[code]
Then /^I should see a flash player with "([^\"]*)"$/ do |arg1|
response.should have_selector(''param'', :name =>
''FlashVars'') do
|param|
param.should =~ /.+#{Regexp.escape("numero-1")}.+/m
end
end
[/code]
I have been tweaking the regex a bit (eliminating the .+ and so on) but
the test always fails.
Here''s the response:
[code]
Then I should see a flash player with "Corduroy"
# features/step_definitions/experiment_step.rb:14
expected: /.+numero\-1.+/m,
got: <param name="FlashVars"
value="playerID=1&soundFile=/system/tracks/1/original/numero-1.mp3?1250785635
%>">
<param name="FlashVars"
value="playerID=1&soundFile=/system/tracks/2/original/numero-1.mp3?1250785635
%>">
<param name="FlashVars"
value="playerID=1&soundFile=/system/tracks/1/original/numero-1.mp3?1250785635
%>">
<param name="FlashVars"
value="playerID=1&soundFile=/system/tracks/2/original/numero-1.mp3?1250785635
%>">
(using =~)
[/code]
Any suggestion?
Thanks in advance.
--
Posted via http://www.ruby-forum.com/.