transponder 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +4 -0
- data/Gemfile.lock +88 -62
- data/README.md +3 -0
- data/lib/generators/transponder.rb +1 -1
- data/lib/transponder.rb +2 -2
- data/lib/transponder/version.rb +1 -1
- data/test/javascripts/runner/Gemfile +5 -0
- data/test/javascripts/runner/Gemfile.lock +104 -0
- data/test/javascripts/runner/README.md +1 -0
- data/test/javascripts/runner/config.rb +85 -0
- data/test/javascripts/runner/package.json +22 -0
- data/test/javascripts/runner/source/index.html.erb +1 -0
- data/test/javascripts/runner/source/javascripts/all.js +13 -0
- data/test/javascripts/runner/source/javascripts/test_runner.js +2 -0
- data/test/javascripts/runner/source/layouts/layout.erb +19 -0
- data/test/javascripts/runner/source/stylesheets/mocha.css +246 -0
- data/test/javascripts/support/chai.js +4251 -0
- data/test/javascripts/support/jquery-2.js +8755 -0
- data/test/javascripts/support/mocha.js +5338 -0
- data/test/javascripts/support/sinon-chai.js +109 -0
- data/test/javascripts/support/sinon.js +4299 -0
- data/test/javascripts/support/test_setup.js +2 -0
- data/test/javascripts/transponder/presenter_test.coffee +34 -0
- data/test/javascripts/transponder/presenters/examples_presenter_test.coffee +74 -0
- data/test/javascripts/transponder/service_test.coffee +3 -0
- metadata +57 -6
- data/lib/transponder/engine.rb +0 -6
@@ -0,0 +1,34 @@
|
|
1
|
+
describe 'Transponder.Presenter', ->
|
2
|
+
|
3
|
+
describe "instantiate without options", ->
|
4
|
+
before ->
|
5
|
+
@presenter = new Transponder.Presenter
|
6
|
+
|
7
|
+
it "defaultActions should be Array", ->
|
8
|
+
expect(@presenter.actions).to.be.an.instanceof(Array)
|
9
|
+
|
10
|
+
it "should contain 7 default actions", ->
|
11
|
+
expect(@presenter.actions).to.include('show')
|
12
|
+
expect(@presenter.actions).to.include('index')
|
13
|
+
expect(@presenter.actions).to.include('edit')
|
14
|
+
expect(@presenter.actions).to.include('update')
|
15
|
+
expect(@presenter.actions).to.include('new')
|
16
|
+
expect(@presenter.actions).to.include('create')
|
17
|
+
expect(@presenter.actions).to.include('destroy')
|
18
|
+
|
19
|
+
describe "#elify", ->
|
20
|
+
before ->
|
21
|
+
@event =
|
22
|
+
target:
|
23
|
+
localName: 'div'
|
24
|
+
id: 'blah_1'
|
25
|
+
@presenter.response = 'response'
|
26
|
+
|
27
|
+
it "should return div#blah_1", ->
|
28
|
+
element = @presenter.elify(@event, 'response')
|
29
|
+
expect(element).to.equal('div#blah_1')
|
30
|
+
|
31
|
+
|
32
|
+
|
33
|
+
|
34
|
+
|
@@ -0,0 +1,74 @@
|
|
1
|
+
#= require presenters/examples_presenter
|
2
|
+
|
3
|
+
describe "ExamplesPresenter", ->
|
4
|
+
before ->
|
5
|
+
@presenter = new ExamplesPresenter()
|
6
|
+
|
7
|
+
it "should have presenterName 'examples'", ->
|
8
|
+
expect(@presenter.presenterName).to.equal("examples")
|
9
|
+
|
10
|
+
it "should have modelName 'example'", ->
|
11
|
+
expect(@presenter.modelName).to.equal("example")
|
12
|
+
|
13
|
+
describe "action trigger", ->
|
14
|
+
it "#index", ->
|
15
|
+
spy = sinon.spy(@presenter, 'index')
|
16
|
+
|
17
|
+
$(document).trigger('ujs:examples:index', 'blah')
|
18
|
+
expect(spy).to.have.been.calledOnce
|
19
|
+
|
20
|
+
spy.restore()
|
21
|
+
|
22
|
+
it "#show", ->
|
23
|
+
spy = sinon.spy(@presenter, 'show')
|
24
|
+
|
25
|
+
$(document).trigger('ujs:examples:show', 'blah')
|
26
|
+
expect(spy).to.have.been.calledOnce
|
27
|
+
|
28
|
+
spy.restore()
|
29
|
+
|
30
|
+
describe "no action", ->
|
31
|
+
it "#new", ->
|
32
|
+
spy = sinon.spy(@presenter, 'new')
|
33
|
+
|
34
|
+
$(document).trigger('ujs:examples:new', 'blah')
|
35
|
+
expect(spy).to.not.have.been.called
|
36
|
+
|
37
|
+
spy.restore()
|
38
|
+
|
39
|
+
describe "#beforeFilters", ->
|
40
|
+
before ->
|
41
|
+
@spy = sinon.spy(@presenter, 'beforeFilter')
|
42
|
+
$(document).trigger('ujs:examples:index', 'response')
|
43
|
+
|
44
|
+
after ->
|
45
|
+
@spy.restore()
|
46
|
+
|
47
|
+
it "should run beforeFilter", ->
|
48
|
+
expect(@spy).to.have.been.calledOnce
|
49
|
+
|
50
|
+
it "#response should be 'response'", ->
|
51
|
+
expect(@presenter.response).to.equal('response')
|
52
|
+
|
53
|
+
it "#params should be Object", ->
|
54
|
+
expect(@presenter.params).to.be.an.instanceof(Object)
|
55
|
+
|
56
|
+
describe "#elify", ->
|
57
|
+
it "should run elify", ->
|
58
|
+
spy = sinon.spy(@presenter, 'elify')
|
59
|
+
|
60
|
+
$(document).trigger('ujs:examples:index', 'response')
|
61
|
+
expect(spy).to.have.been.calledOnce
|
62
|
+
|
63
|
+
spy.restore()
|
64
|
+
|
65
|
+
describe "#afterFilter", ->
|
66
|
+
before ->
|
67
|
+
@spy = sinon.spy(@presenter, 'afterFilter')
|
68
|
+
$(document).trigger('ujs:examples:index', 'response')
|
69
|
+
|
70
|
+
after ->
|
71
|
+
@spy.restore()
|
72
|
+
|
73
|
+
it "should run afterFilter", ->
|
74
|
+
expect(@spy).to.have.been.calledOnce
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: transponder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Zack Siri
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-05-
|
11
|
+
date: 2013-05-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: coffee-rails
|
@@ -16,14 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '>='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '3.2'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '3.2'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rails
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '3.2'
|
20
34
|
type: :development
|
21
35
|
prerelease: false
|
22
36
|
version_requirements: !ruby/object:Gem::Requirement
|
23
37
|
requirements:
|
24
38
|
- - '>='
|
25
39
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
40
|
+
version: '3.2'
|
27
41
|
description: A Cleaner way of working with rails frontend code
|
28
42
|
email:
|
29
43
|
- zack@artellectual.com
|
@@ -44,7 +58,6 @@ files:
|
|
44
58
|
- lib/generators/transponder/install/USAGE
|
45
59
|
- lib/generators/transponder/resource_helpers.rb
|
46
60
|
- lib/generators/transponder.rb
|
47
|
-
- lib/transponder/engine.rb
|
48
61
|
- lib/transponder/version.rb
|
49
62
|
- lib/transponder.rb
|
50
63
|
- Gemfile
|
@@ -52,6 +65,25 @@ files:
|
|
52
65
|
- LICENSE.txt
|
53
66
|
- Rakefile
|
54
67
|
- README.md
|
68
|
+
- test/javascripts/runner/config.rb
|
69
|
+
- test/javascripts/runner/Gemfile
|
70
|
+
- test/javascripts/runner/Gemfile.lock
|
71
|
+
- test/javascripts/runner/package.json
|
72
|
+
- test/javascripts/runner/README.md
|
73
|
+
- test/javascripts/runner/source/index.html.erb
|
74
|
+
- test/javascripts/runner/source/javascripts/all.js
|
75
|
+
- test/javascripts/runner/source/javascripts/test_runner.js
|
76
|
+
- test/javascripts/runner/source/layouts/layout.erb
|
77
|
+
- test/javascripts/runner/source/stylesheets/mocha.css
|
78
|
+
- test/javascripts/support/chai.js
|
79
|
+
- test/javascripts/support/jquery-2.js
|
80
|
+
- test/javascripts/support/mocha.js
|
81
|
+
- test/javascripts/support/sinon-chai.js
|
82
|
+
- test/javascripts/support/sinon.js
|
83
|
+
- test/javascripts/support/test_setup.js
|
84
|
+
- test/javascripts/transponder/presenter_test.coffee
|
85
|
+
- test/javascripts/transponder/presenters/examples_presenter_test.coffee
|
86
|
+
- test/javascripts/transponder/service_test.coffee
|
55
87
|
homepage: http://github.com/zacksiri/transponder
|
56
88
|
licenses: []
|
57
89
|
metadata: {}
|
@@ -77,4 +109,23 @@ specification_version: 4
|
|
77
109
|
summary: This library gives you more control over rails ujs, it compliments turbolinks,
|
78
110
|
and any other library you use. It is opinionated and helps you clean up your client
|
79
111
|
side code in many ways.
|
80
|
-
test_files:
|
112
|
+
test_files:
|
113
|
+
- test/javascripts/runner/config.rb
|
114
|
+
- test/javascripts/runner/Gemfile
|
115
|
+
- test/javascripts/runner/Gemfile.lock
|
116
|
+
- test/javascripts/runner/package.json
|
117
|
+
- test/javascripts/runner/README.md
|
118
|
+
- test/javascripts/runner/source/index.html.erb
|
119
|
+
- test/javascripts/runner/source/javascripts/all.js
|
120
|
+
- test/javascripts/runner/source/javascripts/test_runner.js
|
121
|
+
- test/javascripts/runner/source/layouts/layout.erb
|
122
|
+
- test/javascripts/runner/source/stylesheets/mocha.css
|
123
|
+
- test/javascripts/support/chai.js
|
124
|
+
- test/javascripts/support/jquery-2.js
|
125
|
+
- test/javascripts/support/mocha.js
|
126
|
+
- test/javascripts/support/sinon-chai.js
|
127
|
+
- test/javascripts/support/sinon.js
|
128
|
+
- test/javascripts/support/test_setup.js
|
129
|
+
- test/javascripts/transponder/presenter_test.coffee
|
130
|
+
- test/javascripts/transponder/presenters/examples_presenter_test.coffee
|
131
|
+
- test/javascripts/transponder/service_test.coffee
|