conf-talks 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +19 -0
- data/Rakefile +10 -0
- data/bin/run-conf-talks +5 -0
- data/conf-talks.gemspec +23 -0
- data/lib/conf_builder.rb +63 -0
- data/lib/fortyfive_min_talk.rb +14 -0
- data/lib/lightning_talk.rb +18 -0
- data/lib/sixty_min_talk.rb +14 -0
- data/lib/talk.rb +22 -0
- data/lib/talk_factory.rb +23 -0
- data/lib/thirty_min_talk.rb +14 -0
- data/lib/track.rb +60 -0
- data/lib/version.rb +3 -0
- data/talks.yml +19 -0
- data/test/conf_builder_test.rb +8 -0
- data/test/fortyfive_min_talk_test.rb +38 -0
- data/test/lightning_talk_test.rb +37 -0
- data/test/minitest_helper.rb +7 -0
- data/test/sixty_min_talk_test.rb +38 -0
- data/test/talk_factory_test.rb +51 -0
- data/test/talk_test.rb +23 -0
- data/test/thirty_min_talk_test.rb +37 -0
- data/test/track_test.rb +69 -0
- metadata +130 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Karthik Muthupalaniappan
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
conf_talks
|
2
|
+
==========
|
3
|
+
|
4
|
+
This gem is the solution to the conference talks problem uses the following tools:
|
5
|
+
|
6
|
+
1. Ruby 1.9.3
|
7
|
+
2. Bundler for dependency management
|
8
|
+
3. Minitest for unit testing
|
9
|
+
|
10
|
+
Assumptions that drove this solution:
|
11
|
+
|
12
|
+
1. The talk durations can be lightning(5 mins), 30 mins, 45 mins and 60 mins. It is not designed to handle talks with random durations but can be scaled to add talks with new durations
|
13
|
+
2. The max duration of the pre-lunch session and the post-lunch session is 3 hours and 4 hours respectively
|
14
|
+
3. Longer talks occur before shorter ones in a track
|
15
|
+
4. The conference consists of two tracks only
|
16
|
+
5. The list of talks is fed via the talks.yml sitting under the test dir
|
17
|
+
|
18
|
+
To run and test the solution:
|
19
|
+
|
data/Rakefile
ADDED
data/bin/run-conf-talks
ADDED
data/conf-talks.gemspec
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |gem|
|
7
|
+
gem.name = "conf-talks"
|
8
|
+
gem.version = ConfBuilder::VERSION
|
9
|
+
gem.authors = ["Karthik Muthupalaniappan"]
|
10
|
+
gem.email = ["karthik.swaminathan@gmail.com"]
|
11
|
+
gem.description = %q{This gem is the solution to the conference talks problem}
|
12
|
+
gem.summary = %q{This gem is the solution to the conference talks problem. Uses a yml to feed in the list of talks.}
|
13
|
+
gem.homepage = "http://www.karthikmuthu.in"
|
14
|
+
|
15
|
+
gem.files = `git ls-files`.split($/)
|
16
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
17
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
18
|
+
gem.require_paths = ["lib"]
|
19
|
+
|
20
|
+
gem.add_dependency "rake"
|
21
|
+
gem.add_dependency "minitest"
|
22
|
+
gem.add_dependency "minitest-matchers"
|
23
|
+
end
|
data/lib/conf_builder.rb
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
####
|
2
|
+
## Main Conference Builder module
|
3
|
+
## Run method processes the list of talks to build conference tracks
|
4
|
+
####
|
5
|
+
|
6
|
+
require 'YAML'
|
7
|
+
require 'version'
|
8
|
+
|
9
|
+
module ConfBuilder
|
10
|
+
|
11
|
+
def self.start(*args)
|
12
|
+
run
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.run
|
16
|
+
begin
|
17
|
+
list = YAML.load(File.open('./talks.yml'))
|
18
|
+
@@thirty_min_talks = []
|
19
|
+
@@fortyfive_min_talks = []
|
20
|
+
@@sixty_min_talks = []
|
21
|
+
@@lightning_talks = []
|
22
|
+
@@talk_factory = build_talk_factory(list)
|
23
|
+
@@track1 = Track.new(@@talk_factory)
|
24
|
+
@@track2 = Track.new(@@talk_factory)
|
25
|
+
print
|
26
|
+
rescue Exception => ex
|
27
|
+
p "The conference builder program failed to complete successfully. Reason: #{ex.message}"
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
private
|
32
|
+
|
33
|
+
def self.build_talk_factory(list)
|
34
|
+
lightning_list = list.map {|l| l if l.include?('lightning')}.compact!
|
35
|
+
(list - lightning_list).each do |talk|
|
36
|
+
duration = talk.gsub!('min', '').match(/a*\d\d$/).to_s
|
37
|
+
title = talk.gsub!(duration, '').strip!
|
38
|
+
case duration
|
39
|
+
when '30'
|
40
|
+
@@thirty_min_talks << Thirty_min_talk.new({:title => title})
|
41
|
+
when '45'
|
42
|
+
@@fortyfive_min_talks << Fortyfive_min_talk.new({:title => title})
|
43
|
+
when '60'
|
44
|
+
@@sixty_min_talks << Sixty_min_talk.new({:title => title})
|
45
|
+
else
|
46
|
+
p "#{title} talk excluded because duration was not acceptable"
|
47
|
+
end
|
48
|
+
end
|
49
|
+
lightning_list.each do |talk|
|
50
|
+
title = talk.gsub!('lightning', '')
|
51
|
+
@@lightning_talks << Lightning_talk.new({:title => title})
|
52
|
+
end
|
53
|
+
TalkFactory.new(@@lightning_talks, @@thirty_min_talks, @@fortyfive_min_talks, @@sixty_min_talks)
|
54
|
+
end
|
55
|
+
|
56
|
+
def self.print
|
57
|
+
p '#### Conference talk list #####'
|
58
|
+
p '#### Track 1 ####'
|
59
|
+
@@track1.print
|
60
|
+
p '#### Track 2 ####'
|
61
|
+
@@track2.print
|
62
|
+
end
|
63
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
####
|
2
|
+
## Sub class for lightning talk
|
3
|
+
####
|
4
|
+
|
5
|
+
module ConfBuilder
|
6
|
+
class Lightning_talk < Talk
|
7
|
+
def initialize(params)
|
8
|
+
super(params)
|
9
|
+
@duration = 5
|
10
|
+
@duration_unit = 'minute'
|
11
|
+
self
|
12
|
+
end
|
13
|
+
|
14
|
+
def to_s
|
15
|
+
"#{@title} lightning"
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
data/lib/talk.rb
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
####
|
2
|
+
## Talk super class
|
3
|
+
####
|
4
|
+
|
5
|
+
module ConfBuilder
|
6
|
+
class Talk
|
7
|
+
attr_reader :title
|
8
|
+
attr_accessor :duration
|
9
|
+
attr_accessor :duration_unit
|
10
|
+
attr_reader :speaker
|
11
|
+
|
12
|
+
def initialize(params)
|
13
|
+
@title = params[:title]
|
14
|
+
@speaker = ['Uncle Bob Martin','Corey Haines','DHH'].sample
|
15
|
+
self
|
16
|
+
end
|
17
|
+
|
18
|
+
def to_s
|
19
|
+
"#{@title} #{@duration}#{duration_unit.slice(0, 3)}"
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
data/lib/talk_factory.rb
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
module ConfBuilder
|
2
|
+
class TalkFactory
|
3
|
+
def initialize(lightning_talks, thirty_min_talks, fortyfive_min_talks, sixty_min_talks)
|
4
|
+
@lightning_talks = lightning_talks
|
5
|
+
@thirty_min_talks = thirty_min_talks
|
6
|
+
@fortyfive_min_talks = fortyfive_min_talks
|
7
|
+
@sixty_min_talks = sixty_min_talks
|
8
|
+
self
|
9
|
+
end
|
10
|
+
|
11
|
+
def next_talk(duration)
|
12
|
+
if !@sixty_min_talks.empty? && (@sixty_min_talks.last.duration <= duration)
|
13
|
+
@sixty_min_talks.pop
|
14
|
+
elsif !@fortyfive_min_talks.empty? && (@fortyfive_min_talks.last.duration <= duration)
|
15
|
+
@fortyfive_min_talks.pop
|
16
|
+
elsif !@thirty_min_talks.empty? && (@thirty_min_talks.last.duration <= duration)
|
17
|
+
@thirty_min_talks.pop
|
18
|
+
elsif !@lightning_talks.empty?
|
19
|
+
@lightning_talks.pop
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
data/lib/track.rb
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
####
|
2
|
+
## Class to collate list of talks for a track
|
3
|
+
## Prelunch session and post lunch session
|
4
|
+
####
|
5
|
+
|
6
|
+
module ConfBuilder
|
7
|
+
class Track
|
8
|
+
attr_reader :pre_lunch_talks
|
9
|
+
attr_reader :post_lunch_talks
|
10
|
+
|
11
|
+
def initialize(talk_factory)
|
12
|
+
@track_time = Time.local(2000,"jan",1,9,0,0) #start time - 9:00 AM
|
13
|
+
@talk_factory = talk_factory
|
14
|
+
@pre_lunch_talks = []
|
15
|
+
@post_lunch_talks = []
|
16
|
+
build_session(@pre_lunch_talks, 180)
|
17
|
+
build_session(@post_lunch_talks, 240)
|
18
|
+
self
|
19
|
+
end
|
20
|
+
|
21
|
+
def build_session(session, duration)
|
22
|
+
while duration > 0
|
23
|
+
talk_to_add = @talk_factory.next_talk(duration)
|
24
|
+
unless talk_to_add.nil?
|
25
|
+
session << talk_to_add
|
26
|
+
duration -= talk_to_add.duration
|
27
|
+
else
|
28
|
+
break
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def print # print talks for track
|
34
|
+
talk_and_time_list(@pre_lunch_talks).each {|item| p item}
|
35
|
+
lunch
|
36
|
+
@track_time += 3600
|
37
|
+
talk_and_time_list(@post_lunch_talks).each {|item| p item}
|
38
|
+
networking_event
|
39
|
+
end
|
40
|
+
|
41
|
+
def lunch # print lunch
|
42
|
+
p "#{@track_time.strftime("%-l:%M %p")} Lunch"
|
43
|
+
end
|
44
|
+
|
45
|
+
def networking_event # print networking event
|
46
|
+
p "#{@track_time.strftime("%-l:%M %p")} Networking event"
|
47
|
+
end
|
48
|
+
|
49
|
+
private
|
50
|
+
|
51
|
+
def talk_and_time_list(talks)
|
52
|
+
ret_list = []
|
53
|
+
talks.map do |talk|
|
54
|
+
ret_list << "#{@track_time.strftime("%-l:%M %p")} #{talk.to_s}"
|
55
|
+
@track_time = @track_time + (talk.duration * 60)
|
56
|
+
end
|
57
|
+
ret_list
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
data/lib/version.rb
ADDED
data/talks.yml
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
- Writing Fast Tests Against Enterprise Rails 60min
|
2
|
+
- Overdoing it in Python 45min
|
3
|
+
- Lua for the Masses 30min
|
4
|
+
- Ruby Errors from Mismatched Gem Versions 45min
|
5
|
+
- Common Ruby Errors 45min
|
6
|
+
- Rails for Python Developers lightning
|
7
|
+
- Communicating Over Distance 60min
|
8
|
+
- Accounting-Driven Development 45min
|
9
|
+
- Woah 30min
|
10
|
+
- Sit Down and Write 30min
|
11
|
+
- Pair Programming vs Noise 45min
|
12
|
+
- Rails Magic 60min
|
13
|
+
- Ruby on Rails Why We Should Move On 60min
|
14
|
+
- Clojure Ate Scala (on my project) 45min
|
15
|
+
- Programming in the Boondocks of Seattle 30min
|
16
|
+
- Ruby vs. Clojure for Back-End Development 30min
|
17
|
+
- Ruby on Rails Legacy App Maintenance 60min
|
18
|
+
- A World Without HackerNews 30min
|
19
|
+
- User Interface CSS in Rails Apps 30min
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'minitest_helper'
|
2
|
+
require_relative '../lib/talk'
|
3
|
+
require_relative '../lib/fortyfive_min_talk'
|
4
|
+
|
5
|
+
describe ConfBuilder::Fortyfive_min_talk, 'Test the 45 minute talk class' do
|
6
|
+
before do
|
7
|
+
@talk_45 = ConfBuilder::Fortyfive_min_talk.new({:title => 'Ruby Errors from Mismatched Gem Versions'})
|
8
|
+
end
|
9
|
+
|
10
|
+
after do
|
11
|
+
@talk_45 = nil
|
12
|
+
end
|
13
|
+
|
14
|
+
describe 'when initialized' do
|
15
|
+
it 'should assign a title' do
|
16
|
+
@talk_45.title.wont_equal nil
|
17
|
+
@talk_45.title.must_equal 'Ruby Errors from Mismatched Gem Versions'
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'should assign a speaker' do
|
21
|
+
@talk_45.speaker.wont_equal nil
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'should assign the duration and duration unit' do
|
25
|
+
@talk_45.duration.wont_equal nil
|
26
|
+
@talk_45.duration.must_equal 45
|
27
|
+
@talk_45.duration_unit.wont_equal nil
|
28
|
+
@talk_45.duration_unit.must_equal 'minute'
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
describe 'when translated to string' do
|
33
|
+
it 'should produce the correct content' do
|
34
|
+
@talk_45.to_s.wont_equal nil
|
35
|
+
@talk_45.to_s.must_equal 'Ruby Errors from Mismatched Gem Versions 45min'
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'minitest_helper'
|
2
|
+
require_relative '../lib/lightning_talk'
|
3
|
+
|
4
|
+
describe ConfBuilder::Lightning_talk, 'Test the lightning talk class' do
|
5
|
+
before do
|
6
|
+
@lighting_talk = ConfBuilder::Lightning_talk.new({:title => 'Rails for Python Developers'})
|
7
|
+
end
|
8
|
+
|
9
|
+
after do
|
10
|
+
@lighting_talk = nil
|
11
|
+
end
|
12
|
+
|
13
|
+
describe 'when initialized' do
|
14
|
+
it 'should assign a title' do
|
15
|
+
@lighting_talk.title.wont_equal nil
|
16
|
+
@lighting_talk.title.must_equal 'Rails for Python Developers'
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'should assign a speaker' do
|
20
|
+
@lighting_talk.speaker.wont_equal nil
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'should assign the duration and duration unit' do
|
24
|
+
@lighting_talk.duration.wont_equal nil
|
25
|
+
@lighting_talk.duration.must_equal 5
|
26
|
+
@lighting_talk.duration_unit.wont_equal nil
|
27
|
+
@lighting_talk.duration_unit.must_equal 'minute'
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
describe 'when translated to string' do
|
32
|
+
it 'should produce the correct content' do
|
33
|
+
@lighting_talk.to_s.wont_equal nil
|
34
|
+
@lighting_talk.to_s.must_equal 'Rails for Python Developers lightning'
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'minitest_helper'
|
2
|
+
require_relative '../lib/talk'
|
3
|
+
require_relative '../lib/sixty_min_talk'
|
4
|
+
|
5
|
+
describe ConfBuilder::Sixty_min_talk, 'Test the 60 minute talk class' do
|
6
|
+
before do
|
7
|
+
@talk_60 = ConfBuilder::Sixty_min_talk.new({:title => 'Ruby Errors from Mismatched Gem Versions'})
|
8
|
+
end
|
9
|
+
|
10
|
+
after do
|
11
|
+
@talk_60 = nil
|
12
|
+
end
|
13
|
+
|
14
|
+
describe 'when initialized' do
|
15
|
+
it 'should assign a title' do
|
16
|
+
@talk_60.title.wont_equal nil
|
17
|
+
@talk_60.title.must_equal 'Ruby Errors from Mismatched Gem Versions'
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'should assign a speaker' do
|
21
|
+
@talk_60.speaker.wont_equal nil
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'should assign the duration and duration unit' do
|
25
|
+
@talk_60.duration.wont_equal nil
|
26
|
+
@talk_60.duration.must_equal 60
|
27
|
+
@talk_60.duration_unit.wont_equal nil
|
28
|
+
@talk_60.duration_unit.must_equal 'minute'
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
describe 'when translated to string' do
|
33
|
+
it 'should produce the correct content' do
|
34
|
+
@talk_60.to_s.wont_equal nil
|
35
|
+
@talk_60.to_s.must_equal 'Ruby Errors from Mismatched Gem Versions 60min'
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
require 'minitest_helper'
|
2
|
+
require_relative '../lib/talk_factory'
|
3
|
+
|
4
|
+
describe ConfBuilder::TalkFactory, 'test the Talk factory class' do
|
5
|
+
before do
|
6
|
+
@talk1 = ConfBuilder::Thirty_min_talk.new({:title => 'Write fast tests against Rails enterprise'})
|
7
|
+
@talk5 = ConfBuilder::Thirty_min_talk.new({:title => 'Object design in Ruby apps'})
|
8
|
+
@talk2 = ConfBuilder::Fortyfive_min_talk.new({:title => 'Overdoing in Python'})
|
9
|
+
@talk8 = ConfBuilder::Fortyfive_min_talk.new({:title => 'Overdoing in Django'})
|
10
|
+
@talk3 = ConfBuilder::Sixty_min_talk.new({:title => 'User interface CSS in Rails apps'})
|
11
|
+
@talk6 = ConfBuilder::Sixty_min_talk.new({:title => 'Engineering principles'})
|
12
|
+
@talk7 = ConfBuilder::Sixty_min_talk.new({:title => 'Domain driven design in Rails apps'})
|
13
|
+
@talk4 = ConfBuilder::Lightning_talk.new({:title => 'Domain driven design in Rails apps'})
|
14
|
+
@talk_factory = ConfBuilder::TalkFactory.new([@talk4], [@talk1, @talk5], [@talk2, @talk8], [@talk3, @talk6, @talk7])
|
15
|
+
end
|
16
|
+
|
17
|
+
after do
|
18
|
+
@talk_factory = nil
|
19
|
+
@talk1 = nil
|
20
|
+
@talk2 = nil
|
21
|
+
@talk3 = nil
|
22
|
+
@talk4 = nil
|
23
|
+
@talk5 = nil
|
24
|
+
@talk6 = nil
|
25
|
+
@talk7 = nil
|
26
|
+
@talk8 = nil
|
27
|
+
end
|
28
|
+
|
29
|
+
describe 'when initialized' do
|
30
|
+
it 'should not be nil' do
|
31
|
+
@talk_factory.wont_equal nil
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
describe 'when next talk is invoked' do
|
36
|
+
it 'should get next talk for total duration of 90 minutes' do
|
37
|
+
@talk_factory.next_talk(90).must_equal @talk7
|
38
|
+
@talk_factory.next_talk(30).must_equal @talk5
|
39
|
+
end
|
40
|
+
|
41
|
+
it 'should get next talk for total duration of 120 minutes' do
|
42
|
+
@talk_factory.next_talk(120).must_equal @talk7
|
43
|
+
@talk_factory.next_talk(60).must_equal @talk6
|
44
|
+
end
|
45
|
+
|
46
|
+
it 'should get next talk for total duration of 20 minutes' do
|
47
|
+
@talk_factory.next_talk(20).must_equal @talk4
|
48
|
+
@talk_factory.next_talk(15).must_equal nil
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
data/test/talk_test.rb
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'minitest_helper'
|
2
|
+
require_relative '../lib/talk'
|
3
|
+
|
4
|
+
describe ConfBuilder::Talk, 'Test the Talk class' do
|
5
|
+
before do
|
6
|
+
@talk = ConfBuilder::Talk.new({:title => 'Overdoing it in Python'})
|
7
|
+
end
|
8
|
+
|
9
|
+
after do
|
10
|
+
@talk = nil
|
11
|
+
end
|
12
|
+
|
13
|
+
describe 'when initialized' do
|
14
|
+
it 'should assign a title' do
|
15
|
+
@talk.speaker.wont_equal nil
|
16
|
+
@talk.title.must_equal 'Overdoing it in Python'
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'should assign a speaker' do
|
20
|
+
@talk.speaker.wont_equal nil
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'minitest_helper'
|
2
|
+
require_relative '../lib/thirty_min_talk'
|
3
|
+
|
4
|
+
describe ConfBuilder::Thirty_min_talk, 'Test the 30 minute talk class' do
|
5
|
+
before do
|
6
|
+
@talk_30 = ConfBuilder::Thirty_min_talk.new({:title => 'Ruby Errors from Mismatched Gem Versions'})
|
7
|
+
end
|
8
|
+
|
9
|
+
after do
|
10
|
+
@talk_30 = nil
|
11
|
+
end
|
12
|
+
|
13
|
+
describe 'when initialized' do
|
14
|
+
it 'should assign a title' do
|
15
|
+
@talk_30.title.wont_equal nil
|
16
|
+
@talk_30.title.must_equal 'Ruby Errors from Mismatched Gem Versions'
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'should assign a speaker' do
|
20
|
+
@talk_30.speaker.wont_equal nil
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'should assign the duration and duration unit' do
|
24
|
+
@talk_30.duration.wont_equal nil
|
25
|
+
@talk_30.duration.must_equal 30
|
26
|
+
@talk_30.duration_unit.wont_equal nil
|
27
|
+
@talk_30.duration_unit.must_equal 'minute'
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
describe 'when translated to string' do
|
32
|
+
it 'should produce the correct content' do
|
33
|
+
@talk_30.to_s.wont_equal nil
|
34
|
+
@talk_30.to_s.must_equal 'Ruby Errors from Mismatched Gem Versions 30min'
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
data/test/track_test.rb
ADDED
@@ -0,0 +1,69 @@
|
|
1
|
+
require 'minitest_helper'
|
2
|
+
require_relative '../lib/track'
|
3
|
+
|
4
|
+
describe ConfBuilder::Track, 'Test the Talk class' do
|
5
|
+
before do
|
6
|
+
@talk1 = ConfBuilder::Thirty_min_talk.new({:title => 'Write fast tests against Rails enterprise'})
|
7
|
+
@talk2 = ConfBuilder::Fortyfive_min_talk.new({:title => 'Overdoing in Python'})
|
8
|
+
@talk3 = ConfBuilder::Sixty_min_talk.new({:title => 'User interface CSS in Rails apps'})
|
9
|
+
@talk4 = ConfBuilder::Lightning_talk.new({:title => 'Domain driven design in Rails apps'})
|
10
|
+
@talk5 = ConfBuilder::Thirty_min_talk.new({:title => 'Object design in Ruby apps'})
|
11
|
+
@talk6 = ConfBuilder::Sixty_min_talk.new({:title => 'Engineering principles'})
|
12
|
+
@talk7 = ConfBuilder::Sixty_min_talk.new({:title => 'User driven design in Rails apps'})
|
13
|
+
@talk8 = ConfBuilder::Fortyfive_min_talk.new({:title => 'Overdoing in Django'})
|
14
|
+
@talk9 = ConfBuilder::Fortyfive_min_talk.new({:title => 'Agile in Django'})
|
15
|
+
@talk10 = ConfBuilder::Sixty_min_talk.new({:title => 'UI Design in Django'})
|
16
|
+
@talk11 = ConfBuilder::Sixty_min_talk.new({:title => 'TDD in Django'})
|
17
|
+
@talk_factory = ConfBuilder::TalkFactory.new([@talk4], [@talk1, @talk5], [@talk2, @talk8, @talk9], [@talk3, @talk6, @talk7, @talk10, @talk11])
|
18
|
+
@track = ConfBuilder::Track.new(@talk_factory)
|
19
|
+
end
|
20
|
+
|
21
|
+
after do
|
22
|
+
@track = nil
|
23
|
+
@talk1 = nil
|
24
|
+
@talk2 = nil
|
25
|
+
@talk3 = nil
|
26
|
+
@talk4 = nil
|
27
|
+
@talk5 = nil
|
28
|
+
@talk6 = nil
|
29
|
+
@talk7 = nil
|
30
|
+
@talk8 = nil
|
31
|
+
@talk9 = nil
|
32
|
+
@talk10 = nil
|
33
|
+
@talk11 = nil
|
34
|
+
end
|
35
|
+
|
36
|
+
describe 'when initialized' do
|
37
|
+
it 'should not be nil' do
|
38
|
+
@track.wont_equal nil
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
describe 'when talks for session' do
|
43
|
+
it 'should build talks list for pre lunch session' do
|
44
|
+
@track.pre_lunch_talks.wont_equal nil
|
45
|
+
@track.pre_lunch_talks.wont_equal []
|
46
|
+
@track.pre_lunch_talks.inspect.must_equal '[TDD in Django 60min, UI Design in Django 60min, User driven design in Rails apps 60min]'
|
47
|
+
end
|
48
|
+
|
49
|
+
it 'should build talks list for post lunch session' do
|
50
|
+
@track.post_lunch_talks.wont_equal nil
|
51
|
+
@track.post_lunch_talks.wont_equal []
|
52
|
+
@track.post_lunch_talks.inspect.must_equal '[Engineering principles 60min, User interface CSS in Rails apps 60min, Agile in Django 45min, Overdoing in Django 45min, Object design in Ruby apps 30min]'
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
describe 'print talks for session' do
|
57
|
+
it 'should print lunch' do
|
58
|
+
@track.lunch.must_include 'Lunch'
|
59
|
+
end
|
60
|
+
|
61
|
+
it 'should print networking event' do
|
62
|
+
@track.networking_event.must_include 'Networking event'
|
63
|
+
end
|
64
|
+
|
65
|
+
it 'should list talks for the entire session' do
|
66
|
+
@track.print
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
metadata
ADDED
@@ -0,0 +1,130 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: conf-talks
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Karthik Muthupalaniappan
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-03-20 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rake
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: minitest
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
type: :runtime
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: minitest-matchers
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :runtime
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
description: This gem is the solution to the conference talks problem
|
63
|
+
email:
|
64
|
+
- karthik.swaminathan@gmail.com
|
65
|
+
executables:
|
66
|
+
- run-conf-talks
|
67
|
+
extensions: []
|
68
|
+
extra_rdoc_files: []
|
69
|
+
files:
|
70
|
+
- .gitignore
|
71
|
+
- Gemfile
|
72
|
+
- LICENSE.txt
|
73
|
+
- README.md
|
74
|
+
- Rakefile
|
75
|
+
- bin/run-conf-talks
|
76
|
+
- conf-talks.gemspec
|
77
|
+
- lib/conf_builder.rb
|
78
|
+
- lib/fortyfive_min_talk.rb
|
79
|
+
- lib/lightning_talk.rb
|
80
|
+
- lib/sixty_min_talk.rb
|
81
|
+
- lib/talk.rb
|
82
|
+
- lib/talk_factory.rb
|
83
|
+
- lib/thirty_min_talk.rb
|
84
|
+
- lib/track.rb
|
85
|
+
- lib/version.rb
|
86
|
+
- talks.yml
|
87
|
+
- test/conf_builder_test.rb
|
88
|
+
- test/fortyfive_min_talk_test.rb
|
89
|
+
- test/lightning_talk_test.rb
|
90
|
+
- test/minitest_helper.rb
|
91
|
+
- test/sixty_min_talk_test.rb
|
92
|
+
- test/talk_factory_test.rb
|
93
|
+
- test/talk_test.rb
|
94
|
+
- test/thirty_min_talk_test.rb
|
95
|
+
- test/track_test.rb
|
96
|
+
homepage: http://www.karthikmuthu.in
|
97
|
+
licenses: []
|
98
|
+
post_install_message:
|
99
|
+
rdoc_options: []
|
100
|
+
require_paths:
|
101
|
+
- lib
|
102
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
103
|
+
none: false
|
104
|
+
requirements:
|
105
|
+
- - ! '>='
|
106
|
+
- !ruby/object:Gem::Version
|
107
|
+
version: '0'
|
108
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
109
|
+
none: false
|
110
|
+
requirements:
|
111
|
+
- - ! '>='
|
112
|
+
- !ruby/object:Gem::Version
|
113
|
+
version: '0'
|
114
|
+
requirements: []
|
115
|
+
rubyforge_project:
|
116
|
+
rubygems_version: 1.8.24
|
117
|
+
signing_key:
|
118
|
+
specification_version: 3
|
119
|
+
summary: This gem is the solution to the conference talks problem. Uses a yml to feed
|
120
|
+
in the list of talks.
|
121
|
+
test_files:
|
122
|
+
- test/conf_builder_test.rb
|
123
|
+
- test/fortyfive_min_talk_test.rb
|
124
|
+
- test/lightning_talk_test.rb
|
125
|
+
- test/minitest_helper.rb
|
126
|
+
- test/sixty_min_talk_test.rb
|
127
|
+
- test/talk_factory_test.rb
|
128
|
+
- test/talk_test.rb
|
129
|
+
- test/thirty_min_talk_test.rb
|
130
|
+
- test/track_test.rb
|