jekyll-attendease 0.6.25k → 0.6.26a

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,11 +1,10 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  RSpec.describe Jekyll::AttendeasePlugin::SitePage do
4
- before(:all) do
5
- @site_page = find_page(described_class, Proc.new { |p| p.data['site_page']['slug'] == 'test' })
6
- end
4
+ let(:site) { build_site }
5
+ let(:site_page) { find_page(site, described_class, Proc.new { |p| p.data['site_page']['slug'] == 'test' }) }
7
6
 
8
7
  pending 'fills the page zones with the rendered html' do
9
- expect(@site_page.data['dropzone1']).to eq('<h1>Hello world</h1>')
8
+ expect(site_page.data['dropzone1']).to eq('<h1>Hello world</h1>')
10
9
  end
11
10
  end
@@ -1,24 +1,21 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  RSpec.describe Jekyll::AttendeasePlugin::SitePagesGenerator do
4
- before(:all) do
5
- @site_pages_generator = find_generator(described_class)
6
- @index_file = 'index.html'
7
- end
4
+ let (:site) { build_site }
5
+ let (:site_pages_generator) { find_generator(site, described_class) }
6
+ let(:index_file) { 'index.html' }
8
7
 
9
8
  it 'creates a page using the provided slug' do
10
- #require 'pry'
11
- #binding.pry
12
- slug = @site.data['pages'].last['slug']
13
- file = File.join(@site.config['destination'], slug, 'index.html')
9
+ slug = site.data['pages'].last['slug']
10
+ file = File.join(site.config['destination'], slug, 'index.html')
14
11
  expect(File.exists?(file)).to eq(true)
15
12
  expect(File.file?(file)).to eq(true)
16
13
  expect(File.read(file)).to include '<title>Test Page</title>'
17
14
  end
18
15
 
19
16
  it 'creates a block instance json file using the provided slug' do
20
- slug = @site.data['pages'].last['slug']
21
- file = File.join(@site.config['destination'], slug, 'index.json')
17
+ slug = site.data['pages'].last['slug']
18
+ file = File.join(site.config['destination'], slug, 'index.json')
22
19
  expect(File.exists?(file)).to eq(true)
23
20
  expect(File.file?(file)).to eq(true)
24
21
  end
@@ -1,12 +1,21 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  RSpec.describe Jekyll::AttendeasePlugin::SponsorGenerator do
4
+ context 'event site' do
5
+ let (:site) { build_site }
4
6
 
5
- it 'creates the sponsor listing page' do
6
- template_files = Dir.chdir(@template_root) { Dir.glob('*/**.html') }
7
+ it 'creates the sponsor listing page' do
8
+ expect(File.exists?(File.join(site.config['destination'], 'sponsors', 'index.html'))).to eq(true)
9
+ expect(File.read(File.join(site.config['destination'], 'sponsors', 'index.html'))).to include "<h1>Sponsors</h1>"
10
+ end
11
+ end
12
+
13
+ context 'organization site' do
14
+ let (:org_site) { build_org_site }
7
15
 
8
- expect(File.exists?(File.join(@site.config['destination'], 'sponsors', 'index.html'))).to eq(true)
9
- expect(File.read(File.join(@site.config['destination'], 'sponsors', 'index.html'))).to include "<h1>Sponsors</h1>"
16
+ it 'does not create the sponsor listing page' do
17
+ expect(File.exists?(File.join(org_site.config['destination'], 'sponsors', 'index.html'))).to eq(false)
18
+ end
10
19
  end
11
20
 
12
21
  end
@@ -1,7 +1,8 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  RSpec.describe "Jekyll Attendease tags" do
4
- let(:context) { { :registers => { :site => @site, :page => {} } } }
4
+ let(:site) { build_site }
5
+ let(:context) { { :registers => { :site => site, :page => {} } } }
5
6
 
6
7
  def render(content)
7
8
  ::Liquid::Template.parse(content).render({}, context)
@@ -20,7 +21,7 @@ RSpec.describe "Jekyll Attendease tags" do
20
21
  context "{% attendease_locales_script %}" do
21
22
  subject { render("{% attendease_locales_script %}") }
22
23
  it { is_expected.to include "/api/lingo.json" }
23
- it { is_expected.to include @site.config['attendease']['api_host'] }
24
+ it { is_expected.to include site.config['attendease']['api_host'] }
24
25
  end
25
26
 
26
27
  context "{% attendease_t event.lingo.sponsors %}" do
@@ -21,11 +21,22 @@ RSpec.configure do |config|
21
21
  end
22
22
 
23
23
  @template_root = File.expand_path(File.join(File.dirname(__FILE__), '..', 'templates'))
24
- @dest = fixtures_path.join('_site')
25
-
26
24
  FileUtils.touch Dir.glob(File.join(File.dirname(__FILE__), 'fixtures', '_attendease', 'data', '*.*'))
27
- @site = build_site
28
- @page = Jekyll::Page.new(@site, File.join(File.dirname(__FILE__), 'fixtures'), '', 'page.html')
25
+ #let!(:site) { build_site }
26
+ #let!(:org_site) { build_site({ attendease: { mode: 'organization' } }) }
27
+ #let!(:page) { Jekyll::Page.new(@site, File.join(File.dirname(__FILE__), 'fixtures'), '', 'page.html') }
28
+ end
29
+
30
+ def site
31
+ @site
32
+ end
33
+
34
+ def dest
35
+ @dest ||= fixtures_path.join('_site')
36
+ end
37
+
38
+ def page
39
+ Jekyll::Page.new(site, File.join(File.dirname(__FILE__), 'fixtures'), '', 'page.html')
29
40
  end
30
41
 
31
42
  def test_dir(*subdirs)
@@ -44,12 +55,12 @@ RSpec.configure do |config|
44
55
  Jekyll::Utils.deep_merge_hashes(base_hash, overrides)
45
56
  end
46
57
 
47
- def find_generator(generator_class)
48
- @site.generators.select { |m| m.class == generator_class }.first
58
+ def find_generator(site, generator_class)
59
+ site.generators.select { |m| m.class == generator_class }.first
49
60
  end
50
61
 
51
- def find_page(page_class, lambda_matcher = false)
52
- @site.pages.select do |m|
62
+ def find_page(site, page_class, lambda_matcher = false)
63
+ site.pages.select do |m|
53
64
  if m.class == page_class
54
65
  match = true
55
66
  if lambda_matcher
@@ -63,19 +74,9 @@ RSpec.configure do |config|
63
74
  def site_configuration(overrides = {})
64
75
  Jekyll::Utils.deep_merge_hashes(build_configs({
65
76
  'source' => fixtures_path.to_s,
66
- 'destination' => @dest.to_s,
77
+ 'destination' => dest.to_s,
67
78
  'attendease' => {
68
- 'api_host' => 'http://foobar/',
69
- 'test_mode' => false,
70
- 'locale' => 'en',
71
- 'schedule_path_name' => 'schedule',
72
- 'presenters_path_name' => 'presenters',
73
- 'sponsors_path_name' => 'sponsors',
74
- 'venue_path_name' => 'venue',
75
- 'venues_path_name' => 'venues',
76
- 'base_layout' => 'layout',
77
- 'generate_schedule_pages' => true,
78
- 'generate_sponsor_pages' => true,
79
+ 'api_host' => 'https://foobar/',
79
80
  'has_sessions' => true,
80
81
  'has_presenters' => true,
81
82
  'has_sponsors' => true,
@@ -87,19 +88,26 @@ RSpec.configure do |config|
87
88
  end
88
89
 
89
90
  def build_site(config = {})
90
- site = Jekyll::Site.new(site_configuration(config))
91
- site.process
92
- site
91
+ #dest.rmtree if dest.exist?
92
+ @site = Jekyll::Site.new(site_configuration(config))
93
+ @site.process
94
+ @site
93
95
  end
94
96
 
95
- config.after(:all) do
96
- @dest.rmtree if @dest.exist?
97
+ def build_org_site
98
+ build_site({ 'attendease' => { 'mode' => 'organization', 'jekyll33' => true } })
99
+ end
100
+
101
+ config.after(:each) do
102
+ dest.rmtree if dest.exist?
97
103
  fixtures_path.join('_attendease', 'templates').rmtree if File.exists?(fixtures_path.join('_attendease', 'templates'))
98
104
  fixtures_path.join('attendease_layouts').rmtree if File.exists?(fixtures_path.join('attendease_layouts'))
99
- Dir.glob(File.join(@site.source, '**', 'index.json')).map do |i|
100
- puts "Removing #{Pathname.new(i).parent}"
105
+ unless @site.nil?
106
+ Dir.glob(File.join(@site.source, '**', 'index.json')).map do |i|
107
+ puts "Removing #{Pathname.new(i).parent}"
101
108
 
102
- FileUtils.rm_r Pathname.new(i).parent
109
+ FileUtils.rm_r Pathname.new(i).parent
110
+ end
103
111
  end
104
112
  end
105
113
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-attendease
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.25k
4
+ version: 0.6.26a
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Wood
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2017-03-15 00:00:00.000000000 Z
14
+ date: 2017-04-11 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: httparty
@@ -161,6 +161,7 @@ extra_rdoc_files: []
161
161
  files:
162
162
  - lib/jekyll-attendease.rb
163
163
  - lib/jekyll/attendease_plugin.rb
164
+ - lib/jekyll/attendease_plugin/config_mixin.rb
164
165
  - lib/jekyll/attendease_plugin/event_data_generator.rb
165
166
  - lib/jekyll/attendease_plugin/event_layout_generator.rb
166
167
  - lib/jekyll/attendease_plugin/event_layout_page.rb
@@ -169,6 +170,7 @@ files:
169
170
  - lib/jekyll/attendease_plugin/helpers.rb
170
171
  - lib/jekyll/attendease_plugin/home_page.rb
171
172
  - lib/jekyll/attendease_plugin/home_page_generator.rb
173
+ - lib/jekyll/attendease_plugin/organization_data_generator.rb
172
174
  - lib/jekyll/attendease_plugin/pre_zero_point_six_link_redirect_generator.rb
173
175
  - lib/jekyll/attendease_plugin/presenter_page.rb
174
176
  - lib/jekyll/attendease_plugin/presenters_index_page.rb
@@ -180,6 +182,7 @@ files:
180
182
  - lib/jekyll/attendease_plugin/schedule_session_page.rb
181
183
  - lib/jekyll/attendease_plugin/schedule_sessions_page.rb
182
184
  - lib/jekyll/attendease_plugin/site_page.rb
185
+ - lib/jekyll/attendease_plugin/site_page_blocks_json.rb
183
186
  - lib/jekyll/attendease_plugin/site_pages_generator.rb
184
187
  - lib/jekyll/attendease_plugin/sponsor_generator.rb
185
188
  - lib/jekyll/attendease_plugin/sponsors_index_page.rb
@@ -192,6 +195,7 @@ files:
192
195
  - spec/lib/jekyll/attendease_plugin/event_template_generator_spec.rb
193
196
  - spec/lib/jekyll/attendease_plugin/filters_spec.rb
194
197
  - spec/lib/jekyll/attendease_plugin/helpers_spec.rb
198
+ - spec/lib/jekyll/attendease_plugin/organization_data_generator_spec.rb
195
199
  - spec/lib/jekyll/attendease_plugin/pre_zero_point_six_link_redirect_generator_spec.rb
196
200
  - spec/lib/jekyll/attendease_plugin/schedule_generator_spec.rb
197
201
  - spec/lib/jekyll/attendease_plugin/site_page_spec.rb
@@ -244,6 +248,7 @@ test_files:
244
248
  - spec/lib/jekyll/attendease_plugin/event_template_generator_spec.rb
245
249
  - spec/lib/jekyll/attendease_plugin/filters_spec.rb
246
250
  - spec/lib/jekyll/attendease_plugin/helpers_spec.rb
251
+ - spec/lib/jekyll/attendease_plugin/organization_data_generator_spec.rb
247
252
  - spec/lib/jekyll/attendease_plugin/pre_zero_point_six_link_redirect_generator_spec.rb
248
253
  - spec/lib/jekyll/attendease_plugin/schedule_generator_spec.rb
249
254
  - spec/lib/jekyll/attendease_plugin/site_page_spec.rb