frenchy 0.0.9 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rspec +3 -0
- data/.travis.yml +4 -0
- data/Guardfile +6 -0
- data/README.md +13 -11
- data/Rakefile +7 -0
- data/frenchie.gemspec +6 -5
- data/lib/frenchy.rb +8 -13
- data/lib/frenchy/client.rb +74 -46
- data/lib/frenchy/collection.rb +1 -1
- data/lib/frenchy/core_ext.rb +34 -0
- data/lib/frenchy/error.rb +31 -0
- data/lib/frenchy/instrumentation.rb +45 -41
- data/lib/frenchy/model.rb +71 -44
- data/lib/frenchy/request.rb +20 -11
- data/lib/frenchy/resource.rb +36 -33
- data/lib/frenchy/veneer.rb +24 -20
- data/lib/frenchy/version.rb +1 -1
- data/spec/lib/frenchy/client_spec.rb +63 -0
- data/spec/lib/frenchy/collection_spec.rb +38 -0
- data/spec/lib/frenchy/core_ext_spec.rb +42 -0
- data/spec/lib/frenchy/error_spec.rb +69 -0
- data/spec/lib/frenchy/model_spec.rb +213 -0
- data/spec/lib/frenchy/request_spec.rb +22 -0
- data/spec/lib/frenchy/resource_spec.rb +105 -0
- data/spec/lib/frenchy/veneer_spec.rb +19 -0
- data/spec/lib/frenchy_spec.rb +18 -0
- data/spec/spec_helper.rb +21 -0
- metadata +62 -23
@@ -0,0 +1,19 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
class FakeModel
|
4
|
+
include Frenchy::Veneer
|
5
|
+
|
6
|
+
veneer model: "real_model"
|
7
|
+
end
|
8
|
+
|
9
|
+
describe Frenchy::Veneer do
|
10
|
+
describe ".model_name" do
|
11
|
+
it "returns an instance of ActiveModel::Name" do
|
12
|
+
expect(FakeModel.model_name).to be_an_instance_of(ActiveModel::Name)
|
13
|
+
end
|
14
|
+
|
15
|
+
it "provides the expected model name" do
|
16
|
+
expect(FakeModel.model_name.to_s).to eql("RealModel")
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Frenchy do
|
4
|
+
describe ".register_service" do
|
5
|
+
it "registers the service in the module" do
|
6
|
+
Frenchy.register_service("github", {"host" => "https://api.github.com"})
|
7
|
+
client = Frenchy.find_service("github")
|
8
|
+
expect(client).to be_an_instance_of(Frenchy::Client)
|
9
|
+
expect(client.host).to eql("https://api.github.com")
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
describe ".find_service" do
|
14
|
+
it "raises an error for missing services" do
|
15
|
+
expect{Frenchy.find_service("nonexistent")}.to raise_error(Frenchy::Error)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
if ENV["CI"]
|
2
|
+
require "coveralls"
|
3
|
+
Coveralls.wear!
|
4
|
+
else
|
5
|
+
require "simplecov"
|
6
|
+
SimpleCov.start
|
7
|
+
end
|
8
|
+
|
9
|
+
require "frenchy"
|
10
|
+
|
11
|
+
RSpec.configure do |config|
|
12
|
+
config.expect_with :rspec do |expectations|
|
13
|
+
# This option will default to `true` in RSpec 4.
|
14
|
+
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
15
|
+
end
|
16
|
+
|
17
|
+
config.mock_with :rspec do |mocks|
|
18
|
+
# This option will default to `true` in RSpec 4.
|
19
|
+
mocks.verify_partial_doubles = true
|
20
|
+
end
|
21
|
+
end
|
metadata
CHANGED
@@ -1,17 +1,17 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: frenchy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jason Coene
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-09-
|
11
|
+
date: 2014-09-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: json
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
@@ -25,13 +25,27 @@ dependencies:
|
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.3'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.3'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: guard-rspec
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
30
44
|
requirements:
|
31
45
|
- - ">="
|
32
46
|
- !ruby/object:Gem::Version
|
33
47
|
version: '0'
|
34
|
-
type: :
|
48
|
+
type: :development
|
35
49
|
prerelease: false
|
36
50
|
version_requirements: !ruby/object:Gem::Requirement
|
37
51
|
requirements:
|
@@ -39,13 +53,13 @@ dependencies:
|
|
39
53
|
- !ruby/object:Gem::Version
|
40
54
|
version: '0'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
56
|
+
name: rake
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
44
58
|
requirements:
|
45
59
|
- - ">="
|
46
60
|
- !ruby/object:Gem::Version
|
47
61
|
version: '0'
|
48
|
-
type: :
|
62
|
+
type: :development
|
49
63
|
prerelease: false
|
50
64
|
version_requirements: !ruby/object:Gem::Requirement
|
51
65
|
requirements:
|
@@ -53,13 +67,13 @@ dependencies:
|
|
53
67
|
- !ruby/object:Gem::Version
|
54
68
|
version: '0'
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
70
|
+
name: rspec
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
58
72
|
requirements:
|
59
73
|
- - ">="
|
60
74
|
- !ruby/object:Gem::Version
|
61
75
|
version: '0'
|
62
|
-
type: :
|
76
|
+
type: :development
|
63
77
|
prerelease: false
|
64
78
|
version_requirements: !ruby/object:Gem::Requirement
|
65
79
|
requirements:
|
@@ -67,48 +81,48 @@ dependencies:
|
|
67
81
|
- !ruby/object:Gem::Version
|
68
82
|
version: '0'
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
84
|
+
name: coveralls
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
72
86
|
requirements:
|
73
|
-
- - "
|
87
|
+
- - ">="
|
74
88
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
89
|
+
version: '0'
|
76
90
|
type: :development
|
77
91
|
prerelease: false
|
78
92
|
version_requirements: !ruby/object:Gem::Requirement
|
79
93
|
requirements:
|
80
|
-
- - "
|
94
|
+
- - ">="
|
81
95
|
- !ruby/object:Gem::Version
|
82
|
-
version: '
|
96
|
+
version: '0'
|
83
97
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
98
|
+
name: activesupport
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|
86
100
|
requirements:
|
87
101
|
- - ">="
|
88
102
|
- !ruby/object:Gem::Version
|
89
|
-
version: '0'
|
103
|
+
version: '3.0'
|
90
104
|
type: :development
|
91
105
|
prerelease: false
|
92
106
|
version_requirements: !ruby/object:Gem::Requirement
|
93
107
|
requirements:
|
94
108
|
- - ">="
|
95
109
|
- !ruby/object:Gem::Version
|
96
|
-
version: '0'
|
110
|
+
version: '3.0'
|
97
111
|
- !ruby/object:Gem::Dependency
|
98
|
-
name:
|
112
|
+
name: activemodel
|
99
113
|
requirement: !ruby/object:Gem::Requirement
|
100
114
|
requirements:
|
101
115
|
- - ">="
|
102
116
|
- !ruby/object:Gem::Version
|
103
|
-
version: '0'
|
117
|
+
version: '3.0'
|
104
118
|
type: :development
|
105
119
|
prerelease: false
|
106
120
|
version_requirements: !ruby/object:Gem::Requirement
|
107
121
|
requirements:
|
108
122
|
- - ">="
|
109
123
|
- !ruby/object:Gem::Version
|
110
|
-
version: '0'
|
111
|
-
description:
|
124
|
+
version: '3.0'
|
125
|
+
description: Opinionated JSON API modeling framework for Ruby.
|
112
126
|
email:
|
113
127
|
- jcoene@gmail.com
|
114
128
|
executables: []
|
@@ -116,7 +130,10 @@ extensions: []
|
|
116
130
|
extra_rdoc_files: []
|
117
131
|
files:
|
118
132
|
- ".gitignore"
|
133
|
+
- ".rspec"
|
134
|
+
- ".travis.yml"
|
119
135
|
- Gemfile
|
136
|
+
- Guardfile
|
120
137
|
- LICENSE.txt
|
121
138
|
- README.md
|
122
139
|
- Rakefile
|
@@ -124,12 +141,24 @@ files:
|
|
124
141
|
- lib/frenchy.rb
|
125
142
|
- lib/frenchy/client.rb
|
126
143
|
- lib/frenchy/collection.rb
|
144
|
+
- lib/frenchy/core_ext.rb
|
145
|
+
- lib/frenchy/error.rb
|
127
146
|
- lib/frenchy/instrumentation.rb
|
128
147
|
- lib/frenchy/model.rb
|
129
148
|
- lib/frenchy/request.rb
|
130
149
|
- lib/frenchy/resource.rb
|
131
150
|
- lib/frenchy/veneer.rb
|
132
151
|
- lib/frenchy/version.rb
|
152
|
+
- spec/lib/frenchy/client_spec.rb
|
153
|
+
- spec/lib/frenchy/collection_spec.rb
|
154
|
+
- spec/lib/frenchy/core_ext_spec.rb
|
155
|
+
- spec/lib/frenchy/error_spec.rb
|
156
|
+
- spec/lib/frenchy/model_spec.rb
|
157
|
+
- spec/lib/frenchy/request_spec.rb
|
158
|
+
- spec/lib/frenchy/resource_spec.rb
|
159
|
+
- spec/lib/frenchy/veneer_spec.rb
|
160
|
+
- spec/lib/frenchy_spec.rb
|
161
|
+
- spec/spec_helper.rb
|
133
162
|
homepage: https://github.com/jcoene/frenchy
|
134
163
|
licenses:
|
135
164
|
- MIT
|
@@ -153,5 +182,15 @@ rubyforge_project:
|
|
153
182
|
rubygems_version: 2.2.2
|
154
183
|
signing_key:
|
155
184
|
specification_version: 4
|
156
|
-
summary:
|
157
|
-
test_files:
|
185
|
+
summary: Opinionated JSON API modeling framework for Ruby.
|
186
|
+
test_files:
|
187
|
+
- spec/lib/frenchy/client_spec.rb
|
188
|
+
- spec/lib/frenchy/collection_spec.rb
|
189
|
+
- spec/lib/frenchy/core_ext_spec.rb
|
190
|
+
- spec/lib/frenchy/error_spec.rb
|
191
|
+
- spec/lib/frenchy/model_spec.rb
|
192
|
+
- spec/lib/frenchy/request_spec.rb
|
193
|
+
- spec/lib/frenchy/resource_spec.rb
|
194
|
+
- spec/lib/frenchy/veneer_spec.rb
|
195
|
+
- spec/lib/frenchy_spec.rb
|
196
|
+
- spec/spec_helper.rb
|