Refactor cucumber steps definitions
This commit is contained in:
		@@ -3,10 +3,10 @@ Given /^a playlist named "([^"]*)"$/ do |name|
 | 
				
			|||||||
end
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Then /^I should see "([^"]*)" and "([^"]*)" in a list$/ do |pl1, pl2|
 | 
					Then /^I should see "([^"]*)" and "([^"]*)" in a list$/ do |pl1, pl2|
 | 
				
			||||||
  page.should have_selector('ul>li:first-child', :text => pl1)
 | 
					  Then "I should see \"#{pl1}\" within \"ul>li:first-child\""
 | 
				
			||||||
  page.should have_selector('ul>li:first-child+li', :text => pl2)
 | 
					  Then "I should see \"#{pl2}\" within \"ul>li:first-child+li\""
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Then /^I should see "([^"]*)" in the list$/ do |playlist_name|
 | 
					Then /^I should see "([^"]*)" in the list$/ do |playlist_name|
 | 
				
			||||||
  page.should have_selector('ul>li', :text => playlist_name)
 | 
					  Then "I should see \"#{playlist_name}\" within \"ul>li\""
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -3,11 +3,8 @@ Given /^I am not signed in$/ do
 | 
				
			|||||||
end
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Given /^I am signed in$/ do
 | 
					Given /^I am signed in$/ do
 | 
				
			||||||
  user = Factory.create(:user)
 | 
					 | 
				
			||||||
  visit new_session_path
 | 
					  visit new_session_path
 | 
				
			||||||
  fill_in('Email', :with => user.email)
 | 
					  When "I submit valid credentials"
 | 
				
			||||||
  fill_in('Password', :with => user.password)
 | 
					 | 
				
			||||||
  click_button('Sign in')
 | 
					 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Then /^I should be redirected to the sign in page$/ do
 | 
					Then /^I should be redirected to the sign in page$/ do
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user