summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2013-11-09 09:58:50 -0700
committermo khan <mo@mokhan.ca>2013-11-09 09:58:50 -0700
commita6e369e3b9de30b9a1efcc858847ad8008d86fbf (patch)
tree7586353098201c35306aa8a9b307d78e580a8137
parentbfcf4b39393fb8762b45657c0c16af0d4bf2d412 (diff)
inline a couple more query methods.main
-rw-r--r--src/movie_library.coffee8
-rw-r--r--test/movie_library_spec.coffee4
2 files changed, 2 insertions, 10 deletions
diff --git a/src/movie_library.coffee b/src/movie_library.coffee
index 7934d81..8ecb3aa 100644
--- a/src/movie_library.coffee
+++ b/src/movie_library.coffee
@@ -18,14 +18,6 @@ module.exports = class MovieLibrary extends Module
for movie in @movies
visitor(movie)
- find_movies_released_after_2004: ->
- @find_all (movie) =>
- movie.year_published > 2004
-
- find_movies_released_between_1982_and_2003: ->
- @find_all (movie) =>
- movie.year_published > 1982 && movie.year_published < 2003
-
sort_by_title_ascending: ->
@movies.sort (x, y) ->
return 1 if x.title > y.title
diff --git a/test/movie_library_spec.coffee b/test/movie_library_spec.coffee
index ac9d128..ede052b 100644
--- a/test/movie_library_spec.coffee
+++ b/test/movie_library_spec.coffee
@@ -78,13 +78,13 @@ describe "MovieLibrary", ->
results.should.include(@man_on_fire)
it "finds all movies released after 2004", ->
- results = @sut.find_movies_released_after_2004()
+ results = @sut.find_all (movie) -> movie.year_published > 2004
results.length.should.equal(2)
results.should.include(@up)
results.should.include(@cars)
it "finds all movies released between 1982 and 2003 - inclusive", ->
- results = @sut.find_movies_released_between_1982_and_2003()
+ results = @sut.find_all (movie) -> movie.year_published > 1982 && movie.year_published < 2003
results.length.should.equal(4)
results.should.include(@shawshank_redemption)
results.should.include(@chasing_amy)