Sha256: 70aae043c3892395fb733c0a89a7620ce581aa35862ec7aac276bbe3c7ab2809

Contents?: true

Size: 865 Bytes

Versions: 7

Compression:

Stored size: 865 Bytes

Contents

require 'spec_helper'

describe "getting rack response directly" do
  
  before(:each) do
    @app = Dragonfly[:to_response].configure do |c|
      c.generator.add :test do
        "bunheads"
      end
    end
  end
  
  it "should give a rack response" do
    response = @app.generate(:test, 1, 1).to_response
    response.should be_a(Array)
    response.length.should == 3
    response[0].should == 200
    response[1]['Content-Type'].should == 'application/octet-stream'
    response[2].data.should == 'bunheads'
  end
  
  it "should allow passing in the env" do
    response = @app.generate(:test, 1, 1).to_response('REQUEST_METHOD' => 'POST')
    response.should be_a(Array)
    response.length.should == 3
    response[0].should == 405
    response[1]['Content-Type'].should == 'text/plain'
    response[2].should == ["POST method not allowed"]
  end
  
end

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
dragonfly-0.9.5 spec/functional/to_response_spec.rb
dragonfly-0.9.4 spec/functional/to_response_spec.rb
dragonfly-0.9.3 spec/functional/to_response_spec.rb
dragonfly-0.9.2 spec/functional/to_response_spec.rb
dragonfly-0.9.1 spec/functional/to_response_spec.rb
dragonfly-0.9.0 spec/functional/to_response_spec.rb
oahu-dragonfly-0.8.2 spec/functional/to_response_spec.rb