loquor 0.5.1 → 0.5.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +13 -5
- data/CHANGELOG.md +2 -2
- data/lib/loquor/resource_mock.rb +17 -0
- data/lib/loquor/version.rb +1 -1
- data/loquor.gemspec +1 -1
- data/test/resource_mock_test.rb +27 -0
- metadata +15 -13
checksums.yaml
CHANGED
@@ -1,7 +1,15 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
Y2Y3MTI0MTIxNjBkZTlkZjI4ZTJlNGVkN2YzZTg2YzdjZGZjYjk1Yw==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
M2JiMDM3YzI4ZDE4YWQzOGJiNTg2NGI1MjBiMDQxMjlkOWNjOGNiNQ==
|
5
7
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
NjMyNTdkZDc2YjU3Mjc2NDRiZmE5YTIwNWRjZTgzMzMzMWJiZTdmZTYxMWU3
|
10
|
+
NTdlMDRkMzI0OWIxNjhmNGVhNzYzZTg2M2I3ZDQxODhmNmEyMTZmNmQ4ZjM0
|
11
|
+
MDgyM2Q4MWI0MGQ4NjQ3NzZhMmFkZDM5Nzg1YmZmMWU3NzUzYjc=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
NzI2ZWI3MjcwMGZiZjAwMGJkZTkwZTYzODg3MWYxZjI5NjYxMDAzNmUwYTUz
|
14
|
+
ZTNmZmNmM2ViMTAyODE4OWNkZmQ3YjNhZjg1OTQwOGU1OGIxNzdiYWJmYzM2
|
15
|
+
ZmY4MDJlZjExMjdjMWJhZTg3NDcyM2RiNzA3MzkyZDVmZmM1M2Q=
|
data/CHANGELOG.md
CHANGED
data/lib/loquor/resource_mock.rb
CHANGED
@@ -1,6 +1,23 @@
|
|
1
1
|
module Loquor
|
2
2
|
module ResourceMock
|
3
3
|
|
4
|
+
def self.extended(x)
|
5
|
+
x.class_eval do
|
6
|
+
def method_missing(name, *args)
|
7
|
+
if name[-1] == "="
|
8
|
+
if self.class.attributes.keys.map{ |k| :"#{k}=" }.include?(name)
|
9
|
+
attr = name.to_s[0..-2].to_sym
|
10
|
+
@data[attr] = args[0]
|
11
|
+
else
|
12
|
+
raise NameError.new("undefined local variable or method '#{name}' for Resource Mock")
|
13
|
+
end
|
14
|
+
else
|
15
|
+
super(name, *args)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
4
21
|
def attributes
|
5
22
|
@attributes
|
6
23
|
end
|
data/lib/loquor/version.rb
CHANGED
data/loquor.gemspec
CHANGED
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
-
spec.add_dependency 'filum', '
|
21
|
+
spec.add_dependency 'filum', '~> 1.0'
|
22
22
|
spec.add_dependency 'rest-client', '1.6.7'
|
23
23
|
spec.add_dependency "api-auth", "1.0.3"
|
24
24
|
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require File.expand_path('../test_helper', __FILE__)
|
2
|
+
|
3
|
+
module Loquor
|
4
|
+
class ResourceMockTest < Minitest::Test
|
5
|
+
class Foobar < Resource
|
6
|
+
extend ResourceMock
|
7
|
+
self.attributes = {
|
8
|
+
name: "Foobar"
|
9
|
+
}
|
10
|
+
end
|
11
|
+
|
12
|
+
def test_should_be_able_to_set_allowed_attributes
|
13
|
+
name = "Cat"
|
14
|
+
foobar = Foobar.find(1)
|
15
|
+
foobar.name = name
|
16
|
+
assert_equal name, foobar.name
|
17
|
+
end
|
18
|
+
|
19
|
+
def test_should_not_be_able_to_set_arbitary_attributes
|
20
|
+
foobar = Foobar.find(1)
|
21
|
+
assert_raises(NameError) do
|
22
|
+
foobar.description = "Cat"
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: loquor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeremy Walker
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-12-
|
11
|
+
date: 2013-12-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: filum
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ~>
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: '1.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
|
-
version:
|
26
|
+
version: '1.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rest-client
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -84,28 +84,28 @@ dependencies:
|
|
84
84
|
name: mocha
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - '>='
|
87
|
+
- - ! '>='
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '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: '0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: rake
|
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
|
description: An API dispatcher for Meducation
|
@@ -151,6 +151,7 @@ files:
|
|
151
151
|
- test/http_actions/put_test.rb
|
152
152
|
- test/loquor_test.rb
|
153
153
|
- test/object_hash_test.rb
|
154
|
+
- test/resource_mock_test.rb
|
154
155
|
- test/resource_test.rb
|
155
156
|
- test/test_helper.rb
|
156
157
|
homepage: https://www.meducation.net
|
@@ -163,17 +164,17 @@ require_paths:
|
|
163
164
|
- lib
|
164
165
|
required_ruby_version: !ruby/object:Gem::Requirement
|
165
166
|
requirements:
|
166
|
-
- - '>='
|
167
|
+
- - ! '>='
|
167
168
|
- !ruby/object:Gem::Version
|
168
169
|
version: '0'
|
169
170
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
170
171
|
requirements:
|
171
|
-
- - '>='
|
172
|
+
- - ! '>='
|
172
173
|
- !ruby/object:Gem::Version
|
173
174
|
version: '0'
|
174
175
|
requirements: []
|
175
176
|
rubyforge_project:
|
176
|
-
rubygems_version: 2.
|
177
|
+
rubygems_version: 2.1.9
|
177
178
|
signing_key:
|
178
179
|
specification_version: 4
|
179
180
|
summary: This library dispatches requests to Meducation
|
@@ -189,5 +190,6 @@ test_files:
|
|
189
190
|
- test/http_actions/put_test.rb
|
190
191
|
- test/loquor_test.rb
|
191
192
|
- test/object_hash_test.rb
|
193
|
+
- test/resource_mock_test.rb
|
192
194
|
- test/resource_test.rb
|
193
195
|
- test/test_helper.rb
|