Added a failing feature for updating a snippet

This commit is contained in:
Mario Visic 2011-06-02 21:15:11 +08:00
parent a5bf4664f2
commit 60c48f4f2e
2 changed files with 32 additions and 0 deletions

View File

@ -0,0 +1,25 @@
Feature: Snippets
In order to manage snippets
As an administrator
I want to add/edit/delete snippets of my site
Background:
Given I have the site: "test site" set up
And I am an authenticated user
And a snippet named "yield" with the template:
"""
HELLO WORLD !
"""
Scenario: Updating a Snippet that includes another snippet
And a page named "snippet-test" with the template:
"""
{% include 'yield' %}
"""
When I go to theme assets
And I follow "yield"
And I fill in "snippet_template" with "{% include 'other' %}"
And I press "Update"
Then I should see "Snippet was successfully updated."
And I should have "{% include 'other' %}" in the yield snippet
Then show me the page

View File

@ -13,4 +13,11 @@ Given /^a snippet named "([^"]*)" with the template:$/ do |name, template|
@snippet = create_snippet(name, template)
end
# checks to see if a string is in the slug
Then /^I should have "(.*)" in the (.*) snippet/ do |content, snippet_slug|
snippet = @site.snippets.where(:slug => snippet_slug).first
raise "Could not find snippet: #{snippet_slug}" unless snippet
snippet.template.should == content
end