Sha256: d7a9a05bc679c48af7e1694902e33867a9d048233cedccf34c17d5b003bb89f7

Contents?: true

Size: 755 Bytes

Versions: 14

Compression:

Stored size: 755 Bytes

Contents

module LayoutTestHelper
  
  VALID_LAYOUT_PARAMS = {
   :name => 'Test Layout',
   :content => 'Just a test.'
  }

  def layout_params(options = {})
    params = VALID_LAYOUT_PARAMS.dup
    params.merge!(:name => @layout_name) if @layout_name
    params.merge!(options)
  end

  def destroy_test_layout(name = @layout_name)
    while layout = get_test_layout(name) do
      layout.destroy
    end
  end
  
  def get_test_layout(name = @layout_name)
    Layout.find_by_name(name)
  end
  
  def create_test_layout(name = @layout_name)
    params = layout_params
    params.merge!(:name => name) if name
    layout = Layout.new(params)
    if layout.save
      layout
    else
      raise "layout <#{layout.inspect}> could not be saved"
    end
  end
  
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
radiant-0.5.1 test/helpers/layout_test_helper.rb
radiant-0.5.0 test/helpers/layout_test_helper.rb
radiant-0.6.1 test/helpers/layout_test_helper.rb
radiant-0.6.0 test/helpers/layout_test_helper.rb
radiant-0.5.2 test/helpers/layout_test_helper.rb
radiant-0.6.3 test/helpers/layout_test_helper.rb
radiant-0.6.2 test/helpers/layout_test_helper.rb
radiant-0.6.4 test/helpers/layout_test_helper.rb
radiant-0.6.5.1 test/helpers/layout_test_helper.rb
radiant-0.6.5 test/helpers/layout_test_helper.rb
radiant-0.6.6 test/helpers/layout_test_helper.rb
radiant-0.6.7 test/helpers/layout_test_helper.rb
radiant-0.6.8 test/helpers/layout_test_helper.rb
radiant-0.6.9 test/helpers/layout_test_helper.rb