Sha256: 645728faf73390e5f19f27852fcc4339942a0203c6f2186333078c7b2b596df2

Contents?: true

Size: 1.16 KB

Versions: 6

Compression:

Stored size: 1.16 KB

Contents

ENV["RAILS_ENV"] = "test"
require ::File.expand_path('../rails/config/environment',  __FILE__)

# Rails.public_path = Rails.root + "test" + "rails" + "public"
require 'riot'
require 'ostruct'

# require 'smurf'
require ::File.expand_path('../../lib/smurf',  __FILE__)

class AssetFile
  def self.base_path
    @path ||= Rails.public_path
  end

  def self.read(relative_path)
    File.read(base_path + relative_path)
  end
end

class Riot::Context
  def should_have_same_contents(expected_path, actual_path)
    asserts "#{actual_path} has the same file contents as #{expected_path}" do
      AssetFile.read(actual_path)
    end.equals(AssetFile.read(expected_path))
  end
end

class Riot::Situation
  include ActionView::Helpers::TagHelper
  include ActionView::Helpers::AssetTagHelper

  def controller; nil; end

  def config
    OpenStruct.new({
      :assets_dir => Rails.public_path,
      :javascripts_dir => Rails.public_path + "/javascripts",
      :stylesheets_dir => Rails.public_path + "/stylesheets",
      :perform_caching => true
    })
  end
end

at_exit do
  artifacts = Dir.glob(File.join(AssetFile.base_path, '**', 'cache', 'actual*.*'))
  FileUtils.rm(artifacts)
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
ps-smurf-1.2.0 test/test_helper.rb
smurf-1.0.8 test/test_helper.rb
smurf-1.0.7 test/test_helper.rb
smurf-1.0.6 test/test_helper.rb
smurf-1.0.5 test/test_helper.rb
smurf-1.0.4.rails3.beta3 test/test_helper.rb