startback 0.5.4 → 0.7.2

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
  SHA256:
3
- metadata.gz: 5035bf72b8dba0120599d626b9821b87e6583c148dc4cbf749059b34a68ea122
4
- data.tar.gz: 5cdcf6b1ca980449023d46eb65abc98c2a2b4894fb331ef5e61e436da2c98f8c
3
+ metadata.gz: 43205e7a7a06ae377fd0b68b164f855056836c324fc22c6080f41280ebc6d156
4
+ data.tar.gz: d995f1e4cd93b17fd1bc68c3af085d95a0d3681ddfec54ea9e1efa2fb3673a59
5
5
  SHA512:
6
- metadata.gz: f42edab28b5b8e152a159a7d5d583090a749d425dd9e8e29b06288130a8982cad9d494204315e4fb0372c81d317d887a5b95e881991edcda9cbbe02639c1ee68
7
- data.tar.gz: 5a8bcae0579b199d3e22f17dd748c879b26a8463e5fb2ea4a87542cd8deec6867cf8bce16108adb34c51b95c64e047e93ff798c4ef81c0ec76afad575c2a0e39
6
+ metadata.gz: a62dcaceaec70c928d89a94292ebd9a2fd72d6484381a0f12b5e01517297a2d005f22dc24d592340af1a2266b80de71e0d03d4f1270ebe531f38a82c3284a621
7
+ data.tar.gz: 9cfa086a47fac308c754380ed8e61a853a9849758907b40fce729edd1532eac5a7aa8bc800698730f7342f757e5bf2347556ec5bcaed441da0625db388cf50dc
@@ -99,6 +99,11 @@ module Startback
99
99
  @factored[key] ||= clazz.new(*(args << self))
100
100
  end
101
101
 
102
+ def clean_factored!
103
+ @factored = {}
104
+ end
105
+ private :clean_factored!
106
+
102
107
  def to_h
103
108
  self.class.h_dump!(self)
104
109
  end
@@ -107,6 +112,13 @@ module Startback
107
112
  to_h.to_json(*args, &bl)
108
113
  end
109
114
 
115
+ def dup
116
+ super.tap{|c|
117
+ c.send(:clean_factored!)
118
+ yield(c) if block_given?
119
+ }
120
+ end
121
+
110
122
  end # class Context
111
123
  end # module Startback
112
124
  require_relative 'context/middleware'
@@ -2,7 +2,7 @@ class DateTime
2
2
 
3
3
  # Makes sure that DateTime are exported with ISO8601
4
4
  # conventions when using to_json and to_csv
5
- def to_s
5
+ def to_s(*args)
6
6
  iso8601
7
7
  end
8
8
 
@@ -2,7 +2,7 @@ class Time
2
2
 
3
3
  # Makes sure that Time are exported with ISO8601
4
4
  # conventions when using to_json and to_csv
5
- def to_s
5
+ def to_s(*args)
6
6
  iso8601
7
7
  end
8
8
 
@@ -52,6 +52,14 @@ module Startback
52
52
  super || (world && world.has_key?(name))
53
53
  end
54
54
 
55
+ def with_context(ctx = nil)
56
+ old_world = self.world
57
+ self.world = self.world.merge(context: ctx || old_world.context.dup)
58
+ result = ctx ? yield : yield(self.world.context)
59
+ self.world = old_world
60
+ result
61
+ end
62
+
55
63
  protected
56
64
 
57
65
  def operation_world(op)
@@ -1,8 +1,8 @@
1
1
  module Startback
2
2
  module Version
3
3
  MAJOR = 0
4
- MINOR = 5
5
- TINY = 4
4
+ MINOR = 7
5
+ TINY = 2
6
6
  end
7
7
  VERSION = "#{Version::MAJOR}.#{Version::MINOR}.#{Version::TINY}"
8
8
  end
@@ -17,6 +17,15 @@ module Startback
17
17
  env[Startback::Context::Middleware::RACK_ENV_KEY]
18
18
  end
19
19
 
20
+ def with_context(ctx = nil)
21
+ old_context = self.context
22
+ new_context = ctx || self.context.dup
23
+ env[Startback::Context::Middleware::RACK_ENV_KEY] = new_context
24
+ result = ctx ? yield : yield(new_context)
25
+ env[Startback::Context::Middleware::RACK_ENV_KEY] = old_context
26
+ result
27
+ end
28
+
20
29
  ###
21
30
  ### Facade over third party tools
22
31
  ###
@@ -58,13 +67,17 @@ module Startback
58
67
  [ 204, {}, [] ]
59
68
  end
60
69
 
61
- def serve(entity_description, entity, ct = :json)
70
+ def serve(entity_description, entity, ct = nil)
62
71
  if entity.nil?
63
72
  status 404
64
73
  content_type :json
65
74
  { description: "#{entity_description} not found" }.to_json
66
- else
75
+ elsif entity.respond_to?(:to_dto)
76
+ ct, body = entity.to_dto(context).to(env['HTTP_ACCEPT'], ct)
67
77
  content_type ct
78
+ body
79
+ else
80
+ content_type ct || "application/json"
68
81
  entity.to_json
69
82
  end
70
83
  end
@@ -0,0 +1,100 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <testsuite name="rspec" tests="94" skipped="0" failures="0" errors="0" time="6.808889" timestamp="2020-08-27T18:05:11+02:00" hostname="xpertis">
3
+ <properties>
4
+ <property name="seed" value="9603"/>
5
+ </properties>
6
+ <testcase classname="spec.unit.audit.test_trailer" name="Startback::Audit::Trailer op_data uses to_trail in priority if provided" file="./spec/unit/audit/test_trailer.rb" time="0.000397"></testcase>
7
+ <testcase classname="spec.unit.audit.test_trailer" name="Startback::Audit::Trailer op_data uses input then" file="./spec/unit/audit/test_trailer.rb" time="0.000111"></testcase>
8
+ <testcase classname="spec.unit.audit.test_trailer" name="Startback::Audit::Trailer op_data uses request then" file="./spec/unit/audit/test_trailer.rb" time="0.000096"></testcase>
9
+ <testcase classname="spec.unit.audit.test_trailer" name="Startback::Audit::Trailer op_data applies default blacklists for security reasons" file="./spec/unit/audit/test_trailer.rb" time="0.000106"></testcase>
10
+ <testcase classname="spec.unit.audit.test_trailer" name="Startback::Audit::Trailer op_data applies default blacklists to data arrays too" file="./spec/unit/audit/test_trailer.rb" time="0.000113"></testcase>
11
+ <testcase classname="spec.unit.audit.test_trailer" name="Startback::Audit::Trailer op_data uses the stop words provided at construction" file="./spec/unit/audit/test_trailer.rb" time="0.000087"></testcase>
12
+ <testcase classname="spec.unit.audit.test_trailer" name="Startback::Audit::Trailer op_context applies default blacklists for security reasons" file="./spec/unit/audit/test_trailer.rb" time="0.000110"></testcase>
13
+ <testcase classname="spec.unit.bus.memory.test_async" name="Startback::Bus::Memory allows emiting an receiving" file="./spec/unit/bus/memory/test_async.rb" time="0.000322"></testcase>
14
+ <testcase classname="spec.unit.bus.memory.test_async" name="Startback::Bus::Memory allows mixin Symbol vs. String for event type" file="./spec/unit/bus/memory/test_async.rb" time="0.000059"></testcase>
15
+ <testcase classname="spec.unit.bus.memory.test_async" name="Startback::Bus::Memory does not raise errors synchronously" file="./spec/unit/bus/memory/test_async.rb" time="0.000861"></testcase>
16
+ <testcase classname="spec.unit.bus.memory.test_sync" name="Startback::Bus::Memory allows emiting an receiving" file="./spec/unit/bus/memory/test_sync.rb" time="0.000061"></testcase>
17
+ <testcase classname="spec.unit.bus.memory.test_sync" name="Startback::Bus::Memory allows mixin Symbol vs. String for event type" file="./spec/unit/bus/memory/test_sync.rb" time="0.000064"></testcase>
18
+ <testcase classname="spec.unit.bus.memory.test_sync" name="Startback::Bus::Memory raises emit errors synchronously" file="./spec/unit/bus/memory/test_sync.rb" time="0.000060"></testcase>
19
+ <testcase classname="spec.unit.caching.test_entity_cache" name="Startback::Caching::EntityCache default_ttl has a default ttl of one hour" file="./spec/unit/caching/test_entity_cache.rb" time="0.000043"></testcase>
20
+ <testcase classname="spec.unit.caching.test_entity_cache" name="Startback::Caching::EntityCache default_ttl allows overriding it" file="./spec/unit/caching/test_entity_cache.rb" time="0.000037"></testcase>
21
+ <testcase classname="spec.unit.caching.test_entity_cache" name="Startback::Caching::EntityCache default_ttl is accessible as default_caching_options on the instance" file="./spec/unit/caching/test_entity_cache.rb" time="0.000044"></testcase>
22
+ <testcase classname="spec.unit.caching.test_entity_cache" name="Startback::Caching::EntityCache get yields to load_raw_data only once with the short key" file="./spec/unit/caching/test_entity_cache.rb" time="0.000098"></testcase>
23
+ <testcase classname="spec.unit.caching.test_entity_cache" name="Startback::Caching::EntityCache primary_key allows using candidate keys" file="./spec/unit/caching/test_entity_cache.rb" time="0.000088"></testcase>
24
+ <testcase classname="spec.unit.caching.test_entity_cache" name="Startback::Caching::EntityCache invalidate strips the key on the store, yielding a cache miss" file="./spec/unit/caching/test_entity_cache.rb" time="0.000116"></testcase>
25
+ <testcase classname="spec.unit.caching.test_entity_cache" name="Startback::Caching::EntityCache valid? override yields to load_raw_data only once with the extend key" file="./spec/unit/caching/test_entity_cache.rb" time="0.000134"></testcase>
26
+ <testcase classname="spec.unit.context.test_abstraction_factory" name="Startback::Context factor is a factory for other context-related abstractions" file="./spec/unit/context/test_abstraction_factory.rb" time="0.000383"></testcase>
27
+ <testcase classname="spec.unit.context.test_abstraction_factory" name="Startback::Context factor is takes cares of abstraction arguments" file="./spec/unit/context/test_abstraction_factory.rb" time="0.000057"></testcase>
28
+ <testcase classname="spec.unit.context.test_abstraction_factory" name="Startback::Context factor is caches even in presence ofabstraction arguments" file="./spec/unit/context/test_abstraction_factory.rb" time="0.000049"></testcase>
29
+ <testcase classname="spec.unit.context.test_abstraction_factory" name="Startback::Context factor is distinguishes different abstraction arguments" file="./spec/unit/context/test_abstraction_factory.rb" time="0.000048"></testcase>
30
+ <testcase classname="spec.unit.context.test_dup" name="Startback::Context dup yields a dup of the original context" file="./spec/unit/context/test_dup.rb" time="0.000057"></testcase>
31
+ <testcase classname="spec.unit.context.test_dup" name="Startback::Context dup cleans all factored cache" file="./spec/unit/context/test_dup.rb" time="0.000074"></testcase>
32
+ <testcase classname="spec.unit.context.test_h_factory" name="Startback::Context h information contract has a to_json that dumps it" file="./spec/unit/context/test_h_factory.rb" time="0.000042"></testcase>
33
+ <testcase classname="spec.unit.context.test_h_factory" name="Startback::Context h information contract allows installing factories" file="./spec/unit/context/test_h_factory.rb" time="0.000790"></testcase>
34
+ <testcase classname="spec.unit.context.test_h_factory" name="Startback::Context h information contract has a `to_h` information contract that works as expected" file="./spec/unit/context/test_h_factory.rb" time="0.000049"></testcase>
35
+ <testcase classname="spec.unit.context.test_h_factory" name="Startback::Context h information contract has a `h` information contract that works as expected" file="./spec/unit/context/test_h_factory.rb" time="0.000068"></testcase>
36
+ <testcase classname="spec.unit.context.test_middleware" name="Startback::Context::Middleware when used without option sets the default context class" file="./spec/unit/context/test_middleware.rb" time="0.002972"></testcase>
37
+ <testcase classname="spec.unit.context.test_middleware" name="Startback::Context::Middleware when specifying the context class sets the default context class" file="./spec/unit/context/test_middleware.rb" time="0.000162"></testcase>
38
+ <testcase classname="spec.unit.support.hooks.test_after_hook" name="Startback::Support::Hooks after_xxx works as expected" file="./spec/unit/support/hooks/test_after_hook.rb" time="0.000047"></testcase>
39
+ <testcase classname="spec.unit.support.hooks.test_after_hook" name="Startback::Support::Hooks after_xxx works as expected on subclass" file="./spec/unit/support/hooks/test_after_hook.rb" time="0.000045"></testcase>
40
+ <testcase classname="spec.unit.support.hooks.test_before_hook" name="Startback::Support::Hooks before_xxx works as expected" file="./spec/unit/support/hooks/test_before_hook.rb" time="0.000045"></testcase>
41
+ <testcase classname="spec.unit.support.hooks.test_before_hook" name="Startback::Support::Hooks before_xxx works as expected on subclass" file="./spec/unit/support/hooks/test_before_hook.rb" time="0.000044"></testcase>
42
+ <testcase classname="spec.unit.support.operation_runner.test_around_run" name="Startback::Support::OperationRunner around_run the simplest contract lets run an operation with world bound" file="./spec/unit/support/operation_runner/test_around_run.rb" time="0.000092"></testcase>
43
+ <testcase classname="spec.unit.support.operation_runner.test_around_run" name="Startback::Support::OperationRunner around_run the around feature calls the around before the operation itself" file="./spec/unit/support/operation_runner/test_around_run.rb" time="0.000058"></testcase>
44
+ <testcase classname="spec.unit.support.operation_runner.test_around_run" name="Startback::Support::OperationRunner around_run the around feature with a class calls the proc with expected parameters" file="./spec/unit/support/operation_runner/test_around_run.rb" time="0.000078"></testcase>
45
+ <testcase classname="spec.unit.support.operation_runner.test_around_run" name="Startback::Support::OperationRunner around_run the around feature with a subclass executes all hooks" file="./spec/unit/support/operation_runner/test_around_run.rb" time="0.000059"></testcase>
46
+ <testcase classname="spec.unit.support.operation_runner.test_before_after_call" name="Startback::Support::OperationRunner before_call runs before the around hooks" file="./spec/unit/support/operation_runner/test_before_after_call.rb" time="0.000053"></testcase>
47
+ <testcase classname="spec.unit.support.test_robusteness" name="Startback::Support::Robustness monitor works" file="./spec/unit/support/test_robusteness.rb" time="0.000060"></testcase>
48
+ <testcase classname="spec.unit.support.test_robusteness" name="Startback::Support::Robustness stop_errors works and logs the error" file="./spec/unit/support/test_robusteness.rb" time="0.000070"></testcase>
49
+ <testcase classname="spec.unit.support.test_robusteness" name="Startback::Support::Robustness stop_errors returns the result if no error" file="./spec/unit/support/test_robusteness.rb" time="0.000057"></testcase>
50
+ <testcase classname="spec.unit.support.test_robusteness" name="Startback::Support::Robustness try_max_times fails if n errors are seen" file="./spec/unit/support/test_robusteness.rb" time="1.000966"></testcase>
51
+ <testcase classname="spec.unit.support.test_robusteness" name="Startback::Support::Robustness try_max_times suceeds if an attemps succeeds" file="./spec/unit/support/test_robusteness.rb" time="1.001061"></testcase>
52
+ <testcase classname="spec.unit.support.test_robusteness" name="Startback::Support::Robustness try_max_times suceeds if first attemps succeeds" file="./spec/unit/support/test_robusteness.rb" time="0.000375"></testcase>
53
+ <testcase classname="spec.unit.support.test_robusteness" name="Startback::Support::Robustness parse_args works fine with full op and no context" file="./spec/unit/support/test_robusteness.rb" time="0.000260"></testcase>
54
+ <testcase classname="spec.unit.support.test_robusteness" name="Startback::Support::Robustness parse_args works fine with an string and a method name" file="./spec/unit/support/test_robusteness.rb" time="0.000228"></testcase>
55
+ <testcase classname="spec.unit.support.test_robusteness" name="Startback::Support::Robustness parse_args works fine with an string, a method name, and a message" file="./spec/unit/support/test_robusteness.rb" time="0.000218"></testcase>
56
+ <testcase classname="spec.unit.support.test_robusteness" name="Startback::Support::Robustness parse_args works fine with a string only" file="./spec/unit/support/test_robusteness.rb" time="0.000209"></testcase>
57
+ <testcase classname="spec.unit.support.test_robusteness" name="Startback::Support::Robustness parse_args works fine with a string and a context with logger" file="./spec/unit/support/test_robusteness.rb" time="0.000240"></testcase>
58
+ <testcase classname="spec.unit.support.test_robusteness" name="Startback::Support::Robustness parse_args works fine with a string and an extra hash" file="./spec/unit/support/test_robusteness.rb" time="0.000209"></testcase>
59
+ <testcase classname="spec.unit.support.test_robusteness" name="Startback::Support::Robustness parse_args works fine with a module and method" file="./spec/unit/support/test_robusteness.rb" time="0.000212"></testcase>
60
+ <testcase classname="spec.unit.support.test_robusteness" name="Startback::Support::Robustness parse_args works fine with a class and method" file="./spec/unit/support/test_robusteness.rb" time="0.000075"></testcase>
61
+ <testcase classname="spec.unit.support.test_robusteness" name="Startback::Support::Robustness parse_args works fine with an instance and method" file="./spec/unit/support/test_robusteness.rb" time="0.000077"></testcase>
62
+ <testcase classname="spec.unit.support.test_robusteness" name="Startback::Support::Robustness parse_args when a hash is passed as last arg" file="./spec/unit/support/test_robusteness.rb" time="0.000102"></testcase>
63
+ <testcase classname="spec.unit.support.test_robusteness" name="Startback::Support::Robustness logger_for works on a logger" file="./spec/unit/support/test_robusteness.rb" time="0.000042"></testcase>
64
+ <testcase classname="spec.unit.support.test_robusteness" name="Startback::Support::Robustness logger_for works on a Context responding to logger" file="./spec/unit/support/test_robusteness.rb" time="0.000074"></testcase>
65
+ <testcase classname="spec.unit.support.test_robusteness" name="Startback::Support::Robustness logger_for works on an object having a Context responding to logger" file="./spec/unit/support/test_robusteness.rb" time="0.000121"></testcase>
66
+ <testcase classname="spec.unit.support.test_robusteness" name="Startback::Support::Robustness logger_for works on an object having a Context but no logger" file="./spec/unit/support/test_robusteness.rb" time="0.000046"></testcase>
67
+ <testcase classname="spec.unit.test_event" name="Startback::Event presents an ostruct on top of its data" file="./spec/unit/test_event.rb" time="0.000082"></testcase>
68
+ <testcase classname="spec.unit.test_event" name="Startback::Event the json information contract has a to_json method that works as expected" file="./spec/unit/test_event.rb" time="0.000055"></testcase>
69
+ <testcase classname="spec.unit.test_event" name="Startback::Event the json information contract has a to_json that dumps the context if any" file="./spec/unit/test_event.rb" time="0.000054"></testcase>
70
+ <testcase classname="spec.unit.test_event" name="Startback::Event the json information contract has a json class method that works as expected" file="./spec/unit/test_event.rb" time="0.000092"></testcase>
71
+ <testcase classname="spec.unit.test_event" name="Startback::Event the json information contract accepts an explicit context in the world" file="./spec/unit/test_event.rb" time="0.000041"></testcase>
72
+ <testcase classname="spec.unit.test_event" name="Startback::Event the json information contract accepts an context factory in the world" file="./spec/unit/test_event.rb" time="0.000047"></testcase>
73
+ <testcase classname="spec.unit.test_operation" name="Startback::Operation can be bound, which returns a new operation" file="./spec/unit/test_operation.rb" time="0.000043"></testcase>
74
+ <testcase classname="spec.unit.test_operation" name="Startback::Operation::MultiOperation lets chain with +" file="./spec/unit/test_operation.rb" time="0.000046"></testcase>
75
+ <testcase classname="spec.unit.test_operation" name="Startback::Operation::MultiOperation calls and collects the result on call" file="./spec/unit/test_operation.rb" time="0.000093"></testcase>
76
+ <testcase classname="spec.unit.test_operation" name="Startback::Operation::MultiOperation binds every sub operation recursively" file="./spec/unit/test_operation.rb" time="0.000040"></testcase>
77
+ <testcase classname="spec.unit.test_support" name="Startback::Support deep_merge works as expected" file="./spec/unit/test_support.rb" time="0.000046"></testcase>
78
+ <testcase classname="spec.unit.web.test_auto_caching" name="Startback::Web::AutoCaching when used without options sets the development Cache-Control since this is a test" file="./spec/unit/web/test_auto_caching.rb" time="0.000214"></testcase>
79
+ <testcase classname="spec.unit.web.test_auto_caching" name="Startback::Web::AutoCaching when forcing production sets the production Cache-Control" file="./spec/unit/web/test_auto_caching.rb" time="0.000144"></testcase>
80
+ <testcase classname="spec.unit.web.test_auto_caching" name="Startback::Web::AutoCaching when forcing development headers sets the production Cache-Control" file="./spec/unit/web/test_auto_caching.rb" time="0.000132"></testcase>
81
+ <testcase classname="spec.unit.web.test_auto_caching" name="Startback::Web::AutoCaching when setting the Cache-Control header only sets the production Cache-Control" file="./spec/unit/web/test_auto_caching.rb" time="0.000150"></testcase>
82
+ <testcase classname="spec.unit.web.test_auto_caching" name="Startback::Web::AutoCaching when a Cache-Control header is already set by the app sets the production Cache-Control" file="./spec/unit/web/test_auto_caching.rb" time="0.000139"></testcase>
83
+ <testcase classname="spec.unit.web.test_catch_all" name="Startback::Web::CatchAll when used without context returns a 500 with json explanation" file="./spec/unit/web/test_catch_all.rb" time="0.000510"></testcase>
84
+ <testcase classname="spec.unit.web.test_catch_all" name="Startback::Web::CatchAll when used with a context providing an error handler returns a 500 with json explanation" file="./spec/unit/web/test_catch_all.rb" time="0.000215"></testcase>
85
+ <testcase classname="spec.unit.web.test_cors_headers" name="Startback::Web::CorsHeaders when used without options sets the CORS headers to default values" file="./spec/unit/web/test_cors_headers.rb" time="0.000172"></testcase>
86
+ <testcase classname="spec.unit.web.test_cors_headers" name="Startback::Web::CorsHeaders when used without options strips everything when option" file="./spec/unit/web/test_cors_headers.rb" time="0.000176"></testcase>
87
+ <testcase classname="spec.unit.web.test_cors_headers" name="Startback::Web::CorsHeaders when used with the :bounce option sets the CORS Origin header to the caller" file="./spec/unit/web/test_cors_headers.rb" time="0.000151"></testcase>
88
+ <testcase classname="spec.unit.web.test_cors_headers" name="Startback::Web::CorsHeaders when overriding a header sets the CORS Origin header to the caller" file="./spec/unit/web/test_cors_headers.rb" time="0.000161"></testcase>
89
+ <testcase classname="spec.unit.web.test_cors_headers" name="Startback::Web::CorsHeaders when the app sets specific headers does not override them" file="./spec/unit/web/test_cors_headers.rb" time="0.000165"></testcase>
90
+ <testcase classname="spec.unit.web.test_healthcheck" name="Startback::Web::HealthCheck when used without a block and no failure returns a 204 when ok" file="./spec/unit/web/test_healthcheck.rb" time="0.000173"></testcase>
91
+ <testcase classname="spec.unit.web.test_healthcheck" name="Startback::Web::HealthCheck when used without a block a failure raises when ko" file="./spec/unit/web/test_healthcheck.rb" time="0.000153"></testcase>
92
+ <testcase classname="spec.unit.web.test_healthcheck" name="Startback::Web::HealthCheck when used with a block returning a debug message returns a 200 with plain text message" file="./spec/unit/web/test_healthcheck.rb" time="0.000146"></testcase>
93
+ <testcase classname="spec.unit.web.test_healthcheck" name="Startback::Web::HealthCheck when used with a block raising an exception re-raises it" file="./spec/unit/web/test_healthcheck.rb" time="0.000114"></testcase>
94
+ <testcase classname="spec.unit.web.test_magic_assets" name="Startback::Web::MagicAssets when used as an app works as expected" file="./spec/unit/web/test_magic_assets.rb" time="1.583607"></testcase>
95
+ <testcase classname="spec.unit.web.test_magic_assets" name="Startback::Web::MagicAssets when used as an app delegates a [] call to sprockets" file="./spec/unit/web/test_magic_assets.rb" time="1.071788"></testcase>
96
+ <testcase classname="spec.unit.web.test_magic_assets" name="Startback::Web::MagicAssets when used as an app returns a 404 on unknown" file="./spec/unit/web/test_magic_assets.rb" time="0.000461"></testcase>
97
+ <testcase classname="spec.unit.web.test_magic_assets" name="Startback::Web::MagicAssets when used as a middleware lets unrelated things pass" file="./spec/unit/web/test_magic_assets.rb" time="0.000344"></testcase>
98
+ <testcase classname="spec.unit.web.test_magic_assets" name="Startback::Web::MagicAssets when used as a middleware serves the assets under the chosen path" file="./spec/unit/web/test_magic_assets.rb" time="1.063166"></testcase>
99
+ <testcase classname="spec.unit.web.test_magic_assets" name="Startback::Web::MagicAssets when registering the NgHtmlTransformer works as expected" file="./spec/unit/web/test_magic_assets.rb" time="1.064263"></testcase>
100
+ </testsuite>
@@ -1,7 +1,7 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  module Startback
4
- describe Context do
4
+ describe Context, "factor" do
5
5
 
6
6
  let(:context) {
7
7
  Context.new
@@ -0,0 +1,46 @@
1
+ require 'spec_helper'
2
+
3
+ module Startback
4
+ describe Context, "dup" do
5
+
6
+ class Subcontext < Context
7
+ attr_accessor :foo
8
+ end
9
+
10
+ let(:context) {
11
+ Subcontext.new.tap{|s| s.foo = "bar" }
12
+ }
13
+
14
+ class ContextRelatedAbstraction
15
+
16
+ def initialize(context)
17
+ @context = context
18
+ end
19
+ attr_reader :context
20
+
21
+ end
22
+
23
+ it 'yields a dup of the original context' do
24
+ seen = false
25
+ got = context.dup{|x|
26
+ seen = x
27
+ expect(x).not_to be(context)
28
+ }
29
+ expect(seen).to be(got)
30
+ expect(got).to be_a(Subcontext)
31
+ expect(got).not_to be(context)
32
+ expect(got.foo).to eql("bar")
33
+ end
34
+
35
+ it 'cleans all factored cache' do
36
+ cra = context.factor(ContextRelatedAbstraction)
37
+ expect(cra).to be_a(ContextRelatedAbstraction)
38
+ cra2 = context.factor(ContextRelatedAbstraction)
39
+ expect(cra2).to be(cra)
40
+ cra3 = context.dup.factor(ContextRelatedAbstraction)
41
+ expect(cra3).not_to be(cra)
42
+ expect(cra3).not_to be(cra2)
43
+ end
44
+
45
+ end
46
+ end
@@ -1,7 +1,7 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  module Startback
4
- describe Context do
4
+ describe Context, "h information contract" do
5
5
 
6
6
  it "has a to_json that dumps it" do
7
7
  expect(Context.new.to_json).to eql("{}")
@@ -16,7 +16,7 @@ module Startback
16
16
  h.merge!("foo" => foo)
17
17
  end
18
18
  end
19
-
19
+
20
20
  class SubContext
21
21
  attr_accessor :bar
22
22
  h_factory do |c,h|
@@ -1,8 +1,11 @@
1
+ require 'rspec/core/rake_task'
2
+
1
3
  namespace :test do
2
4
 
3
5
  desc "Run RSpec unit tests"
4
- task :unit do
5
- system("rspec -Ilib -Ispec --pattern 'spec/unit/**/test_*.rb' --color --backtrace --fail-fast")
6
+ RSpec::Core::RakeTask.new(:unit) do |t|
7
+ t.pattern = "spec/unit/**/test_*.rb"
8
+ t.rspec_opts = %{-Ilib -Ispec --color --backtrace --format progress --format RspecJunitFormatter --out spec/rspec-unit.xml}
6
9
  end
7
10
 
8
11
  desc "Run the tests in the examples folder"
metadata CHANGED
@@ -1,73 +1,91 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: startback
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.4
4
+ version: 0.7.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bernard Lambeau
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-04-24 00:00:00.000000000 Z
11
+ date: 2020-08-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: rake
14
+ name: rspec
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
19
+ version: '3.6'
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: '4.0'
20
23
  type: :development
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
24
27
  - - ">="
25
28
  - !ruby/object:Gem::Version
26
- version: '0'
29
+ version: '3.6'
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: '4.0'
27
33
  - !ruby/object:Gem::Dependency
28
- name: rspec
34
+ name: rspec_junit_formatter
29
35
  requirement: !ruby/object:Gem::Requirement
30
36
  requirements:
31
37
  - - ">="
32
38
  - !ruby/object:Gem::Version
33
- version: '0'
39
+ version: 0.4.1
40
+ - - "<"
41
+ - !ruby/object:Gem::Version
42
+ version: '0.5'
34
43
  type: :development
35
44
  prerelease: false
36
45
  version_requirements: !ruby/object:Gem::Requirement
37
46
  requirements:
38
47
  - - ">="
39
48
  - !ruby/object:Gem::Version
40
- version: '0'
49
+ version: 0.4.1
50
+ - - "<"
51
+ - !ruby/object:Gem::Version
52
+ version: '0.5'
41
53
  - !ruby/object:Gem::Dependency
42
- name: rack-test
54
+ name: webspicy
43
55
  requirement: !ruby/object:Gem::Requirement
44
56
  requirements:
45
57
  - - ">="
46
58
  - !ruby/object:Gem::Version
47
- version: '0'
59
+ version: 0.15.2
60
+ - - "<"
61
+ - !ruby/object:Gem::Version
62
+ version: '0.16'
48
63
  type: :development
49
64
  prerelease: false
50
65
  version_requirements: !ruby/object:Gem::Requirement
51
66
  requirements:
52
67
  - - ">="
53
68
  - !ruby/object:Gem::Version
54
- version: '0'
69
+ version: 0.15.2
70
+ - - "<"
71
+ - !ruby/object:Gem::Version
72
+ version: '0.16'
55
73
  - !ruby/object:Gem::Dependency
56
- name: sprockets
74
+ name: rack-test
57
75
  requirement: !ruby/object:Gem::Requirement
58
76
  requirements:
59
- - - "~>"
77
+ - - ">="
60
78
  - !ruby/object:Gem::Version
61
- version: 4.0.0.beta8
79
+ version: '0'
62
80
  type: :development
63
81
  prerelease: false
64
82
  version_requirements: !ruby/object:Gem::Requirement
65
83
  requirements:
66
- - - "~>"
84
+ - - ">="
67
85
  - !ruby/object:Gem::Version
68
- version: 4.0.0.beta8
86
+ version: '0'
69
87
  - !ruby/object:Gem::Dependency
70
- name: babel-transpiler
88
+ name: rake
71
89
  requirement: !ruby/object:Gem::Requirement
72
90
  requirements:
73
91
  - - ">="
@@ -84,65 +102,282 @@ dependencies:
84
102
  name: sinatra
85
103
  requirement: !ruby/object:Gem::Requirement
86
104
  requirements:
87
- - - "~>"
105
+ - - ">="
88
106
  - !ruby/object:Gem::Version
89
107
  version: '2.0'
108
+ - - "<"
109
+ - !ruby/object:Gem::Version
110
+ version: '3.0'
90
111
  type: :runtime
91
112
  prerelease: false
92
113
  version_requirements: !ruby/object:Gem::Requirement
93
114
  requirements:
94
- - - "~>"
115
+ - - ">="
95
116
  - !ruby/object:Gem::Version
96
117
  version: '2.0'
118
+ - - "<"
119
+ - !ruby/object:Gem::Version
120
+ version: '3.0'
97
121
  - !ruby/object:Gem::Dependency
98
122
  name: rack-robustness
99
123
  requirement: !ruby/object:Gem::Requirement
100
124
  requirements:
101
- - - "~>"
125
+ - - ">="
126
+ - !ruby/object:Gem::Version
127
+ version: '1.0'
128
+ - - "<"
102
129
  - !ruby/object:Gem::Version
103
- version: '1.1'
130
+ version: '2.0'
104
131
  type: :runtime
105
132
  prerelease: false
106
133
  version_requirements: !ruby/object:Gem::Requirement
107
134
  requirements:
108
- - - "~>"
135
+ - - ">="
136
+ - !ruby/object:Gem::Version
137
+ version: '1.0'
138
+ - - "<"
109
139
  - !ruby/object:Gem::Version
110
- version: '1.1'
140
+ version: '2.0'
111
141
  - !ruby/object:Gem::Dependency
112
142
  name: finitio
113
143
  requirement: !ruby/object:Gem::Requirement
114
144
  requirements:
115
145
  - - ">="
116
146
  - !ruby/object:Gem::Version
117
- version: '0.7'
147
+ version: '0.8'
148
+ - - "<"
149
+ - !ruby/object:Gem::Version
150
+ version: '0.9'
118
151
  type: :runtime
119
152
  prerelease: false
120
153
  version_requirements: !ruby/object:Gem::Requirement
121
154
  requirements:
122
155
  - - ">="
123
156
  - !ruby/object:Gem::Version
124
- version: '0.7'
157
+ version: '0.8'
158
+ - - "<"
159
+ - !ruby/object:Gem::Version
160
+ version: '0.9'
125
161
  - !ruby/object:Gem::Dependency
126
162
  name: path
127
163
  requirement: !ruby/object:Gem::Requirement
128
164
  requirements:
129
165
  - - ">="
130
166
  - !ruby/object:Gem::Version
131
- version: '1.3'
167
+ version: '2.0'
168
+ - - "<"
169
+ - !ruby/object:Gem::Version
170
+ version: '3.0'
171
+ type: :runtime
172
+ prerelease: false
173
+ version_requirements: !ruby/object:Gem::Requirement
174
+ requirements:
175
+ - - ">="
176
+ - !ruby/object:Gem::Version
177
+ version: '2.0'
178
+ - - "<"
179
+ - !ruby/object:Gem::Version
180
+ version: '3.0'
181
+ - !ruby/object:Gem::Dependency
182
+ name: http
183
+ requirement: !ruby/object:Gem::Requirement
184
+ requirements:
185
+ - - ">="
186
+ - !ruby/object:Gem::Version
187
+ version: '4.4'
188
+ - - "<"
189
+ - !ruby/object:Gem::Version
190
+ version: '5.0'
191
+ type: :runtime
192
+ prerelease: false
193
+ version_requirements: !ruby/object:Gem::Requirement
194
+ requirements:
195
+ - - ">="
196
+ - !ruby/object:Gem::Version
197
+ version: '4.4'
198
+ - - "<"
199
+ - !ruby/object:Gem::Version
200
+ version: '5.0'
201
+ - !ruby/object:Gem::Dependency
202
+ name: bunny
203
+ requirement: !ruby/object:Gem::Requirement
204
+ requirements:
205
+ - - ">="
206
+ - !ruby/object:Gem::Version
207
+ version: '2.14'
208
+ - - "<"
209
+ - !ruby/object:Gem::Version
210
+ version: '3.0'
211
+ type: :runtime
212
+ prerelease: false
213
+ version_requirements: !ruby/object:Gem::Requirement
214
+ requirements:
215
+ - - ">="
216
+ - !ruby/object:Gem::Version
217
+ version: '2.14'
218
+ - - "<"
219
+ - !ruby/object:Gem::Version
220
+ version: '3.0'
221
+ - !ruby/object:Gem::Dependency
222
+ name: nokogiri
223
+ requirement: !ruby/object:Gem::Requirement
224
+ requirements:
225
+ - - ">="
226
+ - !ruby/object:Gem::Version
227
+ version: '1.0'
228
+ - - "<"
229
+ - !ruby/object:Gem::Version
230
+ version: '2.0'
231
+ type: :runtime
232
+ prerelease: false
233
+ version_requirements: !ruby/object:Gem::Requirement
234
+ requirements:
235
+ - - ">="
236
+ - !ruby/object:Gem::Version
237
+ version: '1.0'
238
+ - - "<"
239
+ - !ruby/object:Gem::Version
240
+ version: '2.0'
241
+ - !ruby/object:Gem::Dependency
242
+ name: puma
243
+ requirement: !ruby/object:Gem::Requirement
244
+ requirements:
245
+ - - ">="
246
+ - !ruby/object:Gem::Version
247
+ version: '4.3'
248
+ - - "<"
249
+ - !ruby/object:Gem::Version
250
+ version: '5.0'
251
+ type: :runtime
252
+ prerelease: false
253
+ version_requirements: !ruby/object:Gem::Requirement
254
+ requirements:
255
+ - - ">="
256
+ - !ruby/object:Gem::Version
257
+ version: '4.3'
258
+ - - "<"
259
+ - !ruby/object:Gem::Version
260
+ version: '5.0'
261
+ - !ruby/object:Gem::Dependency
262
+ name: jwt
263
+ requirement: !ruby/object:Gem::Requirement
264
+ requirements:
265
+ - - ">="
266
+ - !ruby/object:Gem::Version
267
+ version: '2.1'
268
+ - - "<"
269
+ - !ruby/object:Gem::Version
270
+ version: '3.0'
271
+ type: :runtime
272
+ prerelease: false
273
+ version_requirements: !ruby/object:Gem::Requirement
274
+ requirements:
275
+ - - ">="
276
+ - !ruby/object:Gem::Version
277
+ version: '2.1'
278
+ - - "<"
279
+ - !ruby/object:Gem::Version
280
+ version: '3.0'
281
+ - !ruby/object:Gem::Dependency
282
+ name: bmg
283
+ requirement: !ruby/object:Gem::Requirement
284
+ requirements:
285
+ - - ">="
286
+ - !ruby/object:Gem::Version
287
+ version: 0.17.5
288
+ - - "<"
289
+ - !ruby/object:Gem::Version
290
+ version: 0.18.0
291
+ type: :runtime
292
+ prerelease: false
293
+ version_requirements: !ruby/object:Gem::Requirement
294
+ requirements:
295
+ - - ">="
296
+ - !ruby/object:Gem::Version
297
+ version: 0.17.5
298
+ - - "<"
299
+ - !ruby/object:Gem::Version
300
+ version: 0.18.0
301
+ - !ruby/object:Gem::Dependency
302
+ name: tzinfo
303
+ requirement: !ruby/object:Gem::Requirement
304
+ requirements:
305
+ - - ">="
306
+ - !ruby/object:Gem::Version
307
+ version: '1.2'
308
+ - - "<"
309
+ - !ruby/object:Gem::Version
310
+ version: '2.0'
311
+ type: :runtime
312
+ prerelease: false
313
+ version_requirements: !ruby/object:Gem::Requirement
314
+ requirements:
315
+ - - ">="
316
+ - !ruby/object:Gem::Version
317
+ version: '1.2'
318
+ - - "<"
319
+ - !ruby/object:Gem::Version
320
+ version: '2.0'
321
+ - !ruby/object:Gem::Dependency
322
+ name: tzinfo-data
323
+ requirement: !ruby/object:Gem::Requirement
324
+ requirements:
325
+ - - ">="
326
+ - !ruby/object:Gem::Version
327
+ version: '0'
328
+ type: :runtime
329
+ prerelease: false
330
+ version_requirements: !ruby/object:Gem::Requirement
331
+ requirements:
332
+ - - ">="
333
+ - !ruby/object:Gem::Version
334
+ version: '0'
335
+ - !ruby/object:Gem::Dependency
336
+ name: i18n
337
+ requirement: !ruby/object:Gem::Requirement
338
+ requirements:
339
+ - - ">="
340
+ - !ruby/object:Gem::Version
341
+ version: '1.0'
342
+ - - "<"
343
+ - !ruby/object:Gem::Version
344
+ version: '2.0'
345
+ type: :runtime
346
+ prerelease: false
347
+ version_requirements: !ruby/object:Gem::Requirement
348
+ requirements:
349
+ - - ">="
350
+ - !ruby/object:Gem::Version
351
+ version: '1.0'
352
+ - - "<"
353
+ - !ruby/object:Gem::Version
354
+ version: '2.0'
355
+ - !ruby/object:Gem::Dependency
356
+ name: mustache
357
+ requirement: !ruby/object:Gem::Requirement
358
+ requirements:
359
+ - - ">="
360
+ - !ruby/object:Gem::Version
361
+ version: '1.0'
362
+ - - "<"
363
+ - !ruby/object:Gem::Version
364
+ version: '2.0'
132
365
  type: :runtime
133
366
  prerelease: false
134
367
  version_requirements: !ruby/object:Gem::Requirement
135
368
  requirements:
136
369
  - - ">="
137
370
  - !ruby/object:Gem::Version
138
- version: '1.3'
371
+ version: '1.0'
372
+ - - "<"
373
+ - !ruby/object:Gem::Version
374
+ version: '2.0'
139
375
  description: Yet another ruby backend framework, I'm afraid
140
376
  email: blambeau@gmail.com
141
377
  executables: []
142
378
  extensions: []
143
379
  extra_rdoc_files: []
144
380
  files:
145
- - Gemfile
146
381
  - README.md
147
382
  - Rakefile
148
383
  - lib/startback.rb
@@ -185,19 +420,21 @@ files:
185
420
  - lib/startback/web/magic_assets/rake_tasks.rb
186
421
  - lib/startback/web/middleware.rb
187
422
  - lib/startback/web/shield.rb
423
+ - spec/rspec-unit.xml
188
424
  - spec/spec_helper.rb
189
425
  - spec/unit/audit/test_trailer.rb
190
426
  - spec/unit/bus/memory/test_async.rb
191
427
  - spec/unit/bus/memory/test_sync.rb
192
428
  - spec/unit/caching/test_entity_cache.rb
193
429
  - spec/unit/context/test_abstraction_factory.rb
430
+ - spec/unit/context/test_dup.rb
431
+ - spec/unit/context/test_h_factory.rb
194
432
  - spec/unit/context/test_middleware.rb
195
433
  - spec/unit/support/hooks/test_after_hook.rb
196
434
  - spec/unit/support/hooks/test_before_hook.rb
197
435
  - spec/unit/support/operation_runner/test_around_run.rb
198
436
  - spec/unit/support/operation_runner/test_before_after_call.rb
199
437
  - spec/unit/support/test_robusteness.rb
200
- - spec/unit/test_context.rb
201
438
  - spec/unit/test_event.rb
202
439
  - spec/unit/test_operation.rb
203
440
  - spec/unit/test_support.rb
@@ -209,7 +446,6 @@ files:
209
446
  - spec/unit/web/test_cors_headers.rb
210
447
  - spec/unit/web/test_healthcheck.rb
211
448
  - spec/unit/web/test_magic_assets.rb
212
- - tasks/gem.rake
213
449
  - tasks/test.rake
214
450
  homepage: http://www.enspirit.be
215
451
  licenses:
data/Gemfile DELETED
@@ -1,2 +0,0 @@
1
- source "https://rubygems.org"
2
- gemspec
@@ -1,39 +0,0 @@
1
- require 'rubygems/package_task'
2
-
3
- # Dynamically load the gem spec
4
- gemspec_file = File.expand_path('../../startback.gemspec', __FILE__)
5
- gemspec = Kernel.eval(File.read(gemspec_file))
6
-
7
- Gem::PackageTask.new(gemspec) do |t|
8
-
9
- # Name of the package
10
- t.name = gemspec.name
11
-
12
- # Version of the package
13
- t.version = gemspec.version
14
-
15
- # Directory used to store the package files
16
- t.package_dir = "pkg"
17
-
18
- # True if a gzipped tar file (tgz) should be produced
19
- t.need_tar = false
20
-
21
- # True if a gzipped tar file (tar.gz) should be produced
22
- t.need_tar_gz = false
23
-
24
- # True if a bzip2'd tar file (tar.bz2) should be produced
25
- t.need_tar_bz2 = false
26
-
27
- # True if a zip file should be produced (default is false)
28
- t.need_zip = false
29
-
30
- # List of files to be included in the package.
31
- t.package_files = gemspec.files
32
-
33
- # Tar command for gzipped or bzip2ed archives.
34
- t.tar_command = "tar"
35
-
36
- # Zip command for zipped archives.
37
- t.zip_command = "zip"
38
-
39
- end