Sha256: 41cf0074f0aff4ee2e919071824e7067030071aef41b5e4b8979915d3f7e9e80

Contents?: true

Size: 797 Bytes

Versions: 1

Compression:

Stored size: 797 Bytes

Contents

require File.expand_path("#{File.dirname(__FILE__)}/unit_spec_helper")

module JsSpec
  describe SuiteResult do
    attr_reader :result
    before do
      @result = SuiteResult.new
    end

    describe "#post" do
      attr_reader :stdout
      before do
        @stdout = StringIO.new
        SuiteResult.const_set(:STDOUT, stdout)
      end
      after do
        SuiteResult.__send__(:remove_const, :STDOUT)
      end

      it "writes the body of the request to stdout" do
        body = "The text in the POST body"
        request = Rack::Request.new({'rack.input' => StringIO.new("text=#{body}")})
        request.body.string.should == "text=#{body}"
        stub.proxy(Server).request {request}

        result.post
        stdout.string.should == "#{body}\n"
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
js_spec-0.0.1 spec/unit/suite_result_spec.rb