Sha256: 4e17a0570983b120e0f2e8934216c3a21b475799f7aca7c9b2382cec2c348300

Contents?: true

Size: 866 Bytes

Versions: 2

Compression:

Stored size: 866 Bytes

Contents

module Fixtures
  FIXTURES_PATH = (Staticpress.root + '..' + 'spec' + 'fixtures').expand_path
  TEMP_PATH = (Staticpress.root + '..' + 'tmp').expand_path

  def basic_blog
    setup_blog 'test_blog'
  end

  def setup_blog(name)
    source_path = FIXTURES_PATH + name
    temp_path = TEMP_PATH + name

    before :each do
      FileUtils.rm_rf temp_path if temp_path.directory?
      FileUtils.cp_r source_path, temp_path

      Staticpress.blog_path = temp_path.clone
    end

    after :each do
      Staticpress.blog_path = '.'
    end
  end

  def create_sample_blog(title = 'Transient Thoughts')
    before :each do
      blog_title = title ? "'#{title}'" : nil
      run_simple "staticpress new temporary_blog #{blog_title}"
      cd('temporary_blog')
      append_to_file 'Gemfile', <<-RUBY
gem 'staticpress', :path => '../../..'
      RUBY
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
staticpress-0.7.1 spec/support/fixtures.rb
staticpress-0.7.0 spec/support/fixtures.rb