Permalink
Browse files

Stasis adapter specs

  • Loading branch information...
1 parent 76fd433 commit b136efe634e00afdac1ca5c11408bc2fefc1d3fa @winton committed Jul 9, 2012
@@ -8,12 +8,12 @@ class Stasis < ::Stasis::Plugin
def initialize(stasis)
@stasis = stasis
-
- SmartAsset.env = stasis.options[:development] ? 'development' : 'production'
SmartAsset.load_config(@stasis.root)
end
def before_all
+ SmartAsset.env = @stasis.options[:development] ?
+ 'development' : 'production'
SmartAsset.cache = nil
@asset_rendered = false
View
@@ -25,6 +25,7 @@ Gem::Specification.new do |s|
s.add_development_dependency "rails", "~> 3.0"
s.add_development_dependency "rspec", "~> 1.0"
s.add_development_dependency "sinatra", "~> 1.0"
+ s.add_development_dependency "stasis", "~> 0.0"
s.add_dependency "change"
end
@@ -30,4 +30,11 @@ sinatra:
- application.rb
all_frameworks:
- test.html.erb
+ - config/assets.yml
+stasis:
+ <1:
+ stasis:
+ - controller.rb
+ all_frameworks:
+ - test.html.erb
- config/assets.yml
@@ -0,0 +1 @@
+require "smart_asset"
@@ -0,0 +1,27 @@
+require File.expand_path("#{File.dirname(__FILE__)}/../../spec_helper")
+
+if FrameworkFixture.stasis
+ describe 'Stasis' do
+
+ before(:all) do
+ @stasis = FrameworkFixture.app.call
+ assets = "#{$root}/spec/fixtures/assets"
+ @build = "#{$root}/spec/fixtures/builds/stasis#{FrameworkFixture.exact_version[0..0]}"
+ FileUtils.mkdir_p "#{@build}/public"
+ FileUtils.mkdir_p "#{@build}_output"
+ FileUtils.rm_rf "#{@build}_output/packaged"
+ FileUtils.rm_rf "#{@build}/public/javascripts"
+ FileUtils.cp_r "#{assets}/javascripts", "#{@build}/public/javascripts"
+ FileUtils.rm_rf "#{@build}/public/stylesheets"
+ FileUtils.cp_r "#{assets}/stylesheets", "#{@build}/public/stylesheets"
+ end
+
+ %w(production development).each do |env|
+ it "should execute helpers correctly in #{env}" do
+ @stasis.options[:development] = env == 'development'
+ @stasis.render
+ equals_output(env, File.read("#{@build}_output/test.html"))
+ end
+ end
+ end
+end
View
@@ -2,12 +2,11 @@
require "stringio"
require "bundler/setup"
+require "stasis"
$root = File.expand_path('../../', __FILE__)
-gem 'framework_fixture'
require 'framework_fixture'
-
FrameworkFixture.generate File.dirname(__FILE__) + '/fixtures'
require 'rack/test'
@@ -28,5 +27,5 @@ def capture_stdout
def equals_output(type, output)
output = output.gsub("\n", '')
- File.read("#{$root}/spec/fixtures/#{type}_output.txt").gsub("\n", '')
+ output.should == File.read("#{$root}/spec/fixtures/#{type}_output.txt").gsub("\n", '')
end

0 comments on commit b136efe

Please sign in to comment.