Skip to content

Commit

Permalink
YAML unit tests pass (tests were incompletely migrated)
Browse files Browse the repository at this point in the history
  • Loading branch information
Philip (flip) Kromer committed Apr 22, 2011
1 parent 48257fe commit ede39ec
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions spec/unit/rack/formatters/yaml_spec.rb
Expand Up @@ -12,8 +12,8 @@
@ym = Goliath::Rack::Formatters::YAML.new(@app)
end

it 'checks content type for application/yaml' do
@ym.yaml_response?({'Content-Type' => 'application/yaml'}).should be_true
it 'checks content type for text/yaml' do
@ym.yaml_response?({'Content-Type' => 'text/yaml'}).should be_true
end

it 'returns false for non-applicaton/yaml types' do
Expand All @@ -27,13 +27,13 @@
end

it 'formats the body into yaml if content-type is yaml' do
@app.should_receive(:call).and_return([200, {'Content-Type' => 'application/yaml'}, {:a => 1, :b => 2}])
@app.should_receive(:call).and_return([200, {'Content-Type' => 'text/yaml'}, {:a => 1, :b => 2}])

status, header, body = @ym.call({})
lambda { YAML.parse(body.first)['a'].should == 1 }.should_not raise_error
lambda { YAML.load(body.first)[:a].should == 1 }.should_not raise_error
end

it "doesn't format to yaml if the type is not application/yaml" do
it "doesn't format to yaml if the type is not text/yaml" do
@app.should_receive(:call).and_return([200, {'Content-Type' => 'application/xml'}, {:a => 1, :b => 2}])

YAML.should_not_receive(:encode)
Expand Down

0 comments on commit ede39ec

Please sign in to comment.