spec/smoke/source/yql_spec.rb in benschwarz-smoke-0.3.9 vs spec/smoke/source/yql_spec.rb in benschwarz-smoke-0.3.10

- old
+ new

@@ -1,14 +1,12 @@ require File.join(File.dirname(__FILE__), "..", "..", "spec_helper.rb") describe "YQL" do before :all do - # Fake web does not yet support regex matched uris + FakeWeb.register_uri("http://query.yahooapis.com:80/v1/public/yql?q=SELECT%20*%20FROM%20search.web%20WHERE%20query%20=%20'ruby'&format=json", :response => File.join(SPEC_DIR, 'supports', 'search-web.json.yql')) - FakeWeb.register_uri("query.yahooapis.com/*", :response => File.join(SPEC_DIR, 'supports', 'search-web.yql')) - - Smoke.yql(:search) do + @source = Smoke.yql(:search) do select :all from "search.web" where :query, "ruby" path :query, :results, :result @@ -16,21 +14,23 @@ rename(:url => :link) end end end + # it_should_behave_like "all sources" + it "should have been activated" do Smoke[:search].should(be_an_instance_of(Smoke::Source::YQL)) end it "should be a list of things" do Smoke[:search].items.should be_an_instance_of(Array) end describe "after dispatch" do before do - Smoke[:search].output + Smoke[:search].output end describe "url" do it "should contain the base uri for yql" do Smoke[:search].request.uri.should =~ /^http:\/\/query.yahooapis.com\/v1\/public\/yql?/ @@ -55,9 +55,11 @@ end end describe "yql definitions" do before do + FakeWeb.register_uri("http://query.yahooapis.com:80/v1/public/yql?q=SELECT%20*%20FROM%20github.repo%20WHERE%20id%20=%20'benschwarz'%20AND%20repo%20=%20'smoke'&format=json&env=http://datatables.org/alltables.env", :response => File.join(SPEC_DIR, 'supports', 'datatables.yql')) + Smoke.yql(:smoke) do use "http://datatables.org/alltables.env" select :all from "github.repo" \ No newline at end of file