spec/expressive_spec.rb in expressive-0.0.21 vs spec/expressive_spec.rb in expressive-0.0.22

- old
+ new

@@ -162,11 +162,11 @@ @scope['participating_teams'].should == [0, 1, 2, 3] end end describe "understands retrieving the id of an object" do - it do + it do @scope["an_object"] = mock(:an_object, id: 5) Expressive.run('($id an_object)', @scope).should == 5 end end @@ -264,9 +264,20 @@ it "should get with all parameters if wild card is given" do @scope['ohai'] = "world" @scope["monty"] = "python" request = stub_request(:post, "www.example.com").with(body: {'monty' => 'python', 'ohai' => 'world'}).to_return(body: {'goodbye' => 'srsly'}) Expressive.run('(post "http://www.example.com" "*")', @scope) + assert_requested(request) + @scope['goodbye'].should eql 'srsly' + end + end + + context "conditional post" do + it "should post to correct url" do + @scope['ohai'] = "world" + @scope["monty"] = "python" + request = stub_request(:post, "www.example.com").with(body: {'monty' => 'python', 'ohai' => 'world'}).to_return(body: {'goodbye' => 'srsly'}) + Expressive.run('(post (if (= ohai "world") "http://www.example.com", "http://www.wrongurl.com") "*")', @scope) assert_requested(request) @scope['goodbye'].should eql 'srsly' end end end