fliks 1.0.0
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 +7 -0
- data/LICENSE +21 -0
- data/README.md +2 -0
- data/bin/fliks +34 -0
- data/bin/fliks.rb +34 -0
- data/bin/movie_rankings.csv +4 -0
- data/bin/movies.csv +3 -0
- data/lib/fliks/blocks.rb +7 -0
- data/lib/fliks/conditionals.rb +14 -0
- data/lib/fliks/files.rb +13 -0
- data/lib/fliks/mixins.rb +26 -0
- data/lib/fliks/movie.rb +54 -0
- data/lib/fliks/movie3d.rb +27 -0
- data/lib/fliks/namespaces.rb +29 -0
- data/lib/fliks/playlist.rb +81 -0
- data/lib/fliks/rankable.rb +25 -0
- data/lib/fliks/snack_bar.rb +29 -0
- data/lib/fliks/sorting.rb +12 -0
- data/lib/fliks/waldorf_and_statler.rb +20 -0
- data/spec/fliks/movie_spec.rb +70 -0
- data/spec/playlist_spec.rb +42 -0
- metadata +84 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 950e338f82123852e0df5a3d3e0d59575d7b2ab3373861fc3ce5ce9be656bac3
|
|
4
|
+
data.tar.gz: 48e915c6fea1d584226a67b624bc7a427fd2b194ec63f36996344a05fbad988f
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 55e90053efe510b5f60ada463d41c58fbe3f365ee5a059f210f5e645f62b3f763754f0630c846c46e8c851276b9433231a97ce7d4429de14e34a3e640494722c
|
|
7
|
+
data.tar.gz: 2907ccc70ca30e82f4875f44da8b621a8f2d0bb0c7aef409f11c3c9aeed091a9a6a1b239de81fc2c32c4689bfa86368af5d790a967ff2d06f9c16606041c7dcd
|
data/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2021 Louise Hamoy
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
data/bin/fliks
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
require_relative '../lib/fliks/playlist'
|
|
4
|
+
require_relative '../lib/fliks/movie3d'
|
|
5
|
+
|
|
6
|
+
playlist = Fliks::Playlist.new("Kermit")
|
|
7
|
+
default_movie_file =
|
|
8
|
+
File.join(File.dirname(__FILE__), "movies.csv")
|
|
9
|
+
playlist.load(ARGV.shift || default_movie_file)
|
|
10
|
+
movie3d = Movie3D.new('glee', 5, 20)
|
|
11
|
+
playlist.add_movie(movie3d)
|
|
12
|
+
|
|
13
|
+
loop do
|
|
14
|
+
puts "\nHow many viewings? ('quit' to exit)"
|
|
15
|
+
answer = gets.chomp.downcase
|
|
16
|
+
|
|
17
|
+
case answer
|
|
18
|
+
when /^\d+$/
|
|
19
|
+
playlist.play(answer.to_i)
|
|
20
|
+
when 'quit', 'exit'
|
|
21
|
+
playlist.print_stats
|
|
22
|
+
break
|
|
23
|
+
else
|
|
24
|
+
puts "Please enter a number or 'quit'"
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
playlist.save
|
|
29
|
+
|
|
30
|
+
# playlist2 = Playlist.new("Fozzie")
|
|
31
|
+
# playlist2.add_movie(movie3)
|
|
32
|
+
# movie4 = Movie.new("gremlins", 15)
|
|
33
|
+
# playlist2.add_movie(movie4)
|
|
34
|
+
# playlist2.play(3)
|
data/bin/fliks.rb
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
require_relative '../lib/fliks/playlist'
|
|
4
|
+
require_relative '../lib/fliks/movie3d'
|
|
5
|
+
|
|
6
|
+
playlist = Fliks::Playlist.new("Kermit")
|
|
7
|
+
default_movie_file =
|
|
8
|
+
File.join(File.dirname(__FILE__), "movies.csv")
|
|
9
|
+
playlist.load(ARGV.shift || default_movie_file)
|
|
10
|
+
movie3d = Movie3D.new('glee', 5, 20)
|
|
11
|
+
playlist.add_movie(movie3d)
|
|
12
|
+
|
|
13
|
+
loop do
|
|
14
|
+
puts "\nHow many viewings? ('quit' to exit)"
|
|
15
|
+
answer = gets.chomp.downcase
|
|
16
|
+
|
|
17
|
+
case answer
|
|
18
|
+
when /^\d+$/
|
|
19
|
+
playlist.play(answer.to_i)
|
|
20
|
+
when 'quit', 'exit'
|
|
21
|
+
playlist.print_stats
|
|
22
|
+
break
|
|
23
|
+
else
|
|
24
|
+
puts "Please enter a number or 'quit'"
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
playlist.save
|
|
29
|
+
|
|
30
|
+
# playlist2 = Playlist.new("Fozzie")
|
|
31
|
+
# playlist2.add_movie(movie3)
|
|
32
|
+
# movie4 = Movie.new("gremlins", 15)
|
|
33
|
+
# playlist2.add_movie(movie4)
|
|
34
|
+
# playlist2.play(3)
|
data/bin/movies.csv
ADDED
data/lib/fliks/blocks.rb
ADDED
data/lib/fliks/files.rb
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
require_relative 'movie'
|
|
2
|
+
|
|
3
|
+
movie1 = Movie.new("goonies", 10)
|
|
4
|
+
movie2 = Movie.new("ghostbusters", 9)
|
|
5
|
+
movie3 = Movie.new("goldfinger")
|
|
6
|
+
|
|
7
|
+
movies = [movie1, movie2, movie3]
|
|
8
|
+
|
|
9
|
+
File.open("movie_rankings.csv", "w") do |file|
|
|
10
|
+
movies.sort.each do |movie|
|
|
11
|
+
file.puts "#{movie.title},#{movie.rank}"
|
|
12
|
+
end
|
|
13
|
+
end
|
data/lib/fliks/mixins.rb
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
module Rankable
|
|
2
|
+
def thumbs_up
|
|
3
|
+
puts "#{@title} got a thumbs up!"
|
|
4
|
+
end
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
class Movie
|
|
8
|
+
include Rankable
|
|
9
|
+
def initialize(title, rank)
|
|
10
|
+
@title = title
|
|
11
|
+
@rank = rank
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
class Song
|
|
16
|
+
include Rankable
|
|
17
|
+
def initialize(title, rank)
|
|
18
|
+
@title = title
|
|
19
|
+
@rank = rank
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
movie = Movie.new("Goonies", 10)
|
|
24
|
+
movie.thumbs_up
|
|
25
|
+
song = Song.new("Ruby Baby", 10)
|
|
26
|
+
song.thumbs_up
|
data/lib/fliks/movie.rb
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
require_relative 'rankable'
|
|
2
|
+
|
|
3
|
+
class Movie
|
|
4
|
+
include Rankable
|
|
5
|
+
|
|
6
|
+
attr_accessor :rank
|
|
7
|
+
attr_accessor :title
|
|
8
|
+
|
|
9
|
+
def initialize(title, rank = 0)
|
|
10
|
+
@title = title.capitalize
|
|
11
|
+
@rank = rank
|
|
12
|
+
@snack_carbs = Hash.new(0)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def self.from_csv(line)
|
|
16
|
+
title, rank = line.split(",")
|
|
17
|
+
Movie.new(title, Integer(rank))
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def to_csv
|
|
21
|
+
"#{@title},#{@rank}"
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def each_snack
|
|
25
|
+
@snack_carbs.each do |name, carbs|
|
|
26
|
+
snack = Snack.new(name, carbs)
|
|
27
|
+
yield snack
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def carbs_consumed
|
|
32
|
+
@snack_carbs.values.reduce(0, :+)
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def ate_snack(snack)
|
|
36
|
+
@snack_carbs[snack.name] += snack.carbs
|
|
37
|
+
puts "#{@title} led to #{snack.carbs} #{snack.name} carbs being consumed."
|
|
38
|
+
puts "#{@title}'s snacks: #{@snack_carbs}"
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def to_s
|
|
42
|
+
"#{@title} has a rank of #{@rank} (#{status})"
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
if __FILE__ == $0
|
|
47
|
+
movie = Movie.new("goonies", 10)
|
|
48
|
+
movie.thumbs_up
|
|
49
|
+
puts movie
|
|
50
|
+
puts movie.title
|
|
51
|
+
puts movie.rank
|
|
52
|
+
movie.title = "Gooneys!"
|
|
53
|
+
puts movie.title
|
|
54
|
+
end
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
require_relative 'movie'
|
|
2
|
+
|
|
3
|
+
class Movie3D < Movie
|
|
4
|
+
def initialize(title, rank, wow_factor)
|
|
5
|
+
super(title, rank)
|
|
6
|
+
@wow_factor = wow_factor
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def thumbs_up
|
|
10
|
+
@wow_factor.times { super }
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def show_effect
|
|
14
|
+
puts "Wow! " * @wow_factor
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
movie3d = Movie3D.new('glee', 5, 20)
|
|
19
|
+
puts movie3d.title
|
|
20
|
+
puts movie3d.rank
|
|
21
|
+
|
|
22
|
+
movie3d.thumbs_up
|
|
23
|
+
|
|
24
|
+
puts movie3d.rank
|
|
25
|
+
puts movie3d
|
|
26
|
+
|
|
27
|
+
puts movie3d.show_effect
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
module MovieSystem
|
|
2
|
+
VERSION = 1.0
|
|
3
|
+
|
|
4
|
+
def self.info
|
|
5
|
+
puts "Movie system version #{VERSION}"
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
class Player
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
module GameSystem
|
|
13
|
+
VERSION = 2.0
|
|
14
|
+
|
|
15
|
+
def self.info
|
|
16
|
+
puts "Game system version #{VERSION}"
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
class Player
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
puts MovieSystem::VERSION
|
|
24
|
+
puts MovieSystem.info
|
|
25
|
+
puts MovieSystem::Player.new
|
|
26
|
+
|
|
27
|
+
puts GameSystem::VERSION
|
|
28
|
+
puts GameSystem.info
|
|
29
|
+
puts GameSystem::Player.new
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
require_relative 'movie'
|
|
2
|
+
require_relative 'waldorf_and_statler'
|
|
3
|
+
require_relative 'snack_bar'
|
|
4
|
+
|
|
5
|
+
module Fliks
|
|
6
|
+
class Playlist
|
|
7
|
+
def initialize(name)
|
|
8
|
+
@name = name
|
|
9
|
+
@movies = []
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def load(from_file)
|
|
13
|
+
File.readlines(from_file).each do |line|
|
|
14
|
+
add_movie(Movie.from_csv(line))
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def save(to_file = "movie_rankings.csv")
|
|
19
|
+
File.open(to_file, "w") do |file|
|
|
20
|
+
@movies.sort.each do |movie|
|
|
21
|
+
file.puts movie.to_csv
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def add_movie(movie)
|
|
27
|
+
@movies << movie
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def play(viewings)
|
|
31
|
+
puts "#{@name} playlist: "
|
|
32
|
+
|
|
33
|
+
puts @movies.sort
|
|
34
|
+
|
|
35
|
+
snacks = SnackBar::SNACKS
|
|
36
|
+
puts "\nThere are #{snacks.size} snacks available in the snack bar."
|
|
37
|
+
|
|
38
|
+
snacks.each do |snack|
|
|
39
|
+
puts "#{snack.name} has #{snack.carbs} carbs"
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
1.upto(viewings) do |count|
|
|
43
|
+
puts "\nViewing: #{count}:"
|
|
44
|
+
@movies.each do |movie|
|
|
45
|
+
WaldorfAndStatler.review(movie)
|
|
46
|
+
snack = SnackBar.random
|
|
47
|
+
movie.ate_snack(snack)
|
|
48
|
+
puts movie
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def total_carbs_consumed
|
|
54
|
+
@movies.reduce(0) do |sum, movie|
|
|
55
|
+
sum + movie.carbs_consumed
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
def print_stats
|
|
60
|
+
puts "\n#{@name}'s Stats:"
|
|
61
|
+
|
|
62
|
+
puts "#{total_carbs_consumed} total carbs consumed"
|
|
63
|
+
|
|
64
|
+
@movies.sort.each do |movie|
|
|
65
|
+
puts "\n#{movie.title}'s snack totals:"
|
|
66
|
+
movie.each_snack do |snack|
|
|
67
|
+
puts "#{snack.carbs} total #{snack.name} carbs"
|
|
68
|
+
end
|
|
69
|
+
puts "#{movie.carbs_consumed} grand total carbs"
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
hits, flops = @movies.partition { |movie| movie.hit? }
|
|
73
|
+
|
|
74
|
+
puts "\nHits:"
|
|
75
|
+
puts hits.sort
|
|
76
|
+
|
|
77
|
+
puts "\nFlops:"
|
|
78
|
+
puts flops.sort
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
module Rankable
|
|
2
|
+
def thumbs_up
|
|
3
|
+
self.rank += 1
|
|
4
|
+
end
|
|
5
|
+
|
|
6
|
+
def thumbs_down
|
|
7
|
+
self.rank -= 1
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def hit?
|
|
11
|
+
self.rank >= 10
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def status
|
|
15
|
+
hit? ? "Hit" : "Flop"
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def normalized_rank
|
|
19
|
+
self.rank / 10
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def <=>(other)
|
|
23
|
+
other.rank <=> self.rank
|
|
24
|
+
end
|
|
25
|
+
end
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
Snack = Struct.new(:name, :carbs)
|
|
2
|
+
|
|
3
|
+
module SnackBar
|
|
4
|
+
SNACKS = [
|
|
5
|
+
Snack.new(:popcorn, 20),
|
|
6
|
+
Snack.new(:candy, 15),
|
|
7
|
+
Snack.new(:nachos, 40),
|
|
8
|
+
Snack.new(:pretzel, 10),
|
|
9
|
+
Snack.new(:soda, 5)
|
|
10
|
+
]
|
|
11
|
+
|
|
12
|
+
def self.random
|
|
13
|
+
SNACKS.sample
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
if __FILE__ == $0
|
|
18
|
+
puts SnackBar::SNACKS
|
|
19
|
+
snack = SnackBar.random
|
|
20
|
+
puts "Enjoy your #{snack.name} (#{snack.carbs}) carbs"
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
# popcorn = Snack.new("popcorn", 20)
|
|
24
|
+
# puts popcorn.name
|
|
25
|
+
# puts popcorn.carbs
|
|
26
|
+
|
|
27
|
+
# candy = Snack.new("candy", 15)
|
|
28
|
+
# puts candy.name
|
|
29
|
+
# puts candy.carbs
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# names = %w(Goonies Ghostburters Goldfinger Godfather)
|
|
2
|
+
# puts names.sort_by { |w| w.length }
|
|
3
|
+
|
|
4
|
+
require_relative 'movie'
|
|
5
|
+
|
|
6
|
+
movie1 = Movie.new("goonies", 10)
|
|
7
|
+
movie2 = Movie.new("godfather", 3)
|
|
8
|
+
movie3 = Movie.new("goldfinger", 7)
|
|
9
|
+
|
|
10
|
+
movies = [movie1, movie2, movie3]
|
|
11
|
+
|
|
12
|
+
puts movies.sort
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
module WaldorfAndStatler
|
|
2
|
+
def self.roll_die
|
|
3
|
+
rand(1..6)
|
|
4
|
+
end
|
|
5
|
+
|
|
6
|
+
def self.review(movie)
|
|
7
|
+
number_rolled = roll_die
|
|
8
|
+
case number_rolled
|
|
9
|
+
when 1..2
|
|
10
|
+
movie.thumbs_down
|
|
11
|
+
puts "#{movie.title} got a thumbs down!"
|
|
12
|
+
when 3..4
|
|
13
|
+
puts "#{movie.title} was skipped."
|
|
14
|
+
else
|
|
15
|
+
movie.thumbs_up
|
|
16
|
+
puts "#{movie.title} got a thumbs up!"
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
require 'fliks/movie'
|
|
2
|
+
|
|
3
|
+
describe Movie do
|
|
4
|
+
before do
|
|
5
|
+
@initial_rank = 10
|
|
6
|
+
@movie = Movie.new("goonies", @initial_rank)
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
it "has a capitalize title" do
|
|
10
|
+
expect(@movie.title).to eql "Goonies"
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
it "has an initial rank" do
|
|
14
|
+
expect(@movie.rank).to eql 10
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
it "has a string representation" do
|
|
18
|
+
expect(@movie.to_s).to eql "Goonies has a rank of 10 (Hit)"
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
it "increases rank by 1 when given a thumbs up" do
|
|
22
|
+
@movie.thumbs_up
|
|
23
|
+
expect(@movie.rank).to eql @initial_rank + 1
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
it "decreases rank by 1 when given a thumbs down" do
|
|
27
|
+
@movie.thumbs_down
|
|
28
|
+
expect(@movie.rank).to eql @initial_rank - 1
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
context "created with a default rank" do
|
|
32
|
+
before do
|
|
33
|
+
@movie = Movie.new("goonies")
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
it "has a rank of 0" do
|
|
37
|
+
expect(@movie.rank).to eql 0
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
context "with a rank of at least 10" do
|
|
42
|
+
before do
|
|
43
|
+
@movie = Movie.new("goonies", 10)
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
it "is a hit" do
|
|
47
|
+
# expect(@movie.hit?).to eql true
|
|
48
|
+
expect(@movie).to be_hit
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
it "has a hit status" do
|
|
52
|
+
expect(@movie.status).to eql "Hit"
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
context "with a rank less than 10" do
|
|
57
|
+
before do
|
|
58
|
+
@movie = Movie.new("goonies", 9)
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
it "is not a hit" do
|
|
62
|
+
expect(@movie.hit?).to be false
|
|
63
|
+
# expect(@movie).not_to be_hit
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
it "has a flop status" do
|
|
67
|
+
expect(@movie.status).to eql "Flop"
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
end
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
require 'fliks/playlist'
|
|
2
|
+
|
|
3
|
+
module Fliks
|
|
4
|
+
describe Playlist do
|
|
5
|
+
before do
|
|
6
|
+
@playlist = Playlist.new("Kermit")
|
|
7
|
+
$stdout = StringIO.new
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
context "being played with one movie" do
|
|
11
|
+
before do
|
|
12
|
+
@initial_rank = 10
|
|
13
|
+
@movie = Movie.new("goonies", @initial_rank)
|
|
14
|
+
@playlist.add_movie(@movie)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
it "gives the movie a thumbs up if a high number is rolled" do
|
|
18
|
+
allow(WaldorfAndStatler).to receive(:roll_die).and_return(5)
|
|
19
|
+
|
|
20
|
+
@playlist.play(1)
|
|
21
|
+
|
|
22
|
+
expect(@movie.rank).to eql @initial_rank + 1
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
it "skips the movie if a medium number is rolled" do
|
|
26
|
+
allow(WaldorfAndStatler).to receive(:roll_die).and_return(3)
|
|
27
|
+
|
|
28
|
+
@playlist.play(1)
|
|
29
|
+
|
|
30
|
+
expect(@movie.rank).to eql @initial_rank
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
it "gives a movie a thumbs down if a low number is rolled" do
|
|
34
|
+
allow(WaldorfAndStatler).to receive(:roll_die).and_return(1)
|
|
35
|
+
|
|
36
|
+
@playlist.play(1)
|
|
37
|
+
|
|
38
|
+
expect(@movie.rank).to eql @initial_rank - 1
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: fliks
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- The Pragmatic Studio
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2021-09-28 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: rspec
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - "~>"
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '3.4'
|
|
20
|
+
- - ">="
|
|
21
|
+
- !ruby/object:Gem::Version
|
|
22
|
+
version: 3.4.4
|
|
23
|
+
type: :development
|
|
24
|
+
prerelease: false
|
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
26
|
+
requirements:
|
|
27
|
+
- - "~>"
|
|
28
|
+
- !ruby/object:Gem::Version
|
|
29
|
+
version: '3.4'
|
|
30
|
+
- - ">="
|
|
31
|
+
- !ruby/object:Gem::Version
|
|
32
|
+
version: 3.4.4
|
|
33
|
+
description: "# ruby-lou\n MIT \n"
|
|
34
|
+
email: support@pragmaticstudio.com
|
|
35
|
+
executables:
|
|
36
|
+
- fliks
|
|
37
|
+
extensions: []
|
|
38
|
+
extra_rdoc_files: []
|
|
39
|
+
files:
|
|
40
|
+
- LICENSE
|
|
41
|
+
- README.md
|
|
42
|
+
- bin/fliks
|
|
43
|
+
- bin/fliks.rb
|
|
44
|
+
- bin/movie_rankings.csv
|
|
45
|
+
- bin/movies.csv
|
|
46
|
+
- lib/fliks/blocks.rb
|
|
47
|
+
- lib/fliks/conditionals.rb
|
|
48
|
+
- lib/fliks/files.rb
|
|
49
|
+
- lib/fliks/mixins.rb
|
|
50
|
+
- lib/fliks/movie.rb
|
|
51
|
+
- lib/fliks/movie3d.rb
|
|
52
|
+
- lib/fliks/namespaces.rb
|
|
53
|
+
- lib/fliks/playlist.rb
|
|
54
|
+
- lib/fliks/rankable.rb
|
|
55
|
+
- lib/fliks/snack_bar.rb
|
|
56
|
+
- lib/fliks/sorting.rb
|
|
57
|
+
- lib/fliks/waldorf_and_statler.rb
|
|
58
|
+
- spec/fliks/movie_spec.rb
|
|
59
|
+
- spec/playlist_spec.rb
|
|
60
|
+
homepage: http://pragmaticstudio.com
|
|
61
|
+
licenses: []
|
|
62
|
+
metadata: {}
|
|
63
|
+
post_install_message:
|
|
64
|
+
rdoc_options: []
|
|
65
|
+
require_paths:
|
|
66
|
+
- lib
|
|
67
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
68
|
+
requirements:
|
|
69
|
+
- - ">="
|
|
70
|
+
- !ruby/object:Gem::Version
|
|
71
|
+
version: '1.9'
|
|
72
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
73
|
+
requirements:
|
|
74
|
+
- - ">="
|
|
75
|
+
- !ruby/object:Gem::Version
|
|
76
|
+
version: '0'
|
|
77
|
+
requirements: []
|
|
78
|
+
rubygems_version: 3.2.15
|
|
79
|
+
signing_key:
|
|
80
|
+
specification_version: 4
|
|
81
|
+
summary: Plays and reviews movies
|
|
82
|
+
test_files:
|
|
83
|
+
- spec/fliks/movie_spec.rb
|
|
84
|
+
- spec/playlist_spec.rb
|