Commit a6e369e

mo khan <mo@mokhan.ca>
2013-11-09 16:58:50
inline a couple more query methods. main
1 parent bfcf4b3
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
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)