jani-from_json 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +14 -0
- data/.rspec +2 -0
- data/.ruby-version +1 -0
- data/.travis.yml +7 -0
- data/Gemfile +12 -0
- data/Guardfile +17 -0
- data/LICENSE.txt +22 -0
- data/README.md +41 -0
- data/Rakefile +6 -0
- data/jani-from_json.gemspec +28 -0
- data/lib/jani/from_json.rb +10 -0
- data/lib/jani/from_json/banner.rb +3 -0
- data/lib/jani/from_json/builder.rb +65 -0
- data/lib/jani/from_json/movie.rb +11 -0
- data/lib/jani/from_json/strip.rb +3 -0
- data/lib/jani/from_json/tracking_event.rb +3 -0
- data/lib/jani/from_json/version.rb +5 -0
- data/spec/factories/builders.rb +118 -0
- data/spec/jani/from_json/builder_spec.rb +92 -0
- data/spec/jani/from_json/from_json_spec.rb +12 -0
- data/spec/spec_helper.rb +92 -0
- metadata +153 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 1c54fb46eca02a0a3b1b36cbdecce26b81fe116d
|
4
|
+
data.tar.gz: 79542e2c5a9b5d97849fa466ad45be93a339482f
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 99853c4cf66f5e35fbe9107388c78162e4f52b6ec6b91767b7cc9955a51b171e4301f307f1047de4d44ebdd2d7e1139dae76e286f40c92de2692d8003a0a8796
|
7
|
+
data.tar.gz: 48429a75bbbeb83e07632b48f9efed49d65dad63757270c42810c185aa51d7092144320a2d07bb65e1c572020738dda74d693c1a67cc436eb56f021a8abf1116
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.1.3
|
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/Guardfile
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
# A sample Guardfile
|
2
|
+
# More info at https://github.com/guard/guard#readme
|
3
|
+
|
4
|
+
# Note: The cmd option is now required due to the increasing number of ways
|
5
|
+
# rspec may be run, below are examples of the most common uses.
|
6
|
+
# * bundler: 'bundle exec rspec'
|
7
|
+
# * bundler binstubs: 'bin/rspec'
|
8
|
+
# * spring: 'bin/rsspec' (This will use spring if running and you have
|
9
|
+
# installed the spring binstubs per the docs)
|
10
|
+
# * zeus: 'zeus rspec' (requires the server to be started separetly)
|
11
|
+
# * 'just' rspec: 'rspec'
|
12
|
+
guard :rspec, cmd: 'bundle exec rspec' do
|
13
|
+
watch(%r{^spec/.+_spec\.rb$})
|
14
|
+
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
|
15
|
+
watch('spec/spec_helper.rb') { "spec" }
|
16
|
+
end
|
17
|
+
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Ohno Shin'ichi
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
[![Build Status](https://travis-ci.org/shin1ohno/jani-from_json.svg)](https://travis-ci.org/shin1ohno/jani-from_json) [![Code Climate](https://codeclimate.com/github/shin1ohno/jani-from_json/badges/gpa.svg)](https://codeclimate.com/github/shin1ohno/jani-from_json) [![Test Coverage](https://codeclimate.com/github/shin1ohno/jani-from_json/badges/coverage.svg)](https://codeclimate.com/github/shin1ohno/jani-from_json)
|
2
|
+
|
3
|
+
# Jani::FromJson
|
4
|
+
|
5
|
+
Convert JSON data into jani structured movie object.
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'jani-from_json'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install jani-from_json
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
```ruby
|
26
|
+
require "jani/from_json"
|
27
|
+
|
28
|
+
movie = Jani::FromJson.to_movie(json_data) #-> movie object
|
29
|
+
|
30
|
+
movie.strips #-> array of strip
|
31
|
+
movie.tracking_events #-> array of tracking events
|
32
|
+
#... see Jani::FromJson::Movie
|
33
|
+
```
|
34
|
+
|
35
|
+
## Contributing
|
36
|
+
|
37
|
+
1. Fork it ( https://github.com/[my-github-username]/jani-from_json/fork )
|
38
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
39
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
40
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
41
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'jani/from_json/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "jani-from_json"
|
8
|
+
spec.version = Jani::FromJson::VERSION
|
9
|
+
spec.authors = ["Ohno Shin'ichi"]
|
10
|
+
spec.email = ["ohno@cookpad.com"]
|
11
|
+
spec.summary = %q{Convert JSON data into jani structured movie object.}
|
12
|
+
spec.description = %q{Convert JSON data into jani structured movie object.}
|
13
|
+
spec.homepage = ""
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_dependency "json"
|
22
|
+
|
23
|
+
spec.add_development_dependency "bundler", "~> 1.7"
|
24
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
25
|
+
spec.add_development_dependency "rspec"
|
26
|
+
spec.add_development_dependency "rspec-collection_matchers"
|
27
|
+
spec.add_development_dependency "factory_girl"
|
28
|
+
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
require "json"
|
2
|
+
require "jani/from_json/movie"
|
3
|
+
require "jani/from_json/banner"
|
4
|
+
require "jani/from_json/strip"
|
5
|
+
require "jani/from_json/tracking_event"
|
6
|
+
|
7
|
+
class Jani::FromJson::Builder
|
8
|
+
attr_accessor :json_data
|
9
|
+
|
10
|
+
def initialize(json_data: json_data)
|
11
|
+
@json_data = json_data
|
12
|
+
end
|
13
|
+
|
14
|
+
def new_movie
|
15
|
+
Jani::FromJson::Movie.new.tap do |m|
|
16
|
+
m.uuid = hashed_data["uuid"]
|
17
|
+
m.frame_width = hashed_data["frame_width"]
|
18
|
+
m.frame_height = hashed_data["frame_height"]
|
19
|
+
m.fps = hashed_data["fps"]
|
20
|
+
m.pixel_ratio = hashed_data["pixel_ratio"]
|
21
|
+
m.loading_banner = new_loading_banner
|
22
|
+
m.postroll_banner = new_postroll_banner
|
23
|
+
m.strips = new_strips
|
24
|
+
m.tracking_events = new_tracking_events
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def new_loading_banner
|
29
|
+
Jani::FromJson::Banner.new.tap { |b| b.image_url = hashed_data["loading_banner"]["image_url"] }
|
30
|
+
end
|
31
|
+
|
32
|
+
def new_postroll_banner
|
33
|
+
Jani::FromJson::Banner.new.tap do |b|
|
34
|
+
b.image_url = hashed_data["postroll_banner"]["image_url"]
|
35
|
+
b.url = hashed_data["postroll_banner"]["url"]
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def new_strips
|
40
|
+
hashed_data["strips"].map do |strip_data|
|
41
|
+
Jani::FromJson::Strip.new.tap do |s|
|
42
|
+
s.index = strip_data["index"]
|
43
|
+
s.image_url = strip_data["image_url"]
|
44
|
+
s.frames_count = strip_data["frames_count"]
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def new_tracking_events
|
50
|
+
hashed_data["tracking_events"].map do |strip_data|
|
51
|
+
Jani::FromJson::TrackingEvent.new.tap do |t|
|
52
|
+
t.label = strip_data["label"]
|
53
|
+
t.url = strip_data["url"]
|
54
|
+
t.track_on = strip_data["track_on"]
|
55
|
+
t.request_type = strip_data["request_type"]
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
private
|
61
|
+
|
62
|
+
def hashed_data
|
63
|
+
@hashed_data ||= JSON.parse(@json_data)
|
64
|
+
end
|
65
|
+
end
|
@@ -0,0 +1,118 @@
|
|
1
|
+
require "jani/from_json/builder"
|
2
|
+
|
3
|
+
FactoryGirl.define do
|
4
|
+
factory :builder, class: Jani::FromJson::Builder do
|
5
|
+
json_data '{
|
6
|
+
"uuid": "cfcce0c6-e046-429f-89c0-8a24202ecf89",
|
7
|
+
"frame_width": 640,
|
8
|
+
"frame_height": 360,
|
9
|
+
"fps": 13,
|
10
|
+
"source_url": "https://s3-ap-northeast-1.amazonaws.com/misc.ap-northeast-1/movie-ad-transcoder/uploads/production/movies/cfcce0c6-e046-429f-89c0-8a24202ecf89/cocoa_banner_1280_720_30fps.mp4?AWSAccessKeyId=AKIAJ7N5XNK2HNRTIIXQ&Signature=DErGtqEOJxhArsrmmte7CrxZGz0%3D&Expires=1415336757",
|
11
|
+
"pixel_ratio": 2,
|
12
|
+
"conversion_status": "converted",
|
13
|
+
"loading_banner": {
|
14
|
+
"image_url": "http://example.com/strips/cfcce0c6-e046-429f-89c0-8a24202ecf89/640_360_1.jpg"
|
15
|
+
},
|
16
|
+
"postroll_banner": {
|
17
|
+
"image_url": "http://example.com/strips/cfcce0c6-e046-429f-89c0-8a24202ecf89/640_360_5.jpg",
|
18
|
+
"url": "http://example.com"
|
19
|
+
},
|
20
|
+
"tracking_events": [
|
21
|
+
{
|
22
|
+
"label": "creative_view",
|
23
|
+
"url": "/track?event=creative_view",
|
24
|
+
"track_on":null,
|
25
|
+
"request_type":"xhr"
|
26
|
+
},
|
27
|
+
{
|
28
|
+
"label":"complete",
|
29
|
+
"url":"/track?event=complete",
|
30
|
+
"track_on":30,
|
31
|
+
"request_type":"img"
|
32
|
+
}
|
33
|
+
],
|
34
|
+
"strips": [
|
35
|
+
{
|
36
|
+
"index": 1,
|
37
|
+
"image_url": "http://example.com/strips/cfcce0c6-e046-429f-89c0-8a24202ecf89/0001.jpg",
|
38
|
+
"frames_count": 13
|
39
|
+
},
|
40
|
+
{
|
41
|
+
"index": 2,
|
42
|
+
"image_url": "http://example.com/strips/cfcce0c6-e046-429f-89c0-8a24202ecf89/0002.jpg",
|
43
|
+
"frames_count": 13
|
44
|
+
},
|
45
|
+
{
|
46
|
+
"index": 3,
|
47
|
+
"image_url": "http://example.com/strips/cfcce0c6-e046-429f-89c0-8a24202ecf89/0003.jpg",
|
48
|
+
"frames_count": 13
|
49
|
+
},
|
50
|
+
{
|
51
|
+
"index": 4,
|
52
|
+
"image_url": "http://example.com/strips/cfcce0c6-e046-429f-89c0-8a24202ecf89/0004.jpg",
|
53
|
+
"frames_count": 13
|
54
|
+
},
|
55
|
+
{
|
56
|
+
"index": 5,
|
57
|
+
"image_url": "http://example.com/strips/cfcce0c6-e046-429f-89c0-8a24202ecf89/0005.jpg",
|
58
|
+
"frames_count": 13
|
59
|
+
},
|
60
|
+
{
|
61
|
+
"index": 6,
|
62
|
+
"image_url": "http://example.com/strips/cfcce0c6-e046-429f-89c0-8a24202ecf89/0006.jpg",
|
63
|
+
"frames_count": 13
|
64
|
+
},
|
65
|
+
{
|
66
|
+
"index": 7,
|
67
|
+
"image_url": "http://example.com/strips/cfcce0c6-e046-429f-89c0-8a24202ecf89/0007.jpg",
|
68
|
+
"frames_count": 13
|
69
|
+
},
|
70
|
+
{
|
71
|
+
"index": 8,
|
72
|
+
"image_url": "http://example.com/strips/cfcce0c6-e046-429f-89c0-8a24202ecf89/0008.jpg",
|
73
|
+
"frames_count": 13
|
74
|
+
},
|
75
|
+
{
|
76
|
+
"index": 9,
|
77
|
+
"image_url": "http://example.com/strips/cfcce0c6-e046-429f-89c0-8a24202ecf89/0009.jpg",
|
78
|
+
"frames_count": 13
|
79
|
+
},
|
80
|
+
{
|
81
|
+
"index": 10,
|
82
|
+
"image_url": "http://example.com/strips/cfcce0c6-e046-429f-89c0-8a24202ecf89/0010.jpg",
|
83
|
+
"frames_count": 13
|
84
|
+
},
|
85
|
+
{
|
86
|
+
"index": 11,
|
87
|
+
"image_url": "http://example.com/strips/cfcce0c6-e046-429f-89c0-8a24202ecf89/0011.jpg",
|
88
|
+
"frames_count": 13
|
89
|
+
},
|
90
|
+
{
|
91
|
+
"index": 12,
|
92
|
+
"image_url": "http://example.com/strips/cfcce0c6-e046-429f-89c0-8a24202ecf89/0012.jpg",
|
93
|
+
"frames_count": 13
|
94
|
+
},
|
95
|
+
{
|
96
|
+
"index": 13,
|
97
|
+
"image_url": "http://example.com/strips/cfcce0c6-e046-429f-89c0-8a24202ecf89/0013.jpg",
|
98
|
+
"frames_count": 13
|
99
|
+
},
|
100
|
+
{
|
101
|
+
"index": 14,
|
102
|
+
"image_url": "http://example.com/strips/cfcce0c6-e046-429f-89c0-8a24202ecf89/0014.jpg",
|
103
|
+
"frames_count": 13
|
104
|
+
},
|
105
|
+
{
|
106
|
+
"index": 15,
|
107
|
+
"image_url": "http://example.com/strips/cfcce0c6-e046-429f-89c0-8a24202ecf89/0015.jpg",
|
108
|
+
"frames_count": 13
|
109
|
+
},
|
110
|
+
{
|
111
|
+
"index": 16,
|
112
|
+
"image_url": "http://example.com/strips/cfcce0c6-e046-429f-89c0-8a24202ecf89/0016.jpg",
|
113
|
+
"frames_count": 3
|
114
|
+
}
|
115
|
+
]
|
116
|
+
}'
|
117
|
+
end
|
118
|
+
end
|
@@ -0,0 +1,92 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
require "jani/from_json/builder"
|
3
|
+
|
4
|
+
RSpec.describe Jani::FromJson::Builder do
|
5
|
+
let(:builder) { build(:builder) }
|
6
|
+
|
7
|
+
describe "#new_movie" do
|
8
|
+
subject(:movie) { builder.new_movie }
|
9
|
+
|
10
|
+
it "instantiats movie instance" do
|
11
|
+
is_expected.to be_a_kind_of Jani::FromJson::Movie
|
12
|
+
end
|
13
|
+
|
14
|
+
it "sets metadatas to the instance" do
|
15
|
+
expect(movie.uuid).to eq "cfcce0c6-e046-429f-89c0-8a24202ecf89"
|
16
|
+
expect(movie.frame_width).to eq 640
|
17
|
+
expect(movie.frame_height).to eq 360
|
18
|
+
expect(movie.fps).to eq 13
|
19
|
+
expect(movie.pixel_ratio).to eq 2
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
describe "#new_loading_banner" do
|
24
|
+
subject(:banner) { builder.new_loading_banner }
|
25
|
+
|
26
|
+
it "instantiats movie instance" do
|
27
|
+
is_expected.to be_a_kind_of Jani::FromJson::Banner
|
28
|
+
end
|
29
|
+
|
30
|
+
it "sets metadatas to the instance" do
|
31
|
+
expect(banner.image_url).to eq "http://example.com/strips/cfcce0c6-e046-429f-89c0-8a24202ecf89/640_360_1.jpg"
|
32
|
+
expect(banner.url).to be_nil
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
describe "#new_postroll_banner" do
|
37
|
+
subject(:banner) { builder.new_postroll_banner }
|
38
|
+
|
39
|
+
it "instantiats movie instance" do
|
40
|
+
is_expected.to be_a_kind_of Jani::FromJson::Banner
|
41
|
+
end
|
42
|
+
|
43
|
+
it "sets metadatas to the instance" do
|
44
|
+
expect(banner.image_url).to eq "http://example.com/strips/cfcce0c6-e046-429f-89c0-8a24202ecf89/640_360_5.jpg"
|
45
|
+
expect(banner.url).to eq "http://example.com"
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
describe "#new_strips" do
|
50
|
+
subject { builder.new_strips }
|
51
|
+
let(:first_strip) { subject[0] }
|
52
|
+
let(:last_strip) { subject[-1] }
|
53
|
+
|
54
|
+
it "instantiats strip instances" do
|
55
|
+
is_expected.to be_a_kind_of Array
|
56
|
+
is_expected.to have(16).items
|
57
|
+
end
|
58
|
+
|
59
|
+
it "sets metadatas to the instances" do
|
60
|
+
expect(first_strip.index).to eq 1
|
61
|
+
expect(first_strip.image_url).to eq "http://example.com/strips/cfcce0c6-e046-429f-89c0-8a24202ecf89/0001.jpg"
|
62
|
+
expect(first_strip.frames_count).to eq 13
|
63
|
+
|
64
|
+
expect(last_strip.index).to eq 16
|
65
|
+
expect(last_strip.image_url).to eq "http://example.com/strips/cfcce0c6-e046-429f-89c0-8a24202ecf89/0016.jpg"
|
66
|
+
expect(last_strip.frames_count).to eq 3
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
describe "#new_tracking_events" do
|
71
|
+
subject { builder.new_tracking_events }
|
72
|
+
let(:creative_view) { subject[0] }
|
73
|
+
let(:complete) { subject[1] }
|
74
|
+
|
75
|
+
it "instantiats strip instances" do
|
76
|
+
is_expected.to be_a_kind_of Array
|
77
|
+
is_expected.to have(2).items
|
78
|
+
end
|
79
|
+
|
80
|
+
it "sets metadatas to the instances" do
|
81
|
+
expect(creative_view.label).to eq "creative_view"
|
82
|
+
expect(creative_view.url).to eq "/track?event=creative_view"
|
83
|
+
expect(creative_view.request_type).to eq "xhr"
|
84
|
+
expect(creative_view.track_on).to be_nil
|
85
|
+
|
86
|
+
expect(complete.label).to eq "complete"
|
87
|
+
expect(complete.url).to eq "/track?event=complete"
|
88
|
+
expect(complete.request_type).to eq "img"
|
89
|
+
expect(complete.track_on).to eq 30
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
require "jani/from_json"
|
3
|
+
|
4
|
+
RSpec.describe Jani::FromJson do
|
5
|
+
let(:json_data) { build(:builder).json_data }
|
6
|
+
|
7
|
+
describe ".to_movie" do
|
8
|
+
subject { Jani::FromJson.to_movie(json_data) }
|
9
|
+
|
10
|
+
it { is_expected.to be_a_kind_of Jani::FromJson::Movie }
|
11
|
+
end
|
12
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,92 @@
|
|
1
|
+
require "factory_girl"
|
2
|
+
require 'rspec/collection_matchers'
|
3
|
+
require "codeclimate-test-reporter"
|
4
|
+
|
5
|
+
if ENV["CI"]
|
6
|
+
CodeClimate::TestReporter.start
|
7
|
+
end
|
8
|
+
|
9
|
+
# This file was generated by the `rspec --init` command. Conventionally, all
|
10
|
+
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
11
|
+
# The generated `.rspec` file contains `--require spec_helper` which will cause this
|
12
|
+
# file to always be loaded, without a need to explicitly require it in any files.
|
13
|
+
#
|
14
|
+
# Given that it is always loaded, you are encouraged to keep this file as
|
15
|
+
# light-weight as possible. Requiring heavyweight dependencies from this file
|
16
|
+
# will add to the boot time of your test suite on EVERY test run, even for an
|
17
|
+
# individual file that may not need all of that loaded. Instead, consider making
|
18
|
+
# a separate helper file that requires the additional dependencies and performs
|
19
|
+
# the additional setup, and require it from the spec files that actually need it.
|
20
|
+
#
|
21
|
+
# The `.rspec` file also contains a few flags that are not defaults but that
|
22
|
+
# users commonly want.
|
23
|
+
#
|
24
|
+
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
25
|
+
RSpec.configure do |config|
|
26
|
+
# rspec-expectations config goes here. You can use an alternate
|
27
|
+
# assertion/expectation library such as wrong or the stdlib/minitest
|
28
|
+
# assertions if you prefer.
|
29
|
+
config.expect_with :rspec do |expectations|
|
30
|
+
# This option will default to `true` in RSpec 4. It makes the `description`
|
31
|
+
# and `failure_message` of custom matchers include text for helper methods
|
32
|
+
# defined using `chain`, e.g.:
|
33
|
+
# be_bigger_than(2).and_smaller_than(4).description
|
34
|
+
# # => "be bigger than 2 and smaller than 4"
|
35
|
+
# ...rather than:
|
36
|
+
# # => "be bigger than 2"
|
37
|
+
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
38
|
+
end
|
39
|
+
|
40
|
+
# rspec-mocks config goes here. You can use an alternate test double
|
41
|
+
# library (such as bogus or mocha) by changing the `mock_with` option here.
|
42
|
+
config.mock_with :rspec do |mocks|
|
43
|
+
# Prevents you from mocking or stubbing a method that does not exist on
|
44
|
+
# a real object. This is generally recommended, and will default to
|
45
|
+
# `true` in RSpec 4.
|
46
|
+
mocks.verify_partial_doubles = true
|
47
|
+
end
|
48
|
+
|
49
|
+
config.filter_run :focus
|
50
|
+
config.run_all_when_everything_filtered = true
|
51
|
+
|
52
|
+
# Limits the available syntax to the non-monkey patched syntax that is recommended.
|
53
|
+
# For more details, see:
|
54
|
+
# - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
|
55
|
+
# - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
|
56
|
+
# - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching
|
57
|
+
config.disable_monkey_patching!
|
58
|
+
|
59
|
+
# This setting enables warnings. It's recommended, but in some cases may
|
60
|
+
# be too noisy due to issues in dependencies.
|
61
|
+
config.warnings = true
|
62
|
+
|
63
|
+
# Many RSpec users commonly either run the entire suite or an individual
|
64
|
+
# file, and it's useful to allow more verbose output when running an
|
65
|
+
# individual spec file.
|
66
|
+
if config.files_to_run.one?
|
67
|
+
# Use the documentation formatter for detailed output,
|
68
|
+
# unless a formatter has already been configured
|
69
|
+
# (e.g. via a command-line flag).
|
70
|
+
config.default_formatter = 'doc'
|
71
|
+
end
|
72
|
+
|
73
|
+
# Print the 10 slowest examples and example groups at the
|
74
|
+
# end of the spec run, to help surface which specs are running
|
75
|
+
# particularly slow.
|
76
|
+
config.profile_examples = 10
|
77
|
+
|
78
|
+
# Run specs in random order to surface order dependencies. If you find an
|
79
|
+
# order dependency and want to debug it, you can fix the order by providing
|
80
|
+
# the seed, which is printed after each run.
|
81
|
+
# --seed 1234
|
82
|
+
config.order = :random
|
83
|
+
|
84
|
+
# Seed global randomization in this process using the `--seed` CLI option.
|
85
|
+
# Setting this allows you to use `--seed` to deterministically reproduce
|
86
|
+
# test failures related to randomization by passing the same `--seed` value
|
87
|
+
# as the one that triggered the failure.
|
88
|
+
Kernel.srand config.seed
|
89
|
+
|
90
|
+
config.include FactoryGirl::Syntax::Methods
|
91
|
+
FactoryGirl.find_definitions
|
92
|
+
end
|
metadata
ADDED
@@ -0,0 +1,153 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: jani-from_json
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Ohno Shin'ichi
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-11-07 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: json
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.7'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.7'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '10.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '10.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec-collection_matchers
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: factory_girl
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
description: Convert JSON data into jani structured movie object.
|
98
|
+
email:
|
99
|
+
- ohno@cookpad.com
|
100
|
+
executables: []
|
101
|
+
extensions: []
|
102
|
+
extra_rdoc_files: []
|
103
|
+
files:
|
104
|
+
- ".gitignore"
|
105
|
+
- ".rspec"
|
106
|
+
- ".ruby-version"
|
107
|
+
- ".travis.yml"
|
108
|
+
- Gemfile
|
109
|
+
- Guardfile
|
110
|
+
- LICENSE.txt
|
111
|
+
- README.md
|
112
|
+
- Rakefile
|
113
|
+
- jani-from_json.gemspec
|
114
|
+
- lib/jani/from_json.rb
|
115
|
+
- lib/jani/from_json/banner.rb
|
116
|
+
- lib/jani/from_json/builder.rb
|
117
|
+
- lib/jani/from_json/movie.rb
|
118
|
+
- lib/jani/from_json/strip.rb
|
119
|
+
- lib/jani/from_json/tracking_event.rb
|
120
|
+
- lib/jani/from_json/version.rb
|
121
|
+
- spec/factories/builders.rb
|
122
|
+
- spec/jani/from_json/builder_spec.rb
|
123
|
+
- spec/jani/from_json/from_json_spec.rb
|
124
|
+
- spec/spec_helper.rb
|
125
|
+
homepage: ''
|
126
|
+
licenses:
|
127
|
+
- MIT
|
128
|
+
metadata: {}
|
129
|
+
post_install_message:
|
130
|
+
rdoc_options: []
|
131
|
+
require_paths:
|
132
|
+
- lib
|
133
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
134
|
+
requirements:
|
135
|
+
- - ">="
|
136
|
+
- !ruby/object:Gem::Version
|
137
|
+
version: '0'
|
138
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
139
|
+
requirements:
|
140
|
+
- - ">="
|
141
|
+
- !ruby/object:Gem::Version
|
142
|
+
version: '0'
|
143
|
+
requirements: []
|
144
|
+
rubyforge_project:
|
145
|
+
rubygems_version: 2.4.2
|
146
|
+
signing_key:
|
147
|
+
specification_version: 4
|
148
|
+
summary: Convert JSON data into jani structured movie object.
|
149
|
+
test_files:
|
150
|
+
- spec/factories/builders.rb
|
151
|
+
- spec/jani/from_json/builder_spec.rb
|
152
|
+
- spec/jani/from_json/from_json_spec.rb
|
153
|
+
- spec/spec_helper.rb
|