pakyow-test 0.10.2 → 0.11.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d297230342cf6b7f9700dbdd6fc7c02043d1a7af
4
- data.tar.gz: c4cc24e7798f6bc647cb9115049a17ecb480b5d1
3
+ metadata.gz: 0ecdd2b3ce34a9034aeac823abebe4c05090bb7f
4
+ data.tar.gz: c6258ed40f65758d29044cec62ec2dc00da46a7f
5
5
  SHA512:
6
- metadata.gz: 71c256464a2a767ef61c10dee69c4a1d88c4fedc18c5b2e6165b116613badcfa88e60bf9b2ca1afe9a4989d75151d1e8c6d01819b642fa8e9cb47d1312034304
7
- data.tar.gz: fb40bc7d91ab54bd87bc3e3f85d863b2d21296fda09aea5d353aca5ff73e5ef4ea237b15ba0f76daed8fa0eace9a66c138e5fb05e16ecfee7465835fef588f59
6
+ metadata.gz: dcf649406966587c21c45baa68b5dfbd66239b6f1ad5f1b47947b2d5fc97d440843d3a246c85eb5004af4bbe5b9894d14ee4beaeb84e547145030578a48666fe
7
+ data.tar.gz: 3d0c453503a7c8d8af80589157c6898390cef1cb49b3856ceedf6dc04fdf34ca56776587319db46674531206c63dec621ca484d8d51eff7411d69e686d744a5b
@@ -1,3 +1,9 @@
1
+ # 0.11.0
2
+
3
+ * Return original param values if `pakyow.params.nil?`
4
+ * Fixes a bug testing that data was bound to the correct scope / prop
5
+ * Moves everything into the Pakyow namespace
6
+
1
7
  # 0.10.0 / 2015-10-19
2
8
 
3
9
  * Initial release
@@ -1,60 +1 @@
1
- require 'pakyow-support'
2
- require 'pakyow-core'
3
- require 'pakyow-presenter'
4
- require 'pakyow-mailer'
5
- require 'pakyow-realtime'
6
- require 'pakyow-ui'
7
-
8
- require_relative 'test_help/ext/request'
9
- require_relative 'test_help/ext/response'
10
-
11
- require_relative 'test_help/mocks/presenter_mock'
12
- require_relative 'test_help/mocks/status_mock'
13
-
14
- require_relative 'test_help/observables/observable_presenter'
15
- require_relative 'test_help/observables/observable_view'
16
- require_relative 'test_help/observables/observable_logger'
17
- require_relative 'test_help/observables/realtime/observable_context'
18
- require_relative 'test_help/observables/realtime/observable_mutator'
19
-
20
- require_relative 'test_help/helpers'
21
- require_relative 'test_help/simulator'
22
- require_relative 'test_help/simulation'
23
-
24
- module Pakyow
25
- module TestHelp
26
- def self.setup(path = './app/setup')
27
- require path
28
-
29
- Pakyow::App.after :match do
30
- @presenter = Pakyow::TestHelp::ObservablePresenter.new(@presenter)
31
- end
32
-
33
- Pakyow::App.before :process do
34
- Pakyow::TestHelp::Realtime::ObservableMutator.instance.reset
35
- end
36
-
37
- Pakyow::App.stage(ENV['TEST_ENV'] || :test)
38
- end
39
- end
40
- end
41
-
42
- Pakyow::Presenter::ViewContext::VIEW_CLASSES << Pakyow::TestHelp::ObservableView
43
-
44
- module Pakyow
45
- module Helpers
46
- def socket
47
- @socket ||= Pakyow::TestHelp::Realtime::ObservableContext.new(app)
48
- end
49
- end
50
- end
51
-
52
- module Pakyow
53
- module Presenter
54
- class ViewContext
55
- def mutate(mutator, data: nil, with: nil)
56
- Pakyow::TestHelp::Realtime::ObservableMutator.instance.mutate(mutator, self, data || with || [])
57
- end
58
- end
59
- end
60
- end
1
+ require 'pakyow/test'
@@ -0,0 +1,60 @@
1
+ require 'pakyow/support'
2
+ require 'pakyow/core'
3
+ require 'pakyow/presenter'
4
+ require 'pakyow/mailer'
5
+ require 'pakyow/realtime'
6
+ require 'pakyow/ui'
7
+
8
+ require 'pakyow/test_help/ext/request'
9
+ require 'pakyow/test_help/ext/response'
10
+
11
+ require 'pakyow/test_help/mocks/presenter_mock'
12
+ require 'pakyow/test_help/mocks/status_mock'
13
+
14
+ require 'pakyow/test_help/observables/observable_presenter'
15
+ require 'pakyow/test_help/observables/observable_view'
16
+ require 'pakyow/test_help/observables/observable_logger'
17
+ require 'pakyow/test_help/observables/realtime/observable_context'
18
+ require 'pakyow/test_help/observables/realtime/observable_mutator'
19
+
20
+ require 'pakyow/test_help/helpers'
21
+ require 'pakyow/test_help/simulator'
22
+ require 'pakyow/test_help/simulation'
23
+
24
+ module Pakyow
25
+ module TestHelp
26
+ def self.setup(path = './app/setup')
27
+ require path
28
+
29
+ Pakyow::App.after :match do
30
+ @presenter = Pakyow::TestHelp::ObservablePresenter.new(@presenter)
31
+ end
32
+
33
+ Pakyow::App.before :process do
34
+ Pakyow::TestHelp::Realtime::ObservableMutator.instance.reset
35
+ end
36
+
37
+ Pakyow::App.stage(ENV['TEST_ENV'] || :test)
38
+ end
39
+ end
40
+ end
41
+
42
+ Pakyow::Presenter::ViewContext::VIEW_CLASSES << Pakyow::TestHelp::ObservableView
43
+
44
+ module Pakyow
45
+ module Helpers
46
+ def socket
47
+ @socket ||= Pakyow::TestHelp::Realtime::ObservableContext.new(self)
48
+ end
49
+ end
50
+ end
51
+
52
+ module Pakyow
53
+ module Presenter
54
+ class ViewContext
55
+ def mutate(mutator, data: nil, with: nil)
56
+ Pakyow::TestHelp::Realtime::ObservableMutator.instance.mutate(mutator, self, data || with || [])
57
+ end
58
+ end
59
+ end
60
+ end
@@ -0,0 +1,11 @@
1
+ module Pakyow
2
+ module ParamsOverride
3
+ def params
4
+ env.fetch('pakyow.params') { super }
5
+ end
6
+ end
7
+
8
+ class Request
9
+ prepend ParamsOverride
10
+ end
11
+ end
@@ -36,11 +36,21 @@ module Pakyow
36
36
  end
37
37
  end
38
38
 
39
+ def bind(data, bindings: {}, context: nil, &block)
40
+ presenter.observing(view.scoped_as, :bind, traversal, data: data, bindings: bindings, context: context, block: block)
41
+
42
+ result = view.bind(data, bindings: bindings, context: context) do |view, datum|
43
+ block.call(handle_value(view), datum) unless block.nil?
44
+ end
45
+
46
+ handle_value(result)
47
+ end
48
+
39
49
  def apply(data, bindings: {}, context: nil, &block)
40
50
  presenter.observing(view.scoped_as, :apply, traversal, data: data, bindings: bindings, context: context, block: block)
41
51
 
42
52
  result = view.apply(data, bindings: bindings, context: context) do |view, datum|
43
- block.call(handle_value(view), datum)
53
+ block.call(handle_value(view), datum) unless block.nil?
44
54
  end
45
55
 
46
56
  handle_value(result)
@@ -89,8 +99,14 @@ module Pakyow
89
99
  presenter.observed?(view.scoped_as, :apply, traversal, values)
90
100
  end
91
101
 
92
- def bound?(value)
93
- view[0].text == value
102
+ def bound?(data = nil)
103
+ if view.first.doc.has_attribute?(:'data-scope')
104
+ values = {}
105
+ values[:data] = data if data
106
+ presenter.observed?(view.scoped_as, :bind, traversal, values)
107
+ else
108
+ data && (view.first.text == data || view.first.attrs.value.to_s == data)
109
+ end
94
110
  end
95
111
 
96
112
  def appended?(appended_view = nil)
@@ -23,10 +23,7 @@ module Pakyow
23
23
  end
24
24
 
25
25
  def run(&block)
26
- app = Pakyow.app.dup
27
- app.process(env)
28
-
29
- sim = Simulation.new(app)
26
+ sim = Simulation.new(CallContext.new(env).process)
30
27
 
31
28
  return sim unless block_given?
32
29
  yield sim
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pakyow-test
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.2
4
+ version: 0.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bryan Powell
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-11-16 00:00:00.000000000 Z
11
+ date: 2016-04-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pakyow-support
@@ -16,56 +16,56 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 0.10.2
19
+ version: 0.11.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 0.10.2
26
+ version: 0.11.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: pakyow-core
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: 0.10.2
33
+ version: 0.11.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - '='
39
39
  - !ruby/object:Gem::Version
40
- version: 0.10.2
40
+ version: 0.11.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: pakyow-presenter
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - '='
46
46
  - !ruby/object:Gem::Version
47
- version: 0.10.2
47
+ version: 0.11.0
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - '='
53
53
  - !ruby/object:Gem::Version
54
- version: 0.10.2
54
+ version: 0.11.0
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: pakyow-mailer
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - '='
60
60
  - !ruby/object:Gem::Version
61
- version: 0.10.2
61
+ version: 0.11.0
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - '='
67
67
  - !ruby/object:Gem::Version
68
- version: 0.10.2
68
+ version: 0.11.0
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rspec
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -90,19 +90,20 @@ files:
90
90
  - pakyow-test/LICENSE
91
91
  - pakyow-test/README.md
92
92
  - pakyow-test/lib/pakyow-test.rb
93
- - pakyow-test/lib/test_help/ext/request.rb
94
- - pakyow-test/lib/test_help/ext/response.rb
95
- - pakyow-test/lib/test_help/helpers.rb
96
- - pakyow-test/lib/test_help/mocks/presenter_mock.rb
97
- - pakyow-test/lib/test_help/mocks/status_mock.rb
98
- - pakyow-test/lib/test_help/observable.rb
99
- - pakyow-test/lib/test_help/observables/observable_logger.rb
100
- - pakyow-test/lib/test_help/observables/observable_presenter.rb
101
- - pakyow-test/lib/test_help/observables/observable_view.rb
102
- - pakyow-test/lib/test_help/observables/realtime/observable_context.rb
103
- - pakyow-test/lib/test_help/observables/realtime/observable_mutator.rb
104
- - pakyow-test/lib/test_help/simulation.rb
105
- - pakyow-test/lib/test_help/simulator.rb
93
+ - pakyow-test/lib/pakyow/test.rb
94
+ - pakyow-test/lib/pakyow/test_help/ext/request.rb
95
+ - pakyow-test/lib/pakyow/test_help/ext/response.rb
96
+ - pakyow-test/lib/pakyow/test_help/helpers.rb
97
+ - pakyow-test/lib/pakyow/test_help/mocks/presenter_mock.rb
98
+ - pakyow-test/lib/pakyow/test_help/mocks/status_mock.rb
99
+ - pakyow-test/lib/pakyow/test_help/observable.rb
100
+ - pakyow-test/lib/pakyow/test_help/observables/observable_logger.rb
101
+ - pakyow-test/lib/pakyow/test_help/observables/observable_presenter.rb
102
+ - pakyow-test/lib/pakyow/test_help/observables/observable_view.rb
103
+ - pakyow-test/lib/pakyow/test_help/observables/realtime/observable_context.rb
104
+ - pakyow-test/lib/pakyow/test_help/observables/realtime/observable_mutator.rb
105
+ - pakyow-test/lib/pakyow/test_help/simulation.rb
106
+ - pakyow-test/lib/pakyow/test_help/simulator.rb
106
107
  homepage: http://pakyow.org
107
108
  licenses:
108
109
  - MIT
@@ -123,9 +124,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
123
124
  version: '0'
124
125
  requirements: []
125
126
  rubyforge_project:
126
- rubygems_version: 2.4.5
127
+ rubygems_version: 2.5.1
127
128
  signing_key:
128
129
  specification_version: 4
129
130
  summary: Pakyow Test
130
131
  test_files: []
131
- has_rdoc:
@@ -1,7 +0,0 @@
1
- module Pakyow
2
- class Request
3
- def params
4
- env['pakyow.params']
5
- end
6
- end
7
- end