honkster-jelly 0.8.3 → 0.8.4

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  :minor: 8
3
- :patch: 3
3
+ :patch: 4
4
4
  :major: 0
@@ -2,7 +2,7 @@
2
2
  * Jelly. a sweet unobtrusive javascript framework
3
3
  * for jQuery and Rails
4
4
  *
5
- * version 0.8.3
5
+ * version 0.8.4
6
6
  *
7
7
  * Copyright (c) 2009 Pivotal Labs
8
8
  * Licensed under the MIT license.
data/jelly.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{jelly}
8
- s.version = "0.8.3"
8
+ s.version = "0.8.4"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Pivotal Labs, Inc"]
@@ -4,7 +4,7 @@ module JellyController
4
4
 
5
5
  def jelly_callback(callback_base_name = @action_name, options = {}, &block)
6
6
  raw_jelly_callback(options) do
7
- arguments = block.try(:call) || []
7
+ arguments = block ? instance_eval(&block) || [] : []
8
8
  arguments = [arguments] unless arguments.is_a?(Array)
9
9
  jelly_callback_hash("on_#{callback_base_name}", *arguments).merge(options)
10
10
  end
@@ -3,11 +3,12 @@ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper.rb')
3
3
  describe ApplicationController do
4
4
 
5
5
  describe "#jelly_callback" do
6
- attr_reader :response
6
+ attr_reader :template
7
7
  before do
8
- @response = Struct.new(:body).new
9
8
  stub(@controller).render do |params|
10
- response.body = ERB.new(params[:inline]).result(@controller.send(:binding))
9
+ @template = ActionView::Base.new(@controller.class.view_paths, {}, @controller)
10
+ template.send(:_evaluate_assigns_and_ivars)
11
+ response.body = ERB.new(params[:inline]).result(template.send(:binding))
11
12
  end
12
13
  end
13
14
 
@@ -16,6 +17,17 @@ describe ApplicationController do
16
17
  end
17
18
 
18
19
  describe "Arguments block" do
20
+ describe "self" do
21
+ it "runs with the binding of the ERB template" do
22
+ self_in_block = nil
23
+ @controller.send(:jelly_callback, 'foo', :format => :json) do
24
+ self_in_block = self
25
+ 12345
26
+ end
27
+ self_in_block.should == template
28
+ end
29
+ end
30
+
19
31
  context "when an Array is returned from the block" do
20
32
  it "sets the arguments to be an Array around the Hash" do
21
33
  @controller.send(:jelly_callback, 'foo', :format => :json) do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: honkster-jelly
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.3
4
+ version: 0.8.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pivotal Labs, Inc