opentie-core 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,15 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 298d1f52211842355c14ef75e27bec7627ec4f66
4
- data.tar.gz: a8dcd7773623c4f97d939f3ea607536541ae0bd8
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ ZjA1YTQ1MmMzNTMzNWFjZWYyOTBkYjhmM2IzYzFlNzIwMTZmY2VhZg==
5
+ data.tar.gz: !binary |-
6
+ YzYxZTI5NTE5NzA0OWZkODVhYzE4ZmU4OTdjN2VmNDI5NDZlYjNhZQ==
5
7
  SHA512:
6
- metadata.gz: 0cdc41d9145d8b572fe2aad9ddd48feb14847cf714f58ea56da1c65f48f43eb5398ff8367230f6ae2362353a546c325d27b6826f81cecd58695c686765c4c8a1
7
- data.tar.gz: f006961422cac2c9911e294ce0f543326131be30b32958c8d61b3747e2390e848a907cd69dcdabcb5308c6c8029c477eca9154ff1695a90f696f5ccd6e233d19
8
+ metadata.gz: !binary |-
9
+ ZDNhMjE4MDQ1MjMyMDJkMWI1MTJmZTE5NGIxM2I4N2U3NWMzNzk2ZGExYjNi
10
+ MTk3MjI1MDNhY2E5YWQ0NzIwNDRkNzVlMjhiOTE2NWEwMzBhZGFkOThjMDU1
11
+ NGJiNjhhZjEzZTQzYzIyMTEzZWIyYWJiMmFiMTM1MmQ4YmVmY2M=
12
+ data.tar.gz: !binary |-
13
+ ZWZiZTM4N2U4ZmQyNTY0MTUzNDhlYWVhYTZlZDNkMDcwYzcxZjE5YjJkOTli
14
+ Zjk3NmJkYjdjNDRjY2QxZmNhMGY2YTg4NWE0MzI5YmZjMDNiMGM2ZDBmOTNi
15
+ MTIzZDBkYWI4NTY1M2ZlZTZhYzE4OWJiODA5OWFhOTdhYmNiNzM=
data/.travis.yml CHANGED
@@ -2,5 +2,11 @@ language: ruby
2
2
  install: bundle install
3
3
  cache:
4
4
  directories: vendor/bundle
5
+ services:
6
+ - mongodb
5
7
  script:
6
- - "bundle exec rspec"
8
+ - bundle exec rspec
9
+ deploy:
10
+ provider: rubygems
11
+ api_key:
12
+ secure: en9qumDRaMUYYjixHQX6nJjRKe8J7C3RLn5gvFwZECV1viuPy2Fk7dOTSjcDYZciDqFCi+mnjmwOvqP+KE0gSgKnVvCsh8MfBlhwWLjIVESEUWCNHeDVbnk+e7RySTuiCQvmnXZkJZe2AJvwVX5zOdPu4ouk8hcmkXITGn3fXuI=
@@ -1,4 +1,4 @@
1
1
  module Opentie::Core
2
- class Persona
2
+ module Persona
3
3
  end
4
4
  end
@@ -3,9 +3,19 @@ require_relative 'request'
3
3
  module Opentie::Core
4
4
  module Project
5
5
  extend ActiveSupport::Concern
6
+
7
+ module ClassMethods
8
+ def request_is(req)
9
+ @request = req
10
+ end
11
+
12
+ def request_class
13
+ @request
14
+ end
15
+ end
6
16
 
7
17
  def available_requests
8
- Opentie::Core::Request.all_request_types.select do |req|
18
+ self.class.request_class.all_request_types.select do |req|
9
19
  req.available? self
10
20
  end
11
21
  end
@@ -4,7 +4,7 @@ module Opentie
4
4
  module Core
5
5
  module Request
6
6
  extend ActiveSupport::Concern
7
-
7
+
8
8
  included do
9
9
  # list of all requests / applications
10
10
  @all_kinds = []
@@ -36,6 +36,7 @@ module Opentie
36
36
  def inherited(subclass)
37
37
  @all_kinds << subclass
38
38
  end
39
+
39
40
  def all_request_types
40
41
  @all_kinds
41
42
  end
@@ -1,5 +1,5 @@
1
1
  module Opentie
2
2
  module Core
3
- VERSION = "0.0.6"
3
+ VERSION = "0.0.7"
4
4
  end
5
5
  end
data/spec/project_spec.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # coding: utf-8
2
2
  require_relative 'spec_helper'
3
-
3
+ require 'rspec'
4
4
  RSpec.describe Opentie::Core::Project, :type => :model do
5
5
  describe "FakeProject" do
6
6
  subject(:pr) { FakeProject.new }
@@ -8,5 +8,16 @@ RSpec.describe Opentie::Core::Project, :type => :model do
8
8
  it 'can create instance' do
9
9
  expect(pr).to be_an_instance_of FakeProject
10
10
  end
11
+
12
+ it 'should return available requests' do
13
+ allow(Time).to receive(:now).and_return(Time.local(2015, 5, 4, 10))
14
+ expect(pr.available_requests).to match_array([TestRequest, AnotherTestRequest])
15
+
16
+ allow(Time).to receive(:now).and_return(Time.local(2015, 4, 4, 10))
17
+ expect(pr.available_requests).to match_array([TestRequest])
18
+
19
+ allow(Time).to receive(:now).and_return(Time.local(2015, 5, 8, 10))
20
+ expect(pr.available_requests).to match_array([AnotherTestRequest])
21
+ end
11
22
  end
12
23
  end
data/spec/spec_helper.rb CHANGED
@@ -21,27 +21,6 @@ class FakeBureau < FakeGroup
21
21
  include Opentie::Core::Bureau
22
22
  end
23
23
 
24
- class FakeProject < FakeGroup
25
- include Opentie::Core::Project
26
-
27
- yes_no "is_ok", "よいか",
28
- yes: "よい",
29
- no: "わるい"
30
-
31
- radio "hoge", "ほげフィールド",
32
- description: "",
33
- values: {
34
- foo: "ふー",
35
- bar: "ばー",
36
- baz: "ばず"
37
- }
38
-
39
- textarea "text", "書け",
40
- description: "オイ 書け オラ"
41
-
42
- has_many :requests, class_name: 'FakeRequest', inverse_of: :project
43
- end
44
-
45
24
  class FakeRequest
46
25
  include Mongoid::Document
47
26
  include Mongoid::Enum
@@ -53,7 +32,7 @@ end
53
32
 
54
33
  class TestRequest < FakeRequest
55
34
  subject "test request"
56
- application_period (Time.local 2015, 4, 1, 10)..(Time.local 2015, 5, 1, 10)
35
+ application_period (Time.local 2015, 4, 1, 10)..(Time.local 2015, 5, 5, 10)
57
36
  optional false
58
37
  in_charge_of :soumu
59
38
  end
@@ -67,3 +46,26 @@ class AnotherTestRequest < FakeRequest
67
46
  field :another_fake_number, type: Integer
68
47
  field :another_fake_hash, type: Hash
69
48
  end
49
+
50
+ class FakeProject < FakeGroup
51
+ include Opentie::Core::Project
52
+
53
+ request_is FakeRequest
54
+
55
+ yes_no "is_ok", "よいか",
56
+ yes: "よい",
57
+ no: "わるい"
58
+
59
+ radio "hoge", "ほげフィールド",
60
+ description: "",
61
+ values: {
62
+ foo: "ふー",
63
+ bar: "ばー",
64
+ baz: "ばず"
65
+ }
66
+
67
+ textarea "text", "書け",
68
+ description: "オイ 書け オラ"
69
+
70
+ has_many :requests, class_name: 'FakeRequest', inverse_of: :project
71
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opentie-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - polamjag
@@ -14,154 +14,154 @@ dependencies:
14
14
  name: activesupport
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - ! '>='
18
18
  - !ruby/object:Gem::Version
19
19
  version: '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
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: mongoid
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - ! '>='
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ">="
38
+ - - ! '>='
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: mongoid-tree
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ">="
45
+ - - ! '>='
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ">="
52
+ - - ! '>='
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: mongoid-enum
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ">="
59
+ - - ! '>='
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ">="
66
+ - - ! '>='
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: bundler
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - "~>"
73
+ - - ~>
74
74
  - !ruby/object:Gem::Version
75
75
  version: '1.7'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - "~>"
80
+ - - ~>
81
81
  - !ruby/object:Gem::Version
82
82
  version: '1.7'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: rake
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - "~>"
87
+ - - ~>
88
88
  - !ruby/object:Gem::Version
89
89
  version: '10.0'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - "~>"
94
+ - - ~>
95
95
  - !ruby/object:Gem::Version
96
96
  version: '10.0'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: rspec
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - ">="
101
+ - - ! '>='
102
102
  - !ruby/object:Gem::Version
103
103
  version: '0'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - ">="
108
+ - - ! '>='
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: guard
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - ">="
115
+ - - ! '>='
116
116
  - !ruby/object:Gem::Version
117
117
  version: '0'
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - ">="
122
+ - - ! '>='
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0'
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: guard-rspec
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
- - - ">="
129
+ - - ! '>='
130
130
  - !ruby/object:Gem::Version
131
131
  version: '0'
132
132
  type: :development
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
- - - ">="
136
+ - - ! '>='
137
137
  - !ruby/object:Gem::Version
138
138
  version: '0'
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: factory_girl
141
141
  requirement: !ruby/object:Gem::Requirement
142
142
  requirements:
143
- - - ">="
143
+ - - ! '>='
144
144
  - !ruby/object:Gem::Version
145
145
  version: '0'
146
146
  type: :development
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
- - - ">="
150
+ - - ! '>='
151
151
  - !ruby/object:Gem::Version
152
152
  version: '0'
153
153
  - !ruby/object:Gem::Dependency
154
154
  name: database_cleaner
155
155
  requirement: !ruby/object:Gem::Requirement
156
156
  requirements:
157
- - - ">="
157
+ - - ! '>='
158
158
  - !ruby/object:Gem::Version
159
159
  version: '0'
160
160
  type: :development
161
161
  prerelease: false
162
162
  version_requirements: !ruby/object:Gem::Requirement
163
163
  requirements:
164
- - - ">="
164
+ - - ! '>='
165
165
  - !ruby/object:Gem::Version
166
166
  version: '0'
167
167
  description:
@@ -171,8 +171,8 @@ executables: []
171
171
  extensions: []
172
172
  extra_rdoc_files: []
173
173
  files:
174
- - ".gitignore"
175
- - ".travis.yml"
174
+ - .gitignore
175
+ - .travis.yml
176
176
  - Gemfile
177
177
  - Guardfile
178
178
  - LICENSE
@@ -205,12 +205,12 @@ require_paths:
205
205
  - lib
206
206
  required_ruby_version: !ruby/object:Gem::Requirement
207
207
  requirements:
208
- - - ">="
208
+ - - ! '>='
209
209
  - !ruby/object:Gem::Version
210
210
  version: '0'
211
211
  required_rubygems_version: !ruby/object:Gem::Requirement
212
212
  requirements:
213
- - - ">="
213
+ - - ! '>='
214
214
  - !ruby/object:Gem::Version
215
215
  version: '0'
216
216
  requirements: []
@@ -225,4 +225,3 @@ test_files:
225
225
  - spec/project_spec.rb
226
226
  - spec/request_spec.rb
227
227
  - spec/spec_helper.rb
228
- has_rdoc: