Sha256: 53234a31e445666c5c823dc3d266f71259700c0b8c4d6d60cd491672fe8f9539

Contents?: true

Size: 1.04 KB

Versions: 26

Compression:

Stored size: 1.04 KB

Contents

### Snippets

# helps create a simple snippet with a slug and template
def new_snippet(name, template = nil)
  @site.snippets.new(:name => name, :template => template)
end

def create_snippet(name, template = nil)
  snippet = new_snippet(name, template)
  snippet.save!
  snippet
end

# creates a snippet

Given /^a snippet named "([^"]*)" with the template:$/ do |name, template|
  @snippet = create_snippet(name, template)
end

Given /^a snippet named "([^"]*)" with id "([^"]*)" and template:$/ do |name, id, template|
  @snippet = new_snippet(name, template)
  @snippet.id = Moped::BSON::ObjectId(id)
  @snippet.save!
end

When /^I change the snippet template to "([^"]*)"$/ do |code|
  page.evaluate_script "window.application_view.view.editor.setValue('#{code}')"
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

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
locomotive_cms-2.5.7 features/step_definitions/snippet_steps.rb
locomotive_cms-2.5.6 features/step_definitions/snippet_steps.rb
locomotive_cms-2.5.6.rc2 features/step_definitions/snippet_steps.rb
locomotive_cms-2.5.6.rc1 features/step_definitions/snippet_steps.rb
locomotive_cms-2.5.5 features/step_definitions/snippet_steps.rb
locomotive_cms-2.5.4 features/step_definitions/snippet_steps.rb
locomotive_cms-2.5.3 features/step_definitions/snippet_steps.rb
locomotive_cms-2.5.2 features/step_definitions/snippet_steps.rb
locomotive_cms-2.5.1 features/step_definitions/snippet_steps.rb
locomotive_cms-2.5.0 features/step_definitions/snippet_steps.rb
locomotive_cms-2.5.0.rc3 features/step_definitions/snippet_steps.rb
locomotive_cms-2.5.0.rc2 features/step_definitions/snippet_steps.rb
locomotive_cms-2.5.0.rc1 features/step_definitions/snippet_steps.rb
locomotive_cms-2.4.1 features/step_definitions/snippet_steps.rb
locomotive_cms-2.4.0 features/step_definitions/snippet_steps.rb
locomotive_cms-2.3.1 features/step_definitions/snippet_steps.rb
locomotive_cms-2.3.0 features/step_definitions/snippet_steps.rb
locomotive_cms-2.2.3 features/step_definitions/snippet_steps.rb
locomotive_cms-2.2.2 features/step_definitions/snippet_steps.rb
locomotive_cms-2.2.1 features/step_definitions/snippet_steps.rb