fixing cucumber tests (still wip)

This commit is contained in:
Didier Lafforgue 2012-02-29 02:11:56 +01:00
parent c5577240de
commit b994b87194
6 changed files with 28 additions and 20 deletions

View File

@ -23,27 +23,27 @@ Scenario:
Then I should see "My sexy project" Then I should see "My sexy project"
Scenario: Add a new entry Scenario: Add a new entry
When I go to the "Projects" model edition page When I go to the "Projects" model list page
And I follow "new item" And I follow "new entry"
Then I should see "Projects new item" Then I should see "Projects new entry"
When I fill in "Name" with "My other sexy project" When I fill in "Name" with "My other sexy project"
And I fill in "Description" with "Lorem ipsum...." And I fill in "Description" with "Lorem ipsum...."
And I press "Create" And I press "Create"
Then I should see "Content was successfully created." Then I should see "Entry was successfully created."
Scenario: Add an invalid entry Scenario: Add an invalid entry
When I go to the "Projects" model edition page When I go to the "Projects" model list page
And I follow "new item" And I follow "new entry"
And I fill in "Description" with "Lorem ipsum...." And I fill in "Description" with "Lorem ipsum...."
And I press "Create" And I press "Create"
Then I should not see "Content was successfully created." Then I should not see "Entry was successfully created."
Scenario: Update an existing entry Scenario: Update an existing entry
When I go to the "Projects" model list page When I go to the "Projects" model list page
And I follow "My sexy project" And I follow "My sexy project"
When I fill in "Name" with "My other sexy project (UPDATED)" When I fill in "Name" with "My other sexy project (UPDATED)"
And I press "Save" And I press "Save"
Then I should see "Content was successfully updated." Then I should see "Entry was successfully updated."
When I go to the "Projects" model list page When I go to the "Projects" model list page
Then I should see "My other sexy project (UPDATED)" Then I should see "My other sexy project (UPDATED)"
@ -52,12 +52,12 @@ Scenario: Update an invalid entry
And I follow "My sexy project" And I follow "My sexy project"
When I fill in "Name" with "" When I fill in "Name" with ""
And I press "Save" And I press "Save"
Then I should not see "Content was successfully updated." Then I should not see "Entry was successfully updated."
Scenario: Destroy an entry Scenario: Destroy an entry
When I go to the "Projects" model list page When I go to the "Projects" model list page
And I follow image link "Delete" And I follow "x"
Then I should see "Content was successfully deleted." Then I should see "Entry was successfully deleted."
And I should not see "My sexy project" And I should not see "My sexy project"
Scenario: Group entries by category Scenario: Group entries by category

View File

@ -15,7 +15,7 @@ Background:
"yield" "yield"
""" """
Scenario: Creating a Snippet Scenario: Creating a snippet
When I go to theme assets When I go to theme assets
And I follow "new snippet" And I follow "new snippet"
And I fill in "Name" with "Banner" And I fill in "Name" with "Banner"
@ -25,14 +25,15 @@ Scenario: Creating a Snippet
Then I should see "Snippet was successfully created." Then I should see "Snippet was successfully created."
And I should have "banner" in the banner snippet And I should have "banner" in the banner snippet
Scenario: Updating a Snippet that includes another snippet @javascript
Scenario: Updating a snippet that includes another snippet
Given a snippet named "other" with the template: Given a snippet named "other" with the template:
""" """
"other" "other"
""" """
When I go to theme assets When I go to theme assets
And I follow "yield" And I follow "yield"
And I fill in "snippet_template" with "{% include 'other' %}" And I change the snippet template to "{% include other %}"
And I press "Save" And I press "Save"
Then I should see "Snippet was successfully updated." Then I should see "Snippet was successfully updated."
And I should have "{% include 'other' %}" in the yield snippet And I should have "{% include other %}" in the yield snippet

View File

@ -55,7 +55,7 @@ end
When %r{^I change the presentation of the "([^"]*)" model by grouping items by "([^"]*)"$} do |name, field| When %r{^I change the presentation of the "([^"]*)" model by grouping items by "([^"]*)"$} do |name, field|
content_type = Locomotive::ContentType.where(:name => name).first content_type = Locomotive::ContentType.where(:name => name).first
field = content_type.entries_custom_fields.detect { |f| f.label == field } field = content_type.entries_custom_fields.detect { |f| f.label == field }
content_type.group_by_field_name = field._name content_type.group_by_field_id = field._id
content_type.save.should be_true content_type.save.should be_true
end end

View File

@ -13,6 +13,14 @@ Given /^a snippet named "([^"]*)" with the template:$/ do |name, template|
@snippet = create_snippet(name, template) @snippet = create_snippet(name, template)
end end
When /^I change the snippet template to "([^"]*)"$/ do |code|
page.evaluate_script "window.application_view.view.editor.setValue('#{code}')"
end
# Then /^I should see "([^"]*)" as the snippet template$/ do |code|
# find(:css, "#theme_asset_plain_text").value.should == code
# end
# checks to see if a string is in the slug # checks to see if a string is in the slug
Then /^I should have "(.*)" in the (.*) snippet/ do |content, snippet_slug| Then /^I should have "(.*)" in the (.*) snippet/ do |content, snippet_slug|
snippet = @site.snippets.where(:slug => snippet_slug).first snippet = @site.snippets.where(:slug => snippet_slug).first

View File

@ -30,7 +30,6 @@ Given /^I have an image theme asset named "([^"]*)"$/ do |name|
@asset.save! @asset.save!
end end
# other stuff # other stuff
# change the template # change the template

View File

@ -35,9 +35,9 @@ module NavigationHelpers
when /the "(.*)" model creation page/ when /the "(.*)" model creation page/
content_type = Locomotive::Site.first.content_types.where(:name => $1).first content_type = Locomotive::Site.first.content_types.where(:name => $1).first
new_content_entry_path(content_type.slug) new_content_entry_path(content_type.slug)
when /the "(.*)" model edition page/ # when /the "(.*)" model edition page/
content_type = Locomotive::Site.first.content_types.where(:name => $1).first # content_type = Locomotive::Site.first.content_types.where(:name => $1).first
edit_content_entries_path(content_type) # edit_content_entry_path(content_type)
# Add more mappings here. # Add more mappings here.
# Here is an example that pulls values out of the Regexp: # Here is an example that pulls values out of the Regexp: