spec/jelly/jelly_controller_spec.rb in honkster-jelly-0.8.10 vs spec/jelly/jelly_controller_spec.rb in honkster-jelly-0.8.11

- old
+ new

@@ -223,11 +223,11 @@ describe "json" do it "responds with a json hash, even if the request is not xhr" do stub(request).xhr? {false} @controller.send(:raw_jelly_callback, :format => :json) do - jelly_callback_hash("foo", "grape").merge('bar' => 'baz') + jelly_notify_hash("foo", "grape").merge('bar' => 'baz') end callback = JSON.parse(response.body) callback["method"].should == "foo" callback["arguments"].should == ["grape"] callback["bar"].should == "baz" @@ -237,11 +237,11 @@ describe "jsonp" do it "responds with a jsonp callback based on the callback param" do @controller.params[:callback] = "Jelly.notifyObservers" @controller.send(:raw_jelly_callback, :format => :jsonp) do - jelly_callback_hash("foo", "grape").merge('bar' => 'baz') + jelly_notify_hash("foo", "grape").merge('bar' => 'baz') end json = Regexp.new('Jelly\.notifyObservers\((.*)\);').match(response.body)[1] callback = JSON.parse(json) callback["method"].should == "foo" callback["arguments"].should == ["grape"] @@ -250,11 +250,11 @@ end describe "iframe" do it "responds with a the json in a textarea tag" do @controller.send(:raw_jelly_callback, :format => :iframe) do - jelly_callback_hash("foo", "grape").merge('bar' => 'baz') + jelly_notify_hash("foo", "grape").merge('bar' => 'baz') end body = response.body body.should =~ /^<textarea>/ body.should =~ /<\/textarea>$/ doc = Nokogiri::HTML(body) @@ -272,11 +272,11 @@ stub(request).xhr? {true} end it "responds with a json hash" do @controller.send(:raw_jelly_callback) do - jelly_callback_hash("foo", "grape").merge('bar' => 'baz') + jelly_notify_hash("foo", "grape").merge('bar' => 'baz') end callback = JSON.parse(response.body) callback["method"].should == "foo" callback["arguments"].should == ["grape"] callback["bar"].should == "baz" @@ -294,11 +294,11 @@ @controller.params[:callback] = "Jelly.notifyObservers" end it "responds with a call to the given callback method with the json as an argument" do @controller.send(:raw_jelly_callback) do - jelly_callback_hash("foo", "grape").merge('bar' => 'baz') + jelly_notify_hash("foo", "grape").merge('bar' => 'baz') end json = Regexp.new('Jelly\.notifyObservers\((.*)\);').match(response.body)[1] callback = JSON.parse(json) callback["method"].should == "foo" callback["arguments"].should == ["grape"] @@ -307,10 +307,10 @@ end context "when there is not a callback param" do it "wraps the json response in a textarea tag to support File Uploads in an iframe target (see: http://malsup.com/jquery/form/#code-samples)" do @controller.send(:raw_jelly_callback) do - jelly_callback_hash("foo", "grape").merge('bar' => 'baz') + jelly_notify_hash("foo", "grape").merge('bar' => 'baz') end body = response.body body.should =~ /^<textarea>/ body.should =~ /<\/textarea>$/ doc = Nokogiri::HTML(body)