Implement tracks/{show,listen}
This commit is contained in:
11
features/step_definitions/tracks_step.rb
Normal file
11
features/step_definitions/tracks_step.rb
Normal file
@@ -0,0 +1,11 @@
|
||||
Given /^a track named "([^"]*)"$/ do |name|
|
||||
@track = Track.create!(:name => name)
|
||||
end
|
||||
|
||||
Then /^I should see an audio player$/ do
|
||||
page.should have_xpath '//audio'
|
||||
end
|
||||
|
||||
Then /^it should provide an audio stream for "([^"]*)"$/ do |name|
|
||||
page.should have_xpath "//audio[@src='#{stream_track_path(@track)}']"
|
||||
end
|
@@ -1,31 +1,19 @@
|
||||
module NavigationHelpers
|
||||
# Maps a name to a path. Used by the
|
||||
#
|
||||
# When /^I go to (.+)$/ do |page_name|
|
||||
#
|
||||
# step definition in web_steps.rb
|
||||
#
|
||||
def path_to(page_name)
|
||||
case page_name
|
||||
|
||||
when /^the home\s?page$/
|
||||
'/'
|
||||
|
||||
# Add more mappings here.
|
||||
# Here is an example that pulls values out of the Regexp:
|
||||
#
|
||||
# when /^(.*)'s profile page$/i
|
||||
# user_profile_path(User.find_by_login($1))
|
||||
|
||||
else
|
||||
begin
|
||||
page_name =~ /^the (.*) page$/
|
||||
path_components = $1.split(/\s+/)
|
||||
self.send(path_components.push('path').join('_').to_sym)
|
||||
rescue NoMethodError, ArgumentError
|
||||
raise "Can't find mapping from \"#{page_name}\" to a path.\n" +
|
||||
"Now, go and add a mapping in #{__FILE__}"
|
||||
end
|
||||
when /^the home\s?page$/
|
||||
'/'
|
||||
when /^the track page for "([^\"]*)"$/
|
||||
track_path Track.find_by_name($1)
|
||||
else
|
||||
begin
|
||||
page_name =~ /^the (.*) page$/
|
||||
path_components = $1.split(/\s+/)
|
||||
self.send(path_components.push('path').join('_').to_sym)
|
||||
rescue NoMethodError, ArgumentError
|
||||
raise "Can't find mapping from \"#{page_name}\" to a path.\n" +
|
||||
"Now, go and add a mapping in #{__FILE__}"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
16
features/tracks.feature
Normal file
16
features/tracks.feature
Normal file
@@ -0,0 +1,16 @@
|
||||
Feature: Tracks
|
||||
|
||||
So that I can listen music
|
||||
As a listener
|
||||
I want to add, manage and listen some tracks
|
||||
|
||||
Scenario: Show track
|
||||
Given a track named "Mega song"
|
||||
When I go to the track page for "Mega song"
|
||||
Then I should see "Mega song" within "h1"
|
||||
|
||||
Scenario: Listen track
|
||||
Given a track named "Mega song"
|
||||
When I go to the track page for "Mega song"
|
||||
Then I should see an audio player
|
||||
And it should provide an audio stream for "Mega song"
|
Reference in New Issue
Block a user