spec/response_spec.rb in ruby-oembed-0.8.8 vs spec/response_spec.rb in ruby-oembed-0.8.9

- old
+ new

@@ -48,20 +48,20 @@ "version" => "1.0", "html" => "<em>Hello world!</em>", "url" => "http://foo.com/bar", } } - + let(:expected_skipped) { { "fields" => "hello", "__id__" => 1234, "provider" => "oohEmbed", "to_s" => "random string", } } - + let(:all_expected) { expected_helpers.merge(expected_skipped) } describe "#initialize" do @@ -104,35 +104,35 @@ end end describe "create_for" do it "should only allow JSON or XML" do - lambda do + expect { OEmbed::Response.create_for(valid_response(:json), flickr, example_url(:flickr), :json) - end.should_not raise_error(OEmbed::FormatNotSupported) + }.not_to raise_error - lambda do + expect { OEmbed::Response.create_for(valid_response(:xml), flickr, example_url(:flickr), :xml) - end.should_not raise_error(OEmbed::FormatNotSupported) + }.not_to raise_error - lambda do + expect { OEmbed::Response.create_for(valid_response(:yml), flickr, example_url(:flickr), :yml) - end.should raise_error(OEmbed::FormatNotSupported) + }.to raise_error(OEmbed::FormatNotSupported) end it "should not parse the incorrect format" do - lambda do + expect { OEmbed::Response.create_for(valid_response(:object), example_url(:flickr), flickr, :json) - end.should raise_error(OEmbed::ParseError) + }.to raise_error(OEmbed::ParseError) - lambda do + expect { OEmbed::Response.create_for(valid_response(:xml), example_url(:flickr), viddler, :json) - end.should raise_error(OEmbed::ParseError) + }.to raise_error(OEmbed::ParseError) - lambda do + expect { OEmbed::Response.create_for(valid_response(:json), example_url(:flickr), viddler, :xml) - end.should raise_error(OEmbed::ParseError) + }.to raise_error(OEmbed::ParseError) end end it "should access the XML data through #field" do xml_res.field(:type).should == "photo" @@ -200,18 +200,18 @@ describe "#html" do it "should include the title, if given" do response = OEmbed::Response.create_for(example_body(:flickr), example_url(:flickr), flickr, :json) response.should respond_to(:title) response.title.should_not be_empty - + response.html.should_not be_nil response.html.should match(/alt='#{response.title}'/) end it "should work just fine, without a title" do response = OEmbed::Response.create_for(example_body(:skitch), example_url(:skitch), skitch, :json) response.should_not respond_to(:title) - + response.html.should_not be_nil response.html.should match(/alt=''/) end end end