braque 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a69209964c677b108f1b3984f052d4d0c645e82b
4
- data.tar.gz: 0b7a8bfc21aaabb571f8e2903723b28bfab0b14c
3
+ metadata.gz: a98f34cb71d248a703cb08b321109252638cd0c5
4
+ data.tar.gz: c08a5b5527ffae9cb00e0722919397a78a937036
5
5
  SHA512:
6
- metadata.gz: 381a83fb6ec72a64b056043dec4d30c4294f7e8acb10c0837887c473d5c3ac703aed5f8ec02543abaeb4a11a49f3da69df37c07592d5d3e685d81fb4e6126d1d
7
- data.tar.gz: 15abd9a742c265348c6ecd4d5caa8fd85114927c355d6aaf45e45d729857f937edefda05a57921f9ba87cb23a798783ca4613dc7a06f300852bd92e2f6009f95
6
+ metadata.gz: 4764cb4013926ed115f96ec4b076c3a2bcf461e59106e26fbfe1e5f5cfd3c0c21627ab12805ef2b32fe3dad8d43be286491219085919d7c09839eb349ddaa6fd
7
+ data.tar.gz: 2a96a53a0da8fe227c8d35b20273ac7b9f9f6580c24d91e8aa7627444c307453075f8812f03f3aa25b018f44dfba6668400194a81eb16c0a1410f459bed27858
data/lib/braque/model.rb CHANGED
@@ -44,6 +44,16 @@ module Braque
44
44
 
45
45
  def self.#{collection_method_name}
46
46
  end
47
+
48
+ def self.inherited(subclass)
49
+ subclass.class_eval do
50
+ define_singleton_method subclass.instance_method_name do
51
+ end
52
+
53
+ define_singleton_method subclass.collection_method_name do
54
+ end
55
+ end
56
+ end
47
57
  WRITER
48
58
  end
49
59
 
@@ -1,3 +1,3 @@
1
1
  module Braque
2
- VERSION = '0.1.0'
2
+ VERSION = '0.1.1'
3
3
  end
@@ -24,15 +24,46 @@ RSpec.describe Braque::Model, type: :model do
24
24
  end
25
25
  end
26
26
 
27
- it 'sets the correct api_root and api_token for each class' do
28
- expect(GeologicModel.api_root).to eq 'http://localhost:9292'
29
- expect(GeologicModel.api_token).to eq 'replace-me'
30
- expect(ContinentalDrift.api_root).to eq 'http://localhost:9292'
31
- expect(ContinentalDrift.api_token).to eq 'replace-me'
32
- expect(Convection.api_root).to eq 'http://localhost:9595'
33
- expect(Convection.api_token).to eq 'ok-another-one-to-replace'
34
- expect(SeafloorSpreading.api_root).to eq 'http://localhost:9393'
35
- expect(SeafloorSpreading.api_token).to eq 'do-replace-me-as-well'
27
+ context 'api configuration' do
28
+ it 'sets the correct api_root and api_token for the base class' do
29
+ expect(GeologicModel.api_root).to eq 'http://localhost:9292'
30
+ expect(GeologicModel.api_token).to eq 'replace-me'
31
+ end
32
+ it 'sets the correct api_root and api_token for a subclassed class' do
33
+ expect(ContinentalDrift.api_root).to eq 'http://localhost:9292'
34
+ expect(ContinentalDrift.api_token).to eq 'replace-me'
35
+ end
36
+ it 'sets the correct api_root and api_token for a subclassed class with variable overrides' do
37
+ expect(Convection.api_root).to eq 'http://localhost:9595'
38
+ expect(Convection.api_token).to eq 'ok-another-one-to-replace'
39
+ end
40
+ it 'sets the correct api_root and api_token for a new Braque::Model class' do
41
+ expect(SeafloorSpreading.api_root).to eq 'http://localhost:9393'
42
+ expect(SeafloorSpreading.api_token).to eq 'do-replace-me-as-well'
43
+ end
44
+ end
45
+
46
+ context 'dynamic class methods' do
47
+ it 'sets the correct dynamic class methods for the base class' do
48
+ [:geologic_model, :geologic_models].each do |sym|
49
+ expect(GeologicModel.methods).to include(sym)
50
+ end
51
+ end
52
+ it 'sets the correct dynamic class methods for a subclassed class' do
53
+ [:continental_drift, :continental_drifts].each do |sym|
54
+ expect(ContinentalDrift.methods).to include(sym)
55
+ end
56
+ end
57
+ it 'sets the correct dynamic class methods for a subclassed class with variable overrides' do
58
+ [:convection, :convections].each do |sym|
59
+ expect(Convection.methods).to include(sym)
60
+ end
61
+ end
62
+ it 'sets the correct dynamic class methods for a new Braque::Model class' do
63
+ [:seafloor_spreading, :seafloor_spreadings].each do |sym|
64
+ expect(SeafloorSpreading.methods).to include(sym)
65
+ end
66
+ end
36
67
  end
37
68
  end
38
69
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: braque
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dylan Fareed
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-03 00:00:00.000000000 Z
11
+ date: 2015-08-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: hyperclient
@@ -98,7 +98,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
98
98
  version: '0'
99
99
  requirements: []
100
100
  rubyforge_project:
101
- rubygems_version: 2.4.3
101
+ rubygems_version: 2.2.2
102
102
  signing_key:
103
103
  specification_version: 4
104
104
  summary: Braque provides a simple interface for interacting with Hypermedia API services