finish migration of the feeds page

This commit is contained in:
Reinier Balt 2010-11-27 17:12:09 +01:00
parent 51106d015e
commit 2fa431ef54
14 changed files with 205 additions and 128 deletions

View file

@ -10,7 +10,7 @@ Given /^there exists an active context called "([^"]*)" for user "([^"]*)"$/ do
end
Given /^there exists a context called "([^"]*)" for user "([^"]*)"$/ do |context_name, login|
Given "there exists an active context called \"#{context_name}\" for user \"#{login}\""
Given "there exists an active context called \"#{context_name}\" for user \"#{login}\""
end
Given /^there exists a hidden context called "([^"]*)" for user "([^"]*)"$/ do |context_name, login|
@ -75,3 +75,8 @@ end
Then /^he should see that a context named "([^\"]*)" is not present$/ do |context_name|
Then "I should not see \"#{context_name} (\""
end
Then /^I should see feeds for "([^"]*)" in list of "([^"]*)"$/ do |name, list_type|
xpath= "//div[@id='feeds-for-#{list_type}']//strong"
name.should == response.selenium.get_text("xpath=#{xpath}")
end

View file

@ -0,0 +1,31 @@
Then /^I should see a message that you need a context to get feeds for contexts$/ do
Then "I should see \"There need to be at least one context before you can request a feed\""
end
Then /^I should see a message that you need a project to get feeds for projects$/ do
Then "I should see \"There need to be at least one project before you can request a feed\""
end
Then /^I should see feeds for projects$/ do
within 'select[id="feed-projects"]' do |scope|
scope.should have_selector("option[value=\"#{@current_user.projects.first.id}\"]")
end
end
Then /^I should see feeds for contexts$/ do
within 'select[id="feed-contexts"]' do |scope|
scope.should have_selector("option[value=\"#{@current_user.contexts.first.id}\"]")
end
end
Then /^I should see "([^"]*)" as the selected project$/ do |project_name|
within 'select[id="feed-projects"]' do |scope|
scope.should have_selector("option[selected=\"selected\"]", :content => project_name)
end
end
Then /^I should see "([^"]*)" as the selected context$/ do |context_name|
within 'select[id="feed-contexts"]' do |scope|
scope.should have_selector("option[selected=\"selected\"]", :content => context_name)
end
end

View file

@ -24,6 +24,16 @@ Given /^I have a project called "([^"]*)"$/ do |project_name|
Given "there exists a project \"#{project_name}\" for user \"#{@current_user.login}\""
end
Given /^I have the following projects:$/ do |table|
table.hashes.each do |project|
Given 'I have a project called "'+project[:project_name]+'"'
end
end
Given /^I have no projects$/ do
Project.delete_all
end
When /^I visit the "([^\"]*)" project$/ do |project_name|
@project = Project.find_by_name(project_name)
@project.should_not be_nil