More specific Behat assertion for page editability

This commit is contained in:
Ingo Schommer 2013-12-02 18:36:17 +01:00
parent ec41cb38ce
commit 78b9ef2df3

View File

@ -55,14 +55,13 @@ class FixtureContext extends \SilverStripe\BehatExtension\Context\FixtureContext
* @Then /^pages should( not? |\s*)be editable by "([^"]*)"$/ * @Then /^pages should( not? |\s*)be editable by "([^"]*)"$/
*/ */
public function pagesShouldBeEditableBy($negative, $member){ public function pagesShouldBeEditableBy($negative, $member){
$edit = '"/admin/pages/edit"'; $page = \Page::get()->First();
$editable = 'I should'.$negative.'see an edit page form';
return array( return array(
new Step\Given('I am not logged in'), new Step\Given('I am not logged in'),
new Step\Given('I am logged in with "'.$member.'" permissions'), new Step\Given('I am logged in with "' . $member . '" permissions'),
new Step\Given('I go to '.$edit), new Step\Given('I go to "/admin/pages/edit/show/' . $page->ID . '"'),
new Step\Given($editable), new Step\Given('I should' . $negative . 'see a "Page name" field'),
new Step\Then('I am on the homepage') new Step\Then('I am on the homepage')
); );
} }