honkster-jelly 0.8.7 → 0.8.8

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: 7
3
+ :patch: 8
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.7
5
+ * version 0.8.8
6
6
  *
7
7
  * Copyright (c) 2009 Pivotal Labs
8
8
  * Licensed under the MIT license.
data/jelly.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{jelly}
8
- s.version = "0.8.7"
8
+ s.version = "0.8.8"
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"]
12
- s.date = %q{2010-01-06}
12
+ s.date = %q{2010-01-08}
13
13
  s.description = %q{Jelly provides a set of tools and conventions for creating rich ajax/javascript web applications with jQuery and Ruby on Rails.}
14
14
  s.email = %q{opensource@pivotallabs.com}
15
15
  s.extra_rdoc_files = [
@@ -41,9 +41,10 @@ Gem::Specification.new do |s|
41
41
  s.rubygems_version = %q{1.3.5}
42
42
  s.summary = %q{a sweet unobtrusive javascript framework for jQuery and Rails}
43
43
  s.test_files = [
44
- "spec/helpers/jelly_helper_spec.rb",
44
+ "spec/jelly/jelly_controller_spec.rb",
45
+ "spec/jelly/common_spec.rb",
46
+ "spec/jelly/jelly_helper_spec.rb",
45
47
  "spec/spec_suite.rb",
46
- "spec/controllers/jelly_controller_spec.rb",
47
48
  "spec/spec_helper.rb",
48
49
  "spec/rails_root/test/performance/browsing_test.rb",
49
50
  "spec/rails_root/test/test_helper.rb",
data/lib/jelly/common.rb CHANGED
@@ -4,7 +4,11 @@ module Jelly
4
4
  {"method" => method, "arguments" => arguments}
5
5
  end
6
6
 
7
- def jelly_attach_component_definition_hash(component_name, *args)
7
+ def jelly_callback_attach_hash(components=jelly_attachments)
8
+ {"attach" => components}
9
+ end
10
+
11
+ def jelly_attachment_hash(component_name, *args)
8
12
  {'component' => component_name, 'arguments' => args}
9
13
  end
10
14
  end
@@ -16,7 +16,7 @@ module JellyHelper
16
16
  attach_javascript_component("Jelly.Page", controller.controller_path.camelcase, controller.action_name)
17
17
  <<-HTML
18
18
  #{window_token_javascript_tag}
19
- #{attach_javascript_component_javascript_tag(jelly_attached_components)}
19
+ #{attach_javascript_component_javascript_tag(jelly_attachments)}
20
20
  HTML
21
21
  end
22
22
 
@@ -34,13 +34,13 @@ module JellyHelper
34
34
  end
35
35
 
36
36
  def clear_jelly_attached
37
- jelly_attached_components.clear
37
+ jelly_attachments.clear
38
38
  end
39
39
 
40
40
  def attach_javascript_component(component_name, *args)
41
- key = jelly_attach_component_definition_hash(component_name, *args)
42
- unless jelly_attached_components.include? key
43
- jelly_attached_components << key
41
+ key = jelly_attachment_hash(component_name, *args)
42
+ unless jelly_attachments.include? key
43
+ jelly_attachments << key
44
44
  end
45
45
  end
46
46
 
@@ -49,8 +49,8 @@ module JellyHelper
49
49
  attach_javascript_component(component_name, *args)
50
50
  end
51
51
 
52
- def jelly_attached_components
53
- @jelly_attached_components ||= []
52
+ def jelly_attachments
53
+ @jelly_attachments ||= []
54
54
  end
55
55
 
56
56
  end
@@ -0,0 +1,46 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper.rb')
2
+
3
+ describe Jelly::Common do
4
+ attr_reader :fixture
5
+ before do
6
+ @fixture = Class.new do
7
+ include Jelly::Common
8
+ end.new
9
+ end
10
+
11
+ describe "#jelly_callback_hash" do
12
+ it "creates a hash with a method and arguments" do
13
+ fixture.jelly_callback_hash("my_method", 1, 2, 3).should == {
14
+ "method" => "my_method",
15
+ "arguments" => [1, 2, 3]
16
+ }
17
+ end
18
+ end
19
+
20
+ describe "#jelly_callback_attach_hash" do
21
+ context "when passed attachments" do
22
+ it "creates a hash with the attach param being set to the given attachments" do
23
+ attachments = [
24
+ fixture.jelly_attachment_hash("Foo", 1, 2),
25
+ fixture.jelly_attachment_hash("Bar", 3),
26
+ ]
27
+ fixture.jelly_callback_attach_hash(attachments).should == {
28
+ "attach" => attachments
29
+ }
30
+ end
31
+ end
32
+
33
+ context "when not passed attachments" do
34
+ it "creates a hash with the attach param being set to #jelly_attachments" do
35
+ attachments = [
36
+ fixture.jelly_attachment_hash("Foo", 1, 2),
37
+ fixture.jelly_attachment_hash("Bar", 3),
38
+ ]
39
+ stub(fixture).jelly_attachments {attachments}
40
+ fixture.jelly_callback_attach_hash.should == {
41
+ "attach" => attachments
42
+ }
43
+ end
44
+ end
45
+ end
46
+ end
@@ -1,6 +1,6 @@
1
1
  require File.expand_path(File.dirname(__FILE__) + '/../spec_helper.rb')
2
2
 
3
- describe ApplicationController do
3
+ describe ApplicationController, :type => :controller do
4
4
 
5
5
  describe "#jelly_callback" do
6
6
  attr_reader :template
@@ -1,6 +1,6 @@
1
1
  require File.expand_path(File.dirname(__FILE__) + '/../spec_helper.rb')
2
2
 
3
- describe JellyHelper do
3
+ describe JellyHelper, :type => :helper do
4
4
 
5
5
  def jelly_attach_arguments(html)
6
6
  JSON.parse(Regexp.new('Jelly\.attach\.apply\(Jelly, (.*)\);').match(html)[1])
@@ -61,7 +61,7 @@ describe JellyHelper do
61
61
  helper.attach_javascript_component("MyComponent", 'arg1', 'arg2', 'arg3')
62
62
  helper.attach_javascript_component("MyComponent", 'arg1', 'arg2', 'arg3')
63
63
  helper.attach_javascript_component("MyComponent", 'arg1', 'arg2', 'arg5')
64
- assigns[:jelly_attached_components].should == [
64
+ assigns[:jelly_attachments].should == [
65
65
  {'component' => "MyComponent", 'arguments' => ['arg1', 'arg2', 'arg3']},
66
66
  {'component' => "MyComponent", 'arguments' => ['arg1', 'arg2', 'arg5']},
67
67
  ]
@@ -70,7 +70,7 @@ describe JellyHelper do
70
70
  it "adds a call to Jelly.attach in an $(document).ready block" do
71
71
  helper.attach_javascript_component("MyComponent", 'arg1', 'arg2', 'arg3')
72
72
  expected_args = ['arg1','arg2','arg3'].to_json
73
- assigns[:jelly_attached_components].should == [
73
+ assigns[:jelly_attachments].should == [
74
74
  {'component' => "MyComponent", 'arguments' => ['arg1', 'arg2', 'arg3']}
75
75
  ]
76
76
 
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.7
4
+ version: 0.8.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pivotal Labs, Inc
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-01-06 00:00:00 -08:00
12
+ date: 2010-01-08 00:00:00 -08:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -78,9 +78,10 @@ signing_key:
78
78
  specification_version: 3
79
79
  summary: a sweet unobtrusive javascript framework for jQuery and Rails
80
80
  test_files:
81
- - spec/helpers/jelly_helper_spec.rb
81
+ - spec/jelly/jelly_controller_spec.rb
82
+ - spec/jelly/common_spec.rb
83
+ - spec/jelly/jelly_helper_spec.rb
82
84
  - spec/spec_suite.rb
83
- - spec/controllers/jelly_controller_spec.rb
84
85
  - spec/spec_helper.rb
85
86
  - spec/rails_root/test/performance/browsing_test.rb
86
87
  - spec/rails_root/test/test_helper.rb