spec/expressive_spec.rb in expressive-0.0.5 vs spec/expressive_spec.rb in expressive-0.0.6

- old
+ new

@@ -1,6 +1,5 @@ - require "spec_helper" describe "Expressive" do before(:each) do @scope = Expressive::TopLevel.new @@ -122,9 +121,20 @@ it "should get with all parameters if wild card is given" do @scope['ohai'] = "world" @scope["monty"] = "python" request = stub_request(:get, "www.example.com/?ohai=world&monty=python").to_return(body: {'goodbye' => 'srsly'}) Expressive.run('(get "http://www.example.com" "*")', @scope) + assert_requested(request) + @scope['goodbye'].should eql 'srsly' + end + + it "should get with headers" do + @scope['ohai'] = "world" + @scope["monty"] = "python" + request = stub_request(:get, "www.example.com/?ohai=world&monty=python") + .with(:headers => {'Accept'=>'*/*; q=0.5, application/xml', 'Accept-Encoding'=>'gzip, deflate', 'User-Agent'=>'Ruby', "AUTH-TOKEN" => "123456"}) + .to_return(body: {'goodbye' => 'srsly'}) + Expressive.run('(get "http://www.example.com" "*" headers "AUTH-TOKEN=123456")', @scope) assert_requested(request) @scope['goodbye'].should eql 'srsly' end end