Sha256: e39c9cc5c902ca9c683d92acfcc78e0702846e114c9c2982dceffb5345846db8
Contents?: true
Size: 1.16 KB
Versions: 2
Compression:
Stored size: 1.16 KB
Contents
module FixtureCreator class Api def all_cinemas! write_fixture(:all_cinemas) end def app_init! write_fixture(:app_init) end def film_times!(cinema_id) OdeonUk::Performance.send(:film_ids_at, cinema_id).each do |i| write_film_times_fixture(cinema_id, i) end end private def fixture(name) File.expand_path("../../test/fixtures/api/#{name}.plist", __FILE__) end def log(message) puts "Create API fixture: #{message}" end def write_film_times_fixture(cinema_id, film_id) FileUtils.mkdir_p 'film_times' text = "film_times/#{cinema_id}-#{film_id}" File.open(fixture(text), 'w+') do |file| log(text) file.write OdeonUk::Internal::ApiResponse.new.send(:film_times_raw, cinema_id, film_id) end end def write_fixture(kind) FileUtils.mkdir_p kind.to_s File.open(fixture(kind), 'w+') do |file| log(kind) file.write OdeonUk::Internal::ApiResponse.new.send("#{kind}_raw".to_sym) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
odeon_uk-4.0.1 | rake/fixture_creator.rb |
odeon_uk-4.0.0 | rake/fixture_creator.rb |