mumukit-core 0.4.3 → 0.5.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: 2212ddff9a2ba1c39dc80d8354c6cecd613176f3
4
- data.tar.gz: e02487f128cf63efe14ab9a55bba614345f025af
3
+ metadata.gz: afd511f59ac5615b6b1142a3eb8d47fd7e70b2c0
4
+ data.tar.gz: b3b5ebccc3ac50ded28975ab3dec9c7f95209757
5
5
  SHA512:
6
- metadata.gz: 317a6319d2c64aa2784670f7cdcc6e2a1ffbdf2b85917ab5219a4a4ea248bdbbc4bdc25e97b12fd1c384d94b187d69a2da5ec0c0cb6957163d4d8b6eb781b2a8
7
- data.tar.gz: c847c1b7e9bab20c932e428a41f60c532f17f2a28c6888b2e857d13d496491affffa282ac2c059af24d7251135d08b8d88bc7a150bc3dad54a6dd23e7d397251
6
+ metadata.gz: 85609add9cef872ca9212f6ec9df5d4a6898109b2d063c0187ac7b316f692a5c15e72ec253eeadf14446af6a7dd4b6f26b5839c387451927d9c8f391bd11487c
7
+ data.tar.gz: c66e2ad7b9dfc773195d79775317b976f614b816b403f1bca14dd5e1aaea83a6a407366cf17a133263bc1ce1cd88043b935fbf48581750c9958560a46be38e6d
@@ -0,0 +1,5 @@
1
+ RSpec::Matchers.define :json_eq do |expected_json_hash|
2
+ match do |actual_json|
3
+ expected_json_hash.with_indifferent_access == ActiveSupport::JSON.decode(actual_json)
4
+ end
5
+ end
@@ -0,0 +1,20 @@
1
+ RSpec::Matchers.define :json_like do |expected, options={}|
2
+ except = options[:except] || []
3
+ match do |actual|
4
+ actual.as_json.with_indifferent_access.except(except) == expected.as_json.with_indifferent_access
5
+ end
6
+
7
+ failure_message_for_should do |actual|
8
+ <<-EOS
9
+ expected: #{expected.as_json} (#{expected.class})
10
+ got: #{actual.as_json} (#{actual.class})
11
+ EOS
12
+ end
13
+
14
+ failure_message_for_should_not do |actual|
15
+ <<-EOS
16
+ expected: value != #{expected.as_json} (#{expected.class})
17
+ got: #{actual.as_json} (#{actual.class})
18
+ EOS
19
+ end
20
+ end
@@ -0,0 +1,2 @@
1
+ require_relative './rspec/json_like'
2
+ require_relative './rspec/json_eq'
@@ -1,5 +1,5 @@
1
1
  module Mumukit
2
2
  module Core
3
- VERSION = '0.4.3'
3
+ VERSION = '0.5.0'
4
4
  end
5
5
  end
@@ -0,0 +1,7 @@
1
+ require 'yaml'
2
+
3
+ module YAML
4
+ def self.load_interpolated(filename)
5
+ YAML.load(ERB.new(File.read(filename)).result)
6
+ end
7
+ end
data/lib/mumukit/core.rb CHANGED
@@ -16,4 +16,5 @@ require_relative './core/array'
16
16
  require_relative './core/regexp'
17
17
  require_relative './core/request'
18
18
  require_relative './core/file'
19
- require_relative './core/i18n'
19
+ require_relative './core/i18n'
20
+ require_relative './core/yaml'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mumukit-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.3
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Franco Leonardo Bulgarelli
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-12-20 00:00:00.000000000 Z
11
+ date: 2017-01-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -142,8 +142,12 @@ files:
142
142
  - lib/mumukit/core/object.rb
143
143
  - lib/mumukit/core/regexp.rb
144
144
  - lib/mumukit/core/request.rb
145
+ - lib/mumukit/core/rspec.rb
146
+ - lib/mumukit/core/rspec/json_eq.rb
147
+ - lib/mumukit/core/rspec/json_like.rb
145
148
  - lib/mumukit/core/string.rb
146
149
  - lib/mumukit/core/version.rb
150
+ - lib/mumukit/core/yaml.rb
147
151
  homepage: https://github.com/mumuki/mumukit-core
148
152
  licenses:
149
153
  - MIT