alephant-preview 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 26a32900c55bb2643938552eb8b87471842d679c
4
- data.tar.gz: a89909666fce0c35da89d52b500684b771a47dd1
3
+ metadata.gz: 78b56936f9da81875bcd551feba3fda79ef53d5a
4
+ data.tar.gz: e9064caba88ad1249cc16e69ddb417ba9f4af350
5
5
  SHA512:
6
- metadata.gz: 8a516b733aaa96b428a04cd7f1f13a1b9ce9234c998f339bdf7d81648a533b76858094a94e757fafc5136262aa67fe584de3847f00acadbb9c7b739a8a83a3f6
7
- data.tar.gz: f7a133fe951e7e4235d279f8d30aae7515929017b7148830b4fda591e641d68ca5336ff5180fa0acca78a1fab8cbf21db0d795851d2398deec5d158eef8b2156
6
+ metadata.gz: 328ed2f347aaae17fc0d39dd934ed6350a63e71cc4b7ec722c3b85d7c74c638fe21dc86d6c042b345a43378bbc50b0f04742b057ec705ff1a3ac1574846ac0eb
7
+ data.tar.gz: e731769a904afa44950d36ce29792b10a77a6b27c38761fa437b59b0d4e9075b57c4505446f56d88a4e9c90a91faec46d1b4fbb82ef17e053a067925151d2474
@@ -1 +1 @@
1
- jruby-1.7.9
1
+ jruby-1.7
@@ -4,6 +4,7 @@ rvm:
4
4
  notifications:
5
5
  email:
6
6
  recipients:
7
- - kenoir@gmail.com
7
+ - stevenmajack@gmail.com
8
+ - mark.mxdc@gmail.com
8
9
  on_failure: change
9
10
  on_success: never
data/Guardfile CHANGED
@@ -1,6 +1,10 @@
1
- guard 'rspec' do
1
+ guard 'rake', :task => 'spec' do
2
2
  watch(%r{^spec/.+_spec\.rb$})
3
3
  watch(%r{^lib/.+\.rb$})
4
- watch(%r{^spec/support/(.+)\.rb$}) { "spec" }
5
- watch('spec/spec_helper.rb') { "spec" }
4
+ watch('spec/spec_helper.rb')
5
+ watch('spec/fixtures/.+$')
6
+ end
7
+
8
+ guard 'rake', :task => 'integration' do
9
+ watch(%r{^spec/integration/.+_spec\.rb$})
6
10
  end
data/README.md CHANGED
@@ -35,6 +35,23 @@ Provide a view in a folder:
35
35
  └── foo.mustache
36
36
  ```
37
37
 
38
+ ### Data mappers
39
+
40
+ If you application uses data mappers and they make more than one call, use the following folder structure to provide a fixture for each call:
41
+
42
+ ```
43
+ └── components
44
+ └── group_name
45
+ ├── models
46
+ │   └── foo.rb
47
+ ├── fixtures
48
+ │   └── foo_1.json
49
+ │   └── foo_2.json
50
+ │   └── foo_3.json
51
+ └── templates
52
+ └── foo.mustache
53
+ ```
54
+
38
55
  `alephant-preview`
39
56
 
40
57
  The included preview server allows you to see the html generated by your
data/Rakefile CHANGED
@@ -1,9 +1,7 @@
1
1
  $:.unshift File.join(File.dirname(__FILE__), 'lib')
2
2
 
3
3
  require 'rspec/core/rake_task'
4
+ require 'rake/rspec'
4
5
  require 'bundler/gem_tasks'
5
- require 'alephant/preview'
6
6
 
7
- RSpec::Core::RakeTask.new(:spec)
8
-
9
- task :default => :spec
7
+ task :default => :all
@@ -21,10 +21,11 @@ Gem::Specification.new do |spec|
21
21
  spec.add_development_dependency "rspec-nc"
22
22
  spec.add_development_dependency "rack-test"
23
23
  spec.add_development_dependency "guard"
24
- spec.add_development_dependency "guard-rspec"
24
+ spec.add_development_dependency "guard-rake"
25
25
  spec.add_development_dependency "pry"
26
26
  spec.add_development_dependency "bundler"
27
27
  spec.add_development_dependency "rake"
28
+ spec.add_development_dependency "rake-rspec"
28
29
 
29
30
  spec.add_runtime_dependency 'sinatra'
30
31
  spec.add_runtime_dependency 'sinatra-reloader'
@@ -34,4 +35,6 @@ Gem::Specification.new do |spec|
34
35
 
35
36
  spec.add_runtime_dependency 'alephant-support'
36
37
  spec.add_runtime_dependency 'alephant-renderer'
38
+ spec.add_runtime_dependency 'alephant-publisher-request'
39
+
37
40
  end
@@ -0,0 +1,28 @@
1
+ module Alephant
2
+ module Preview
3
+ class FixtureLoader
4
+ attr_reader :base_path, :current_fixture, :fixtures
5
+
6
+ def initialize(base_path)
7
+ @base_path = base_path
8
+ @fixtures = Dir.glob("#{base_path}/fixtures/*")
9
+ end
10
+
11
+ def get(uri)
12
+ OpenStruct.new(
13
+ :status => 200,
14
+ :body => fixture
15
+ )
16
+ end
17
+
18
+ protected
19
+
20
+ def fixture
21
+ path = fixtures.shift
22
+ raise "There isn't a fixture matching the request call, please add one" if path.nil?
23
+ File.open(path).read
24
+ end
25
+
26
+ end
27
+ end
28
+ end
@@ -1,9 +1,12 @@
1
1
  require 'alephant/renderer/views/html'
2
2
  require 'alephant/renderer/views/json'
3
3
  require 'alephant/renderer/view_mapper'
4
+ require 'alephant/publisher/request/data_mapper_factory'
5
+ require 'alephant/publisher/request/data_mapper'
6
+ require 'alephant/publisher/request/error'
4
7
 
5
8
  require 'alephant/support/parser'
6
-
9
+ require 'alephant/preview/fixture_loader'
7
10
  require 'alephant/preview/template/base'
8
11
 
9
12
  require 'sinatra/base'
@@ -19,6 +22,7 @@ module Alephant
19
22
 
20
23
  register Sinatra::Reloader
21
24
  also_reload 'components/*/models/*.rb'
25
+ also_reload 'components/*/mapper.rb'
22
26
 
23
27
  BASE_LOCATION = "#{(ENV['BASE_LOCATION'] || Dir.pwd)}/components"
24
28
 
@@ -89,9 +93,23 @@ module Alephant
89
93
  end
90
94
 
91
95
  def fixture_data
92
- msg = Struct.new(:body)
93
- .new(raw_fixture_data)
94
- parser.parse msg
96
+ if File.exists? "#{base_path}/mapper.rb"
97
+ loader = Alephant::Preview::FixtureLoader.new(base_path)
98
+ data_mapper_factory = Alephant::Publisher::Request::DataMapperFactory.new(loader, BASE_LOCATION)
99
+ begin
100
+ mapper = data_mapper_factory.create(id, {})
101
+ mapper.data
102
+ rescue Alephant::Publisher::Request::InvalidApiResponse
103
+ raise "The JSON passed to the data mapper isn't valid"
104
+ rescue StandardError => e
105
+ puts e.backtrace
106
+ raise "There was an issue with the data mapper class: #{e.message}"
107
+ end
108
+ else
109
+ msg = Struct.new(:body)
110
+ .new(raw_fixture_data)
111
+ parser.parse msg
112
+ end
95
113
  end
96
114
 
97
115
  def raw_fixture_data
@@ -1,5 +1,5 @@
1
1
  module Alephant
2
2
  module Preview
3
- VERSION = "0.2.0"
3
+ VERSION = "0.3.0"
4
4
  end
5
5
  end
@@ -0,0 +1,49 @@
1
+ require 'spec_helper'
2
+
3
+ describe Alephant::Preview::FixtureLoader do
4
+ let (:fixtures_base) { File.join(File.dirname(__FILE__), 'fixtures') }
5
+ let (:base_path) { File.join(fixtures_base, 'components', 'bar') }
6
+ subject { described_class.new(base_path) }
7
+
8
+ describe ".new" do
9
+
10
+ context 'using valid parameters' do
11
+ let (:expected) { described_class }
12
+
13
+ specify { expect(subject).to be_a expected }
14
+ end
15
+ end
16
+
17
+ describe "#get" do
18
+ let (:uri) { '/test/uri' }
19
+
20
+ context 'with a single fixture' do
21
+ let (:fixture_data) { File.open(File.join(fixtures_base, 'components', 'bar', 'fixtures', 'bar.json')).read }
22
+ specify { expect(subject.get(uri).body).to eq fixture_data}
23
+ end
24
+
25
+ context 'with multiple fixtures' do
26
+ let (:base_path) { File.join(fixtures_base, 'components', 'baz') }
27
+ let (:fixture_data) do
28
+ fixtures = Dir.glob(File.join(fixtures_base, 'components', 'baz', 'fixtures', '*'))
29
+ fixtures.map { |fixture| File.open(fixture).read }
30
+ end
31
+
32
+ context 'using a valid amount of fixtures' do
33
+
34
+ it "should return each fixture on subsequent calls" do
35
+ (0..2).each do |index|
36
+ expect(subject.get(uri).body).to eq fixture_data[index]
37
+ end
38
+ end
39
+ end
40
+
41
+ context 'using incorrect amount of fixtures' do
42
+ it "should raise an exception" do
43
+ (0..2).each { |index| subject.get(uri).body }
44
+ expect{ subject.get(uri).body }.to raise_error
45
+ end
46
+ end
47
+ end
48
+ end
49
+ end
@@ -0,0 +1 @@
1
+ { "a" : "data mapped content" }
@@ -0,0 +1,7 @@
1
+ class BarMapper < Alephant::Publisher::Request::DataMapper
2
+ def data
3
+ {
4
+ :bar => 'data mapped content'
5
+ }
6
+ end
7
+ end
@@ -0,0 +1,9 @@
1
+ require 'alephant/renderer/views/html'
2
+
3
+ module MyApp
4
+ class Bar < ::Alephant::Renderer::Views::Html
5
+ def content
6
+ data.bar
7
+ end
8
+ end
9
+ end
@@ -0,0 +1 @@
1
+ { "a" : "multiple endpoint" }
@@ -0,0 +1 @@
1
+ { "b" : "data mapped" }
@@ -0,0 +1 @@
1
+ { "c" : "content" }
@@ -0,0 +1,7 @@
1
+ class BazMapper < Alephant::Publisher::Request::DataMapper
2
+ def data
3
+ (1..3).reduce({}) do |accum, index|
4
+ accum.merge(get("/test/call"))
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,9 @@
1
+ require 'alephant/renderer/views/html'
2
+
3
+ module MyApp
4
+ class Baz < ::Alephant::Renderer::Views::Html
5
+ def content
6
+ "#{data.a} #{data.b} #{data.c}"
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,71 @@
1
+ require 'spec_helper'
2
+
3
+ describe Alephant::Preview::Server do
4
+ include Rack::Test::Methods
5
+ let (:app) { subject }
6
+
7
+ describe 'preview endpoint (GET /preview/{id}/{template}/{region}/{fixture})' do
8
+
9
+ describe 'content' do
10
+
11
+ context 'with valid data' do
12
+ before(:each) do
13
+ get "/preview/#{id}/#{template}/#{region}/#{fixture}"
14
+ end
15
+ let (:id) { 'foo' }
16
+ let (:template) { id }
17
+ let (:fixture) { id }
18
+ let (:region) { 'page_region' }
19
+
20
+ specify { expect(last_response.body).to eq("topcontent\nbottom\n") }
21
+ end
22
+ end
23
+ end
24
+
25
+ describe 'component endpoint (GET /component/{id}/{template}/{fixture})' do
26
+
27
+ describe 'content' do
28
+ before(:each) do
29
+ get "/component/#{id}/#{template}/#{fixture}"
30
+ end
31
+ let (:response) { last_response.body.chomp }
32
+
33
+ context 'without a data mapper' do
34
+ let (:id) { 'foo' }
35
+ let (:template) { id }
36
+ let (:fixture) { id }
37
+
38
+ specify { expect(response).to eq("content") }
39
+ end
40
+
41
+ context 'with a data mapper' do
42
+
43
+ context 'using a single fixture' do
44
+ let (:id) { 'bar' }
45
+ let (:template) { id }
46
+ let (:fixture) { id }
47
+
48
+ specify { expect(response).to eq("data mapped content") }
49
+ end
50
+
51
+ context 'using multiple fixtures' do
52
+ let (:id) { 'baz' }
53
+ let (:template) { id }
54
+ let (:fixture) { id }
55
+
56
+ specify { expect(response).to eq("multiple endpoint data mapped content") }
57
+ end
58
+ end
59
+ end
60
+ end
61
+
62
+ describe "status endpoint (GET /status)" do
63
+ before(:each) do
64
+ get "/status"
65
+ end
66
+
67
+ context "status code" do
68
+ specify { expect(last_response.status).to eq 200 }
69
+ end
70
+ end
71
+ end
metadata CHANGED
@@ -1,226 +1,254 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: alephant-preview
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Kenny
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-13 00:00:00.000000000 Z
11
+ date: 2014-10-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
15
+ version_requirements: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
15
20
  requirement: !ruby/object:Gem::Requirement
16
21
  requirements:
17
22
  - - '>='
18
23
  - !ruby/object:Gem::Version
19
24
  version: '0'
20
- type: :development
21
25
  prerelease: false
26
+ type: :development
27
+ - !ruby/object:Gem::Dependency
28
+ name: rspec-nc
22
29
  version_requirements: !ruby/object:Gem::Requirement
23
30
  requirements:
24
31
  - - '>='
25
32
  - !ruby/object:Gem::Version
26
33
  version: '0'
27
- - !ruby/object:Gem::Dependency
28
- name: rspec-nc
29
34
  requirement: !ruby/object:Gem::Requirement
30
35
  requirements:
31
36
  - - '>='
32
37
  - !ruby/object:Gem::Version
33
38
  version: '0'
34
- type: :development
35
39
  prerelease: false
40
+ type: :development
41
+ - !ruby/object:Gem::Dependency
42
+ name: rack-test
36
43
  version_requirements: !ruby/object:Gem::Requirement
37
44
  requirements:
38
45
  - - '>='
39
46
  - !ruby/object:Gem::Version
40
47
  version: '0'
41
- - !ruby/object:Gem::Dependency
42
- name: rack-test
43
48
  requirement: !ruby/object:Gem::Requirement
44
49
  requirements:
45
50
  - - '>='
46
51
  - !ruby/object:Gem::Version
47
52
  version: '0'
48
- type: :development
49
53
  prerelease: false
54
+ type: :development
55
+ - !ruby/object:Gem::Dependency
56
+ name: guard
50
57
  version_requirements: !ruby/object:Gem::Requirement
51
58
  requirements:
52
59
  - - '>='
53
60
  - !ruby/object:Gem::Version
54
61
  version: '0'
55
- - !ruby/object:Gem::Dependency
56
- name: guard
57
62
  requirement: !ruby/object:Gem::Requirement
58
63
  requirements:
59
64
  - - '>='
60
65
  - !ruby/object:Gem::Version
61
66
  version: '0'
62
- type: :development
63
67
  prerelease: false
68
+ type: :development
69
+ - !ruby/object:Gem::Dependency
70
+ name: guard-rake
64
71
  version_requirements: !ruby/object:Gem::Requirement
65
72
  requirements:
66
73
  - - '>='
67
74
  - !ruby/object:Gem::Version
68
75
  version: '0'
69
- - !ruby/object:Gem::Dependency
70
- name: guard-rspec
71
76
  requirement: !ruby/object:Gem::Requirement
72
77
  requirements:
73
78
  - - '>='
74
79
  - !ruby/object:Gem::Version
75
80
  version: '0'
76
- type: :development
77
81
  prerelease: false
82
+ type: :development
83
+ - !ruby/object:Gem::Dependency
84
+ name: pry
78
85
  version_requirements: !ruby/object:Gem::Requirement
79
86
  requirements:
80
87
  - - '>='
81
88
  - !ruby/object:Gem::Version
82
89
  version: '0'
83
- - !ruby/object:Gem::Dependency
84
- name: pry
85
90
  requirement: !ruby/object:Gem::Requirement
86
91
  requirements:
87
92
  - - '>='
88
93
  - !ruby/object:Gem::Version
89
94
  version: '0'
90
- type: :development
91
95
  prerelease: false
96
+ type: :development
97
+ - !ruby/object:Gem::Dependency
98
+ name: bundler
92
99
  version_requirements: !ruby/object:Gem::Requirement
93
100
  requirements:
94
101
  - - '>='
95
102
  - !ruby/object:Gem::Version
96
103
  version: '0'
97
- - !ruby/object:Gem::Dependency
98
- name: bundler
99
104
  requirement: !ruby/object:Gem::Requirement
100
105
  requirements:
101
106
  - - '>='
102
107
  - !ruby/object:Gem::Version
103
108
  version: '0'
104
- type: :development
105
109
  prerelease: false
110
+ type: :development
111
+ - !ruby/object:Gem::Dependency
112
+ name: rake
106
113
  version_requirements: !ruby/object:Gem::Requirement
107
114
  requirements:
108
115
  - - '>='
109
116
  - !ruby/object:Gem::Version
110
117
  version: '0'
111
- - !ruby/object:Gem::Dependency
112
- name: rake
113
118
  requirement: !ruby/object:Gem::Requirement
114
119
  requirements:
115
120
  - - '>='
116
121
  - !ruby/object:Gem::Version
117
122
  version: '0'
118
- type: :development
119
123
  prerelease: false
124
+ type: :development
125
+ - !ruby/object:Gem::Dependency
126
+ name: rake-rspec
120
127
  version_requirements: !ruby/object:Gem::Requirement
121
128
  requirements:
122
129
  - - '>='
123
130
  - !ruby/object:Gem::Version
124
131
  version: '0'
125
- - !ruby/object:Gem::Dependency
126
- name: sinatra
127
132
  requirement: !ruby/object:Gem::Requirement
128
133
  requirements:
129
134
  - - '>='
130
135
  - !ruby/object:Gem::Version
131
136
  version: '0'
132
- type: :runtime
133
137
  prerelease: false
138
+ type: :development
139
+ - !ruby/object:Gem::Dependency
140
+ name: sinatra
134
141
  version_requirements: !ruby/object:Gem::Requirement
135
142
  requirements:
136
143
  - - '>='
137
144
  - !ruby/object:Gem::Version
138
145
  version: '0'
139
- - !ruby/object:Gem::Dependency
140
- name: sinatra-reloader
141
146
  requirement: !ruby/object:Gem::Requirement
142
147
  requirements:
143
148
  - - '>='
144
149
  - !ruby/object:Gem::Version
145
150
  version: '0'
146
- type: :runtime
147
151
  prerelease: false
152
+ type: :runtime
153
+ - !ruby/object:Gem::Dependency
154
+ name: sinatra-reloader
148
155
  version_requirements: !ruby/object:Gem::Requirement
149
156
  requirements:
150
157
  - - '>='
151
158
  - !ruby/object:Gem::Version
152
159
  version: '0'
153
- - !ruby/object:Gem::Dependency
154
- name: faraday
155
160
  requirement: !ruby/object:Gem::Requirement
156
161
  requirements:
157
162
  - - '>='
158
163
  - !ruby/object:Gem::Version
159
164
  version: '0'
160
- type: :runtime
161
165
  prerelease: false
166
+ type: :runtime
167
+ - !ruby/object:Gem::Dependency
168
+ name: faraday
162
169
  version_requirements: !ruby/object:Gem::Requirement
163
170
  requirements:
164
171
  - - '>='
165
172
  - !ruby/object:Gem::Version
166
173
  version: '0'
167
- - !ruby/object:Gem::Dependency
168
- name: trollop
169
174
  requirement: !ruby/object:Gem::Requirement
170
175
  requirements:
171
176
  - - '>='
172
177
  - !ruby/object:Gem::Version
173
178
  version: '0'
174
- type: :runtime
175
179
  prerelease: false
180
+ type: :runtime
181
+ - !ruby/object:Gem::Dependency
182
+ name: trollop
176
183
  version_requirements: !ruby/object:Gem::Requirement
177
184
  requirements:
178
185
  - - '>='
179
186
  - !ruby/object:Gem::Version
180
187
  version: '0'
181
- - !ruby/object:Gem::Dependency
182
- name: mustache
183
188
  requirement: !ruby/object:Gem::Requirement
184
189
  requirements:
185
190
  - - '>='
186
191
  - !ruby/object:Gem::Version
187
- version: 0.99.5
188
- type: :runtime
192
+ version: '0'
189
193
  prerelease: false
194
+ type: :runtime
195
+ - !ruby/object:Gem::Dependency
196
+ name: mustache
190
197
  version_requirements: !ruby/object:Gem::Requirement
191
198
  requirements:
192
199
  - - '>='
193
200
  - !ruby/object:Gem::Version
194
201
  version: 0.99.5
202
+ requirement: !ruby/object:Gem::Requirement
203
+ requirements:
204
+ - - '>='
205
+ - !ruby/object:Gem::Version
206
+ version: 0.99.5
207
+ prerelease: false
208
+ type: :runtime
195
209
  - !ruby/object:Gem::Dependency
196
210
  name: alephant-support
211
+ version_requirements: !ruby/object:Gem::Requirement
212
+ requirements:
213
+ - - '>='
214
+ - !ruby/object:Gem::Version
215
+ version: '0'
197
216
  requirement: !ruby/object:Gem::Requirement
198
217
  requirements:
199
218
  - - '>='
200
219
  - !ruby/object:Gem::Version
201
220
  version: '0'
202
- type: :runtime
203
221
  prerelease: false
222
+ type: :runtime
223
+ - !ruby/object:Gem::Dependency
224
+ name: alephant-renderer
204
225
  version_requirements: !ruby/object:Gem::Requirement
205
226
  requirements:
206
227
  - - '>='
207
228
  - !ruby/object:Gem::Version
208
229
  version: '0'
209
- - !ruby/object:Gem::Dependency
210
- name: alephant-renderer
211
230
  requirement: !ruby/object:Gem::Requirement
212
231
  requirements:
213
232
  - - '>='
214
233
  - !ruby/object:Gem::Version
215
234
  version: '0'
216
- type: :runtime
217
235
  prerelease: false
236
+ type: :runtime
237
+ - !ruby/object:Gem::Dependency
238
+ name: alephant-publisher-request
218
239
  version_requirements: !ruby/object:Gem::Requirement
219
240
  requirements:
220
241
  - - '>='
221
242
  - !ruby/object:Gem::Version
222
243
  version: '0'
223
- description:
244
+ requirement: !ruby/object:Gem::Requirement
245
+ requirements:
246
+ - - '>='
247
+ - !ruby/object:Gem::Version
248
+ version: '0'
249
+ prerelease: false
250
+ type: :runtime
251
+ description:
224
252
  email:
225
253
  - kenoir@gmail.com
226
254
  executables:
@@ -239,6 +267,7 @@ files:
239
267
  - alephant-preview.gemspec
240
268
  - bin/alephant-preview
241
269
  - lib/alephant/preview.rb
270
+ - lib/alephant/preview/fixture_loader.rb
242
271
  - lib/alephant/preview/server.rb
243
272
  - lib/alephant/preview/tasks.rb
244
273
  - lib/alephant/preview/tasks/preview.rake
@@ -246,18 +275,29 @@ files:
246
275
  - lib/alephant/preview/template/base.rb
247
276
  - lib/alephant/preview/template/updater.rb
248
277
  - lib/alephant/preview/version.rb
278
+ - spec/fixture_loader_spec.rb
279
+ - spec/fixtures/components/bar/fixtures/bar.json
280
+ - spec/fixtures/components/bar/mapper.rb
281
+ - spec/fixtures/components/bar/models/bar.rb
282
+ - spec/fixtures/components/bar/templates/bar.mustache
283
+ - spec/fixtures/components/baz/fixtures/baz_1.json
284
+ - spec/fixtures/components/baz/fixtures/baz_2.json
285
+ - spec/fixtures/components/baz/fixtures/baz_3.json
286
+ - spec/fixtures/components/baz/mapper.rb
287
+ - spec/fixtures/components/baz/models/baz.rb
288
+ - spec/fixtures/components/baz/templates/baz.mustache
249
289
  - spec/fixtures/components/foo/fixtures/foo.json
250
290
  - spec/fixtures/components/foo/models/foo.rb
251
291
  - spec/fixtures/components/foo/templates/.DS_Store
252
292
  - spec/fixtures/components/foo/templates/foo.mustache
253
293
  - spec/fixtures/lib/templates/preview.mustache
254
- - spec/preview_spec.rb
294
+ - spec/integration/preview_spec.rb
255
295
  - spec/spec_helper.rb
256
296
  homepage: ''
257
297
  licenses:
258
298
  - MIT
259
299
  metadata: {}
260
- post_install_message:
300
+ post_install_message:
261
301
  rdoc_options: []
262
302
  require_paths:
263
303
  - lib
@@ -272,16 +312,27 @@ required_rubygems_version: !ruby/object:Gem::Requirement
272
312
  - !ruby/object:Gem::Version
273
313
  version: '0'
274
314
  requirements: []
275
- rubyforge_project:
276
- rubygems_version: 2.2.2
277
- signing_key:
315
+ rubyforge_project:
316
+ rubygems_version: 2.1.9
317
+ signing_key:
278
318
  specification_version: 4
279
319
  summary: Preview component templates
280
320
  test_files:
321
+ - spec/fixture_loader_spec.rb
322
+ - spec/fixtures/components/bar/fixtures/bar.json
323
+ - spec/fixtures/components/bar/mapper.rb
324
+ - spec/fixtures/components/bar/models/bar.rb
325
+ - spec/fixtures/components/bar/templates/bar.mustache
326
+ - spec/fixtures/components/baz/fixtures/baz_1.json
327
+ - spec/fixtures/components/baz/fixtures/baz_2.json
328
+ - spec/fixtures/components/baz/fixtures/baz_3.json
329
+ - spec/fixtures/components/baz/mapper.rb
330
+ - spec/fixtures/components/baz/models/baz.rb
331
+ - spec/fixtures/components/baz/templates/baz.mustache
281
332
  - spec/fixtures/components/foo/fixtures/foo.json
282
333
  - spec/fixtures/components/foo/models/foo.rb
283
334
  - spec/fixtures/components/foo/templates/.DS_Store
284
335
  - spec/fixtures/components/foo/templates/foo.mustache
285
336
  - spec/fixtures/lib/templates/preview.mustache
286
- - spec/preview_spec.rb
337
+ - spec/integration/preview_spec.rb
287
338
  - spec/spec_helper.rb
@@ -1,40 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Alephant::Preview::Server do
4
- include Rack::Test::Methods
5
-
6
- def app
7
- Alephant::Preview::Server
8
- end
9
-
10
- describe '/preview/:id/:template/:region/?:fixture?' do
11
- context 'valid component' do
12
- it "should return the rendered component inside the page region specified" do
13
- get '/preview/foo/foo/page_region/foo'
14
-
15
- expect(last_response).to be_ok
16
- expect(last_response.body).to eq("topcontent\nbottom\n")
17
- end
18
- end
19
- end
20
-
21
- describe '/component/:id/:template/?:fixture?' do
22
- context 'valid component' do
23
- it "should return the rendered component" do
24
- get '/component/foo/foo/foo'
25
-
26
- expect(last_response).to be_ok
27
- expect(last_response.body).to eq("content\n")
28
- end
29
- end
30
- end
31
-
32
- describe '/status' do
33
- it "responds with ok" do
34
- get '/status'
35
-
36
- expect(last_response).to be_ok
37
- expect(last_response.body).to eq('ok')
38
- end
39
- end
40
- end