Sha256: 0577fe1a68f6f797ddca809935a0bde2a1610e381f3ce7f0db58b42c948f6007

Contents?: true

Size: 978 Bytes

Versions: 1

Compression:

Stored size: 978 Bytes

Contents

require "spec_helper"

describe "Hisyo generated app" do
  def genapp(&block)
    pending "jruby does not support fork" if defined? JRUBY_VERSION
    pid = fork do 
      generate_app(
        :root => @approot,
      )
      @mock = Class.new
      configru = "#{@approot}/config.ru"
      bootrb = "#{@approot}/config/boot.rb"
      @mock.class_eval do
        require bootrb

        include Rack::Test::Methods
        @configru = configru

        def self.configru
          @configru
        end

        def app
          Rack::Builder.parse_file(self.class.configru).first
        end
      end
      @mock.new.instance_eval &block
    end
    Process.wait pid
  end

  after(:each) do
    FileUtils.rm_rf @approot
  end

  it "should rackup" do
    genapp do
      get "/"
      last_response.body.rstrip.should == "Hello, MyApp!"
    end
  end

  it "controllers" do
    genapp do
      get "/hi/uu59"
      last_response.body.should == "Hi, uu59!"
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
hisyo-0.1.0 spec/generated_app_spec.rb