marvel_explorer 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +16 -0
  3. data/.rspec +3 -0
  4. data/.travis.yml +7 -0
  5. data/Gemfile +4 -0
  6. data/Guardfile +38 -0
  7. data/LICENSE.md +22 -0
  8. data/LICENSE.txt +22 -0
  9. data/README.md +48 -0
  10. data/Rakefile +7 -0
  11. data/bin/marvel_explorer +4 -0
  12. data/config/defaults.yml +2 -0
  13. data/config.yml +3 -0
  14. data/lib/marvel_explorer/characters.rb +39 -0
  15. data/lib/marvel_explorer/cli.rb +62 -0
  16. data/lib/marvel_explorer/comic.rb +19 -0
  17. data/lib/marvel_explorer/explorer.rb +23 -0
  18. data/lib/marvel_explorer/git.rb +19 -0
  19. data/lib/marvel_explorer/helpers.rb +17 -0
  20. data/lib/marvel_explorer/rankings.rb +29 -0
  21. data/lib/marvel_explorer/twitter.rb +29 -0
  22. data/lib/marvel_explorer/version.rb +3 -0
  23. data/lib/marvel_explorer/yamlise.rb +76 -0
  24. data/lib/marvel_explorer.rb +19 -0
  25. data/marvel_explorer.gemspec +35 -0
  26. data/spec/cassettes/MarvelExplorer_Explorer/should_extract_the_year_correctly.yml +136 -0
  27. data/spec/cassettes/MarvelExplorer_Explorer/should_generate_a_commit_message.yml +255 -0
  28. data/spec/cassettes/MarvelExplorer_Explorer/should_generate_a_tweet_message.yml +255 -0
  29. data/spec/cassettes/MarvelExplorer_Explorer/should_generate_correct_yaml.yml +255 -0
  30. data/spec/cassettes/MarvelExplorer_Explorer/should_get_the_default_start_character.yml +255 -0
  31. data/spec/cassettes/MarvelExplorer_Explorer/should_get_the_end_character_from_the_comic.yml +255 -0
  32. data/spec/cassettes/MarvelExplorer_Explorer/should_load_the_stored_character.yml +255 -0
  33. data/spec/cassettes/MarvelExplorer_Explorer/should_save_the_end_character.yml +255 -0
  34. data/spec/cassettes/MarvelExplorer_Explorer/should_select_a_comic_for_the_start_character.yml +255 -0
  35. data/spec/characters_spec.rb +52 -0
  36. data/spec/explorer_spec.rb +20 -0
  37. data/spec/fixtures/double-shot-characters.json +2278 -0
  38. data/spec/fixtures/hulk_comics.json +1 -0
  39. data/spec/fixtures/last.character +7 -0
  40. data/spec/fixtures/spider-man.json +1 -0
  41. data/spec/fixtures/viper.json +1 -0
  42. data/spec/git_spec.rb +24 -0
  43. data/spec/rankings_spec.rb +59 -0
  44. data/spec/spec_helper.rb +98 -0
  45. data/spec/support/vcr_setup.rb +18 -0
  46. data/spec/tweet_spec.rb +24 -0
  47. data/spec/yaml_spec.rb +38 -0
  48. metadata +295 -0
@@ -0,0 +1 @@
1
+ {"code":200,"status":"Ok","copyright":"© 2014 MARVEL","attributionText":"Data provided by Marvel. © 2014 MARVEL","attributionHTML":"<a href=\"http://marvel.com\">Data provided by Marvel. © 2014 MARVEL</a>","etag":"a8ce7a020323a62918aa7f07ce20fe4186d78864","data":{"offset":351,"limit":1,"total":1062,"count":1,"results":[{"id":19843,"digitalId":6393,"title":"Marvel Double Shot (2003) #2","issueNumber":2,"variantDescription":"","description":null,"modified":"-0001-11-30T00:00:00-0500","isbn":"","upc":"","diamondCode":"","ean":"","issn":"","format":"Comic","pageCount":0,"textObjects":[],"resourceURI":"http://gateway.marvel.com/v1/public/comics/19843","urls":[{"type":"detail","url":"http://marvel.com/comics/issue/19843/marvel_double_shot_2003_2?utm_campaign=apiRef&utm_source=c928698f3287cd8ee139710b8e84237c"},{"type":"reader","url":"http://marvel.com/digitalcomics/view.htm?iid=6393&utm_campaign=apiRef&utm_source=c928698f3287cd8ee139710b8e84237c"}],"series":{"resourceURI":"http://gateway.marvel.com/v1/public/series/3720","name":"Marvel Double Shot (2003)"},"variants":[],"collections":[],"collectedIssues":[],"dates":[{"type":"onsaleDate","date":"2003-02-10T00:00:00-0500"},{"type":"focDate","date":"-0001-11-30T00:00:00-0500"},{"type":"unlimitedDate","date":"2010-07-13T00:00:00-0400"}],"prices":[{"type":"printPrice","price":0}],"thumbnail":{"path":"http://i.annihil.us/u/prod/marvel/i/mg/b/f0/4c3649b0f2abd","extension":"jpg"},"images":[{"path":"http://i.annihil.us/u/prod/marvel/i/mg/b/f0/4c3649b0f2abd","extension":"jpg"}],"creators":{"available":16,"collectionURI":"http://gateway.marvel.com/v1/public/comics/19843/creators","items":[{"resourceURI":"http://gateway.marvel.com/v1/public/creators/6694","name":"Wes Abbot","role":"letterer"},{"resourceURI":"http://gateway.marvel.com/v1/public/creators/4210","name":"Paul Tutrone","role":"letterer"},{"resourceURI":"http://gateway.marvel.com/v1/public/creators/6663","name":"Chris Ungar","role":"letterer"},{"resourceURI":"http://gateway.marvel.com/v1/public/creators/4014","name":"Axel Alonso","role":"editor"},{"resourceURI":"http://gateway.marvel.com/v1/public/creators/2133","name":"Tom Brevoort","role":"editor"},{"resourceURI":"http://gateway.marvel.com/v1/public/creators/4371","name":"Andy Schmidt","role":"editor"},{"resourceURI":"http://gateway.marvel.com/v1/public/creators/718","name":"Marc Sumerak","role":"editor"},{"resourceURI":"http://gateway.marvel.com/v1/public/creators/312","name":"Mike Deodato","role":"penciler"},{"resourceURI":"http://gateway.marvel.com/v1/public/creators/334","name":"Joe Jusko","role":"penciler"},{"resourceURI":"http://gateway.marvel.com/v1/public/creators/6662","name":"Bill Morrison","role":"penciler"},{"resourceURI":"http://gateway.marvel.com/v1/public/creators/272","name":"Paolo Rivera","role":"penciler"},{"resourceURI":"http://gateway.marvel.com/v1/public/creators/4258","name":"Studio F","role":"colorist"},{"resourceURI":"http://gateway.marvel.com/v1/public/creators/6664","name":"Nathan Kane","role":"colorist"},{"resourceURI":"http://gateway.marvel.com/v1/public/creators/52","name":"Bruce Jones","role":"writer"},{"resourceURI":"http://gateway.marvel.com/v1/public/creators/2630","name":"James Owsley","role":"writer"},{"resourceURI":"http://gateway.marvel.com/v1/public/creators/110","name":"Christopher Priest","role":"writer"}],"returned":16},"characters":{"available":6,"collectionURI":"http://gateway.marvel.com/v1/public/comics/19843/characters","items":[{"resourceURI":"http://gateway.marvel.com/v1/public/characters/1009165","name":"Avengers"},{"resourceURI":"http://gateway.marvel.com/v1/public/characters/1009281","name":"Doctor Doom"},{"resourceURI":"http://gateway.marvel.com/v1/public/characters/1009351","name":"Hulk"},{"resourceURI":"http://gateway.marvel.com/v1/public/characters/1009368","name":"Iron Man"},{"resourceURI":"http://gateway.marvel.com/v1/public/characters/1009407","name":"Loki"},{"resourceURI":"http://gateway.marvel.com/v1/public/characters/1009664","name":"Thor"}],"returned":6},"stories":{"available":4,"collectionURI":"http://gateway.marvel.com/v1/public/comics/19843/stories","items":[{"resourceURI":"http://gateway.marvel.com/v1/public/stories/42520","name":"Cover #42520","type":"cover"},{"resourceURI":"http://gateway.marvel.com/v1/public/stories/42521","name":"Masks","type":"interiorStory"},{"resourceURI":"http://gateway.marvel.com/v1/public/stories/42522","name":"The Roots of All Evil","type":"interiorStory"},{"resourceURI":"http://gateway.marvel.com/v1/public/stories/42523","name":"Incredible Hulk (Vol. 3) #50","type":"promo"}],"returned":4},"events":{"available":0,"collectionURI":"http://gateway.marvel.com/v1/public/comics/19843/events","items":[],"returned":0}}]}}
@@ -0,0 +1,7 @@
1
+ U:OpenStruct{:idi
2
+ items;T[{I"resourceURI;TI"5http://gateway.marvel.com/v1/public/comics/42539;TI" name;TI"DAge of Apocalypse (2011) #2 (Avengers Art Appreciation Variant);T{I"resourceURI;TI"5http://gateway.marvel.com/v1/public/comics/38523;TI" name;TI"!Age of X: Universe (2011) #2;T{I"resourceURI;TI"5http://gateway.marvel.com/v1/public/comics/37278;TI" name;TI"Alias (2003) #4;T{I"resourceURI;TI"5http://gateway.marvel.com/v1/public/comics/37255;TI" name;TI"Alias Omnibus (Hardcover);T{I"resourceURI;TI"5http://gateway.marvel.com/v1/public/comics/12766;TI" name;TI"Alpha Flight (1983) #99;T{I"resourceURI;TI"5http://gateway.marvel.com/v1/public/comics/12639;TI" name;TI"Alpha Flight (1983) #100;T{I"resourceURI;TI"5http://gateway.marvel.com/v1/public/comics/12640;TI" name;TI"Alpha Flight (1983) #101;T{I"resourceURI;TI"5http://gateway.marvel.com/v1/public/comics/37894;TI" name;TI"!Amazing Spider-Man (1999) #1;T{I"resourceURI;TI"5http://gateway.marvel.com/v1/public/comics/37902;TI" name;TI"!Amazing Spider-Man (1999) #7;T{I"resourceURI;TI"4http://gateway.marvel.com/v1/public/comics/1868;TI" name;TI"#Amazing Spider-Man (1999) #519;T{I"resourceURI;TI"5http://gateway.marvel.com/v1/public/comics/24407;TI" name;TI"#Amazing Spider-Man (1999) #600;T{I"resourceURI;TI"5http://gateway.marvel.com/v1/public/comics/29303;TI" name;TI":Amazing Spider-Man (1999) #600 (2ND PRINTING VARIANT);T{I"resourceURI;TI"5http://gateway.marvel.com/v1/public/comics/34135;TI" name;TI"#Amazing Spider-Man (1999) #648;T{I"resourceURI;TI"5http://gateway.marvel.com/v1/public/comics/38844;TI" name;TI":Amazing Spider-Man (1999) #648 (2ND PRINTING VARIANT);T{I"resourceURI;TI"5http://gateway.marvel.com/v1/public/comics/37045;TI" name;TI"5Amazing Spider-Man (1999) #648 (CASELLI VARIANT);T{I"resourceURI;TI"5http://gateway.marvel.com/v1/public/comics/30323;TI" name;TI"6Amazing Spider-Man (1999) #648 (CAMPBELL VARIANT);T{I"resourceURI;TI"5http://gateway.marvel.com/v1/public/comics/36937;TI" name;TI"9Amazing Spider-Man (1999) #648 (BLANK COVER VARIANT);T{I"resourceURI;TI"5http://gateway.marvel.com/v1/public/comics/37073;TI" name;TI"8Amazing Spider-Man (1999) #648 (WRAPAROUND VARIANT);T{I"resourceURI;TI"5http://gateway.marvel.com/v1/public/comics/39291;TI" name;TI"%Amazing Spider-Man (1999) #654.1;T{I"resourceURI;TI"5http://gateway.marvel.com/v1/public/comics/35501;TI" name;TI"#Amazing Spider-Man (1999) #663;TI"
3
+ items;T[{I"resourceURI;TI"5http://gateway.marvel.com/v1/public/series/15331;TI" name;TI"$Age of Apocalypse (2011 - 2013);T{I"resourceURI;TI"5http://gateway.marvel.com/v1/public/series/13896;TI" name;TI"Age of X: Universe (2011);T{I"resourceURI;TI"3http://gateway.marvel.com/v1/public/series/672;TI" name;TI"Alias (2003);T{I"resourceURI;TI"5http://gateway.marvel.com/v1/public/series/13383;TI" name;TI"Alias Omnibus (2006);T{I"resourceURI;TI"4http://gateway.marvel.com/v1/public/series/2116;TI" name;TI"Alpha Flight (1983 - 1994);T{I"resourceURI;TI"3http://gateway.marvel.com/v1/public/series/454;TI" name;TI"%Amazing Spider-Man (1999 - 2013);T{I"resourceURI;TI"4http://gateway.marvel.com/v1/public/series/2984;TI" name;TI",Amazing Spider-Man Annual (1964 - 2009);T{I"resourceURI;TI"4http://gateway.marvel.com/v1/public/series/1489;TI" name;TI"4Amazing Spider-Man Vol. 10: New Avengers (2005);T{I"resourceURI;TI"3http://gateway.marvel.com/v1/public/series/744;TI" name;TI"'Astonishing X-Men (2004 - Present);T{I"resourceURI;TI"5http://gateway.marvel.com/v1/public/series/10030;TI" name;TI"Atlantis Attacks (2011);T{I"resourceURI;TI"5http://gateway.marvel.com/v1/public/series/10031;TI" name;TI"&Atlantis Attacks (DM Only) (2011);T{I"resourceURI;TI"4http://gateway.marvel.com/v1/public/series/9085;TI" name;TI"Avengers (2010 - 2012);T{I"resourceURI;TI"4http://gateway.marvel.com/v1/public/series/1991;TI" name;TI"Avengers (1963 - 1996);T{I"resourceURI;TI"4http://gateway.marvel.com/v1/public/series/3621;TI" name;TI"Avengers (1996 - 1997);T{I"resourceURI;TI"3http://gateway.marvel.com/v1/public/series/354;TI" name;TI"Avengers (1998 - 2004);T{I"resourceURI;TI"5http://gateway.marvel.com/v1/public/series/10035;TI" name;TI",Avengers & the Infinity Gauntlet (2011);T{I"resourceURI;TI"4http://gateway.marvel.com/v1/public/series/9859;TI" name;TI",Avengers & the Infinity Gauntlet (2010);T{I"resourceURI;TI"4http://gateway.marvel.com/v1/public/series/9086;TI" name;TI"#Avengers Academy (2010 - 2012);T{I"resourceURI;TI"4http://gateway.marvel.com/v1/public/series/1988;TI" name;TI""Avengers Annual (1967 - 1994);T{I"resourceURI;TI"5http://gateway.marvel.com/v1/public/series/15373;TI" name;TI"'Avengers Assemble (2012 - Present);TI"
4
+ items;T[{I"resourceURI;TI"4http://gateway.marvel.com/v1/public/stories/490;TI" name;TI"Interior #490;TI" type;TI"interiorStory;T{I"resourceURI;TI"4http://gateway.marvel.com/v1/public/stories/542;TI" name;TI"Interior #542;TI" type;TI"interiorStory;T{I"resourceURI;TI"4http://gateway.marvel.com/v1/public/stories/572;TI" name;TI"Interior #572;TI" type;TI"interiorStory;T{I"resourceURI;TI"4http://gateway.marvel.com/v1/public/stories/574;TI" name;TI"Interior #574;TI" type;TI"interiorStory;T{I"resourceURI;TI"4http://gateway.marvel.com/v1/public/stories/575;TI" name;TI"Interior #575;TI" type;TI"interiorStory;T{I"resourceURI;TI"4http://gateway.marvel.com/v1/public/stories/577;TI" name;TI"Interior #577;TI" type;TI"interiorStory;T{I"resourceURI;TI"4http://gateway.marvel.com/v1/public/stories/579;TI" name;TI"Interior #579;TI" type;TI"interiorStory;T{I"resourceURI;TI"4http://gateway.marvel.com/v1/public/stories/580;TI" name;TI"Interior #580;TI" type;TI"interiorStory;T{I"resourceURI;TI"4http://gateway.marvel.com/v1/public/stories/892;TI" name;TI"Cover #892;TI" type;TI"
5
+ cover;T{I"resourceURI;TI"5http://gateway.marvel.com/v1/public/stories/1025;TI" name;TI"Interior #1025;TI" type;TI"interiorStory;T{I"resourceURI;TI"5http://gateway.marvel.com/v1/public/stories/1027;TI" name;TI"Interior #1027;TI" type;TI"interiorStory;T{I"resourceURI;TI"5http://gateway.marvel.com/v1/public/stories/1029;TI" name;TI"Interior #1029;TI" type;TI"interiorStory;T{I"resourceURI;TI"5http://gateway.marvel.com/v1/public/stories/1031;TI" name;TI"Interior #1031;TI" type;TI"interiorStory;T{I"resourceURI;TI"5http://gateway.marvel.com/v1/public/stories/1039;TI" name;TI"Interior #1039;TI" type;TI"interiorStory;T{I"resourceURI;TI"5http://gateway.marvel.com/v1/public/stories/1041;TI" name;TI"Avengers (1998) #502;TI" type;TI"interiorStory;T{I"resourceURI;TI"5http://gateway.marvel.com/v1/public/stories/1043;TI" name;TI"Interior #1043;TI" type;TI"interiorStory;T{I"resourceURI;TI"5http://gateway.marvel.com/v1/public/stories/1055;TI" name;TI"Interior #1055;TI" type;TI"interiorStory;T{I"resourceURI;TI"5http://gateway.marvel.com/v1/public/stories/1164;TI" name;TI"1 of 5 - New Avengers;TI" type;TI"interiorStory;T{I"resourceURI;TI"5http://gateway.marvel.com/v1/public/stories/1650;TI" name;TI"Interior #1650;TI" type;TI"interiorStory;T{I"resourceURI;TI"5http://gateway.marvel.com/v1/public/stories/1948;TI" name;TI"Interior #1948;TI" type;TI"interiorStory;TI"
6
+ items;T[{I"resourceURI;TI"3http://gateway.marvel.com/v1/public/events/116;TI" name;TI"Acts of Vengeance!;T{I"resourceURI;TI"3http://gateway.marvel.com/v1/public/events/303;TI" name;TI"
7
+ Siege;TI"
@@ -0,0 +1 @@
1
+ {"code":200,"status":"Ok","copyright":"© 2014 MARVEL","attributionText":"Data provided by Marvel. © 2014 MARVEL","attributionHTML":"<a href=\"http://marvel.com\">Data provided by Marvel. © 2014 MARVEL</a>","etag":"2198e89529e6addae312acd1cdd2f697f2cb527c","data":{"offset":0,"limit":20,"total":1,"count":1,"results":[{"id":1009610,"name":"Spider-Man","description":"Bitten by a radioactive spider, high school student Peter Parker gained the speed, strength and powers of a spider. Adopting the name Spider-Man, Peter hoped to start a career using his new abilities. Taught that with great power comes great responsibility, Spidey has vowed to use his powers to help people.","modified":"2014-06-02T12:35:16-0400","thumbnail":{"path":"http://i.annihil.us/u/prod/marvel/i/mg/3/50/526548a343e4b","extension":"jpg"},"resourceURI":"http://gateway.marvel.com/v1/public/characters/1009610","comics":{"available":2575,"collectionURI":"http://gateway.marvel.com/v1/public/characters/1009610/comics","items":[{"resourceURI":"http://gateway.marvel.com/v1/public/comics/43495","name":"A+X (2012) #2"},{"resourceURI":"http://gateway.marvel.com/v1/public/comics/320","name":"Actor Presents Spider-Man and the Incredible Hulk (2003) #1"},{"resourceURI":"http://gateway.marvel.com/v1/public/comics/30885","name":"Age of Heroes (Trade Paperback)"},{"resourceURI":"http://gateway.marvel.com/v1/public/comics/37257","name":"Alias (2003) #10"},{"resourceURI":"http://gateway.marvel.com/v1/public/comics/37262","name":"Alias (2003) #15"},{"resourceURI":"http://gateway.marvel.com/v1/public/comics/37255","name":"Alias Omnibus (Hardcover)"},{"resourceURI":"http://gateway.marvel.com/v1/public/comics/12637","name":"Alpha Flight (1983) #1"},{"resourceURI":"http://gateway.marvel.com/v1/public/comics/12668","name":"Alpha Flight (1983) #127"},{"resourceURI":"http://gateway.marvel.com/v1/public/comics/6233","name":"Alpha Flight Classic Vol. 1 (Trade Paperback)"},{"resourceURI":"http://gateway.marvel.com/v1/public/comics/16926","name":"Amazing Fantasy (1962) #15"},{"resourceURI":"http://gateway.marvel.com/v1/public/comics/16214","name":"Amazing Fantasy Omnibus (Hardcover)"},{"resourceURI":"http://gateway.marvel.com/v1/public/comics/5286","name":"Amazing Spider-Girl (2006)"},{"resourceURI":"http://gateway.marvel.com/v1/public/comics/16151","name":"Amazing Spider-Girl (2006) #11"},{"resourceURI":"http://gateway.marvel.com/v1/public/comics/13519","name":"Amazing Spider-Girl Vol. 1: Whatever Happened to the Daughter of Spider-Man (Trade Paperback)"},{"resourceURI":"http://gateway.marvel.com/v1/public/comics/17305","name":"Amazing Spider-Girl Vol. 2: Comes the Carnage! (Trade Paperback)"},{"resourceURI":"http://gateway.marvel.com/v1/public/comics/37894","name":"Amazing Spider-Man (1999) #1"},{"resourceURI":"http://gateway.marvel.com/v1/public/comics/6482","name":"Amazing Spider-Man (1963) #1"},{"resourceURI":"http://gateway.marvel.com/v1/public/comics/6593","name":"Amazing Spider-Man (1963) #2"},{"resourceURI":"http://gateway.marvel.com/v1/public/comics/37895","name":"Amazing Spider-Man (1999) #2"},{"resourceURI":"http://gateway.marvel.com/v1/public/comics/37896","name":"Amazing Spider-Man (1999) #3"}],"returned":20},"series":{"available":531,"collectionURI":"http://gateway.marvel.com/v1/public/characters/1009610/series","items":[{"resourceURI":"http://gateway.marvel.com/v1/public/series/16450","name":"A+X (2012 - Present)"},{"resourceURI":"http://gateway.marvel.com/v1/public/series/458","name":"Actor Presents Spider-Man and the Incredible Hulk (2003)"},{"resourceURI":"http://gateway.marvel.com/v1/public/series/10235","name":"Age of Heroes (2011)"},{"resourceURI":"http://gateway.marvel.com/v1/public/series/672","name":"Alias (2003)"},{"resourceURI":"http://gateway.marvel.com/v1/public/series/13383","name":"Alias Omnibus (2006)"},{"resourceURI":"http://gateway.marvel.com/v1/public/series/2116","name":"Alpha Flight (1983 - 1994)"},{"resourceURI":"http://gateway.marvel.com/v1/public/series/1983","name":"Alpha Flight Classic Vol. 1 (2007)"},{"resourceURI":"http://gateway.marvel.com/v1/public/series/2987","name":"Amazing Fantasy (1962)"},{"resourceURI":"http://gateway.marvel.com/v1/public/series/2707","name":"Amazing Fantasy Omnibus (2007)"},{"resourceURI":"http://gateway.marvel.com/v1/public/series/1126","name":"Amazing Spider-Girl (2006 - 2009)"},{"resourceURI":"http://gateway.marvel.com/v1/public/series/2234","name":"Amazing Spider-Girl Vol. 1: Whatever Happened to the Daughter of Spider-Man (2007)"},{"resourceURI":"http://gateway.marvel.com/v1/public/series/3101","name":"Amazing Spider-Girl Vol. 2: Comes the Carnage! (2007)"},{"resourceURI":"http://gateway.marvel.com/v1/public/series/1987","name":"Amazing Spider-Man (1963 - 1998)"},{"resourceURI":"http://gateway.marvel.com/v1/public/series/17285","name":"Amazing Spider-Man (2014 - Present)"},{"resourceURI":"http://gateway.marvel.com/v1/public/series/454","name":"Amazing Spider-Man (1999 - 2013)"},{"resourceURI":"http://gateway.marvel.com/v1/public/series/9802","name":"Amazing Spider-Man Annual (2010)"},{"resourceURI":"http://gateway.marvel.com/v1/public/series/13205","name":"Amazing Spider-Man Annual (2011)"},{"resourceURI":"http://gateway.marvel.com/v1/public/series/5958","name":"Amazing Spider-Man Annual (2008)"},{"resourceURI":"http://gateway.marvel.com/v1/public/series/2984","name":"Amazing Spider-Man Annual (1964 - 2009)"},{"resourceURI":"http://gateway.marvel.com/v1/public/series/5376","name":"Amazing Spider-Man Family (2008 - 2009)"}],"returned":20},"stories":{"available":4165,"collectionURI":"http://gateway.marvel.com/v1/public/characters/1009610/stories","items":[{"resourceURI":"http://gateway.marvel.com/v1/public/stories/483","name":"Interior #483","type":"interiorStory"},{"resourceURI":"http://gateway.marvel.com/v1/public/stories/486","name":"Cover #486","type":"cover"},{"resourceURI":"http://gateway.marvel.com/v1/public/stories/487","name":"Interior #487","type":"interiorStory"},{"resourceURI":"http://gateway.marvel.com/v1/public/stories/499","name":"Interior #499","type":"interiorStory"},{"resourceURI":"http://gateway.marvel.com/v1/public/stories/599","name":"Interior #599","type":"interiorStory"},{"resourceURI":"http://gateway.marvel.com/v1/public/stories/805","name":"Interior #805","type":"interiorStory"},{"resourceURI":"http://gateway.marvel.com/v1/public/stories/824","name":"Cover #824","type":"cover"},{"resourceURI":"http://gateway.marvel.com/v1/public/stories/838","name":"3 of 3 - Family Business","type":"cover"},{"resourceURI":"http://gateway.marvel.com/v1/public/stories/842","name":"1 of 1 - Secret of the Spider Shop","type":"cover"},{"resourceURI":"http://gateway.marvel.com/v1/public/stories/867","name":"Interior #867","type":"interiorStory"},{"resourceURI":"http://gateway.marvel.com/v1/public/stories/1018","name":"Cover #1018","type":"cover"},{"resourceURI":"http://gateway.marvel.com/v1/public/stories/1019","name":"Interior #1019","type":"interiorStory"},{"resourceURI":"http://gateway.marvel.com/v1/public/stories/1020","name":"Cover #1020","type":"cover"},{"resourceURI":"http://gateway.marvel.com/v1/public/stories/1021","name":"Interior #1021","type":"interiorStory"},{"resourceURI":"http://gateway.marvel.com/v1/public/stories/1022","name":"Cover #1022","type":"cover"},{"resourceURI":"http://gateway.marvel.com/v1/public/stories/1023","name":"Interior #1023","type":"interiorStory"},{"resourceURI":"http://gateway.marvel.com/v1/public/stories/1076","name":"4 of 4 - Golden Age","type":"cover"},{"resourceURI":"http://gateway.marvel.com/v1/public/stories/1125","name":"6 of 6 - Sins Past","type":"cover"},{"resourceURI":"http://gateway.marvel.com/v1/public/stories/1126","name":"6 of 6 - Sins Past","type":"interiorStory"},{"resourceURI":"http://gateway.marvel.com/v1/public/stories/1134","name":"Interior #1134","type":"interiorStory"}],"returned":20},"events":{"available":29,"collectionURI":"http://gateway.marvel.com/v1/public/characters/1009610/events","items":[{"resourceURI":"http://gateway.marvel.com/v1/public/events/116","name":"Acts of Vengeance!"},{"resourceURI":"http://gateway.marvel.com/v1/public/events/233","name":"Atlantis Attacks"},{"resourceURI":"http://gateway.marvel.com/v1/public/events/234","name":"Avengers Disassembled"},{"resourceURI":"http://gateway.marvel.com/v1/public/events/310","name":"Avengers VS X-Men"},{"resourceURI":"http://gateway.marvel.com/v1/public/events/296","name":"Chaos War"},{"resourceURI":"http://gateway.marvel.com/v1/public/events/238","name":"Civil War"},{"resourceURI":"http://gateway.marvel.com/v1/public/events/318","name":"Dark Reign"},{"resourceURI":"http://gateway.marvel.com/v1/public/events/240","name":"Days of Future Present"},{"resourceURI":"http://gateway.marvel.com/v1/public/events/246","name":"Evolutionary War"},{"resourceURI":"http://gateway.marvel.com/v1/public/events/302","name":"Fear Itself"},{"resourceURI":"http://gateway.marvel.com/v1/public/events/251","name":"House of M"},{"resourceURI":"http://gateway.marvel.com/v1/public/events/252","name":"Inferno"},{"resourceURI":"http://gateway.marvel.com/v1/public/events/253","name":"Infinity Gauntlet"},{"resourceURI":"http://gateway.marvel.com/v1/public/events/255","name":"Initiative"},{"resourceURI":"http://gateway.marvel.com/v1/public/events/258","name":"Kraven's Last Hunt"},{"resourceURI":"http://gateway.marvel.com/v1/public/events/151","name":"Maximum Carnage"},{"resourceURI":"http://gateway.marvel.com/v1/public/events/37","name":"Maximum Security"},{"resourceURI":"http://gateway.marvel.com/v1/public/events/154","name":"Onslaught"},{"resourceURI":"http://gateway.marvel.com/v1/public/events/266","name":"Other - Evolve or Die"},{"resourceURI":"http://gateway.marvel.com/v1/public/events/269","name":"Secret Invasion"}],"returned":20},"urls":[{"type":"detail","url":"http://marvel.com/characters/54/spider-man?utm_campaign=apiRef&utm_source=c928698f3287cd8ee139710b8e84237c"},{"type":"wiki","url":"http://marvel.com/universe/Spider-Man_(Peter_Parker)?utm_campaign=apiRef&utm_source=c928698f3287cd8ee139710b8e84237c"},{"type":"comiclink","url":"http://marvel.com/comics/characters/1009610/spider-man?utm_campaign=apiRef&utm_source=c928698f3287cd8ee139710b8e84237c"}]}]}}
@@ -0,0 +1 @@
1
+ {"code":200,"status":"Ok","copyright":"© 2014 MARVEL","attributionText":"Data provided by Marvel. © 2014 MARVEL","attributionHTML":"<a href=\"http://marvel.com\">Data provided by Marvel. © 2014 MARVEL</a>","etag":"16dac99374fa79e0cd9d0423d1053ea0854179ed","data":{"offset":0,"limit":20,"total":1,"count":1,"results":[{"id":1009696,"name":"Viper","description":"After the apparent death of Baron von Strucker, Viper took the name Madame Hydra and took control of the New York-based faction of Hydra.","modified":"2010-12-17T13:24:45-0500","thumbnail":null,"resourceURI":"http://gateway.marvel.com/v1/public/characters/1009696","comics":{"available":40,"collectionURI":"http://gateway.marvel.com/v1/public/characters/1009696/comics","items":[{"resourceURI":"http://gateway.marvel.com/v1/public/comics/23996","name":"Astonishing Tales (2009) #3"},{"resourceURI":"http://gateway.marvel.com/v1/public/comics/7775","name":"Captain America (1968) #394"},{"resourceURI":"http://gateway.marvel.com/v1/public/comics/7777","name":"Captain America (1968) #396"},{"resourceURI":"http://gateway.marvel.com/v1/public/comics/1836","name":"Excalibur (2004) #12"},{"resourceURI":"http://gateway.marvel.com/v1/public/comics/5589","name":"Heroes Reborn: Iron Man (Trade Paperback)"},{"resourceURI":"http://gateway.marvel.com/v1/public/comics/16328","name":"Iron Man (1996) #1"},{"resourceURI":"http://gateway.marvel.com/v1/public/comics/16334","name":"Iron Man (1996) #3"},{"resourceURI":"http://gateway.marvel.com/v1/public/comics/16336","name":"Iron Man (1996) #5"},{"resourceURI":"http://gateway.marvel.com/v1/public/comics/16338","name":"Iron Man (1996) #7"},{"resourceURI":"http://gateway.marvel.com/v1/public/comics/16340","name":"Iron Man (1996) #9"},{"resourceURI":"http://gateway.marvel.com/v1/public/comics/16329","name":"Iron Man (1996) #10"},{"resourceURI":"http://gateway.marvel.com/v1/public/comics/2417","name":"New Avengers (2004) #11"},{"resourceURI":"http://gateway.marvel.com/v1/public/comics/2419","name":"New Avengers (2004) #12"},{"resourceURI":"http://gateway.marvel.com/v1/public/comics/3004","name":"New Avengers (2004) #13"},{"resourceURI":"http://gateway.marvel.com/v1/public/comics/35246","name":"New Avengers (2010) #18"},{"resourceURI":"http://gateway.marvel.com/v1/public/comics/5033","name":"New Avengers Vol. 3: Secrets & Lies (Trade Paperback)"},{"resourceURI":"http://gateway.marvel.com/v1/public/comics/4004","name":"New Avengers Vol.2: Sentry (2006)"},{"resourceURI":"http://gateway.marvel.com/v1/public/comics/22201","name":"Punisher War Journal (1988) #45"},{"resourceURI":"http://gateway.marvel.com/v1/public/comics/22203","name":"Punisher War Journal (1988) #47"},{"resourceURI":"http://gateway.marvel.com/v1/public/comics/24002","name":"Secret Warriors (2008) #3"}],"returned":20},"series":{"available":19,"collectionURI":"http://gateway.marvel.com/v1/public/characters/1009696/series","items":[{"resourceURI":"http://gateway.marvel.com/v1/public/series/6792","name":"Astonishing Tales (2009)"},{"resourceURI":"http://gateway.marvel.com/v1/public/series/1996","name":"Captain America (1968 - 1996)"},{"resourceURI":"http://gateway.marvel.com/v1/public/series/740","name":"Excalibur (2004 - 2005)"},{"resourceURI":"http://gateway.marvel.com/v1/public/series/1814","name":"Heroes Reborn: Iron Man (2006)"},{"resourceURI":"http://gateway.marvel.com/v1/public/series/13577","name":"Iron Man (1996 - 1998)"},{"resourceURI":"http://gateway.marvel.com/v1/public/series/753","name":"New Avengers (2004 - 2010)"},{"resourceURI":"http://gateway.marvel.com/v1/public/series/9922","name":"New Avengers (2010 - 2012)"},{"resourceURI":"http://gateway.marvel.com/v1/public/series/1446","name":"New Avengers Vol. 3: Secrets & Lies (2006)"},{"resourceURI":"http://gateway.marvel.com/v1/public/series/367","name":"New Avengers Vol.2: Sentry (2006)"},{"resourceURI":"http://gateway.marvel.com/v1/public/series/5860","name":"Punisher War Journal (1988 - 1995)"},{"resourceURI":"http://gateway.marvel.com/v1/public/series/6796","name":"Secret Warriors (2008 - 2011)"},{"resourceURI":"http://gateway.marvel.com/v1/public/series/2258","name":"Uncanny X-Men (1963 - 2011)"},{"resourceURI":"http://gateway.marvel.com/v1/public/series/2262","name":"Wolverine (1988 - 2003)"},{"resourceURI":"http://gateway.marvel.com/v1/public/series/1849","name":"Wolverine by Claremont & Miller (2006)"},{"resourceURI":"http://gateway.marvel.com/v1/public/series/7056","name":"Wolverine by Claremont & Miller (2009 - Present)"},{"resourceURI":"http://gateway.marvel.com/v1/public/series/85","name":"Wolverine: The Best There Is (1999)"},{"resourceURI":"http://gateway.marvel.com/v1/public/series/2265","name":"X-Men (1991 - 2001)"},{"resourceURI":"http://gateway.marvel.com/v1/public/series/646","name":"X-Treme X-Men (2001 - 2004)"},{"resourceURI":"http://gateway.marvel.com/v1/public/series/143","name":"X-Treme X-Men Vol. II (1999)"}],"returned":19},"stories":{"available":34,"collectionURI":"http://gateway.marvel.com/v1/public/characters/1009696/stories","items":[{"resourceURI":"http://gateway.marvel.com/v1/public/stories/3261","name":"2 of 2 - Save the Life of My Child","type":"cover"},{"resourceURI":"http://gateway.marvel.com/v1/public/stories/3465","name":"1 of 3 - Ronin","type":"cover"},{"resourceURI":"http://gateway.marvel.com/v1/public/stories/3467","name":"2 of 3 - Ronin","type":"cover"},{"resourceURI":"http://gateway.marvel.com/v1/public/stories/3475","name":"3 of 3 - Ronin","type":"cover"},{"resourceURI":"http://gateway.marvel.com/v1/public/stories/18092","name":"The Crimson Crusade","type":"interiorStory"},{"resourceURI":"http://gateway.marvel.com/v1/public/stories/18098","name":"Trick Or Treat","type":"interiorStory"},{"resourceURI":"http://gateway.marvel.com/v1/public/stories/27452","name":"A Whiff of Sartre's Madeline!","type":"interiorStory"},{"resourceURI":"http://gateway.marvel.com/v1/public/stories/27854","name":"Scarlet In Glory","type":"interiorStory"},{"resourceURI":"http://gateway.marvel.com/v1/public/stories/27856","name":"To Have and Have Not","type":"interiorStory"},{"resourceURI":"http://gateway.marvel.com/v1/public/stories/28619","name":"Cover #28619","type":"cover"},{"resourceURI":"http://gateway.marvel.com/v1/public/stories/28621","name":"Sabretooth is Back--But What Secret Makes Him Invincible?","type":"cover"},{"resourceURI":"http://gateway.marvel.com/v1/public/stories/28622","name":"Blood Wedding","type":"interiorStory"},{"resourceURI":"http://gateway.marvel.com/v1/public/stories/28626","name":"Green For Death","type":"interiorStory"},{"resourceURI":"http://gateway.marvel.com/v1/public/stories/28628","name":"Survival of the Fittest Part 1: Whatever It Takes...","type":"interiorStory"},{"resourceURI":"http://gateway.marvel.com/v1/public/stories/28716","name":"Bloodsport Part 2","type":"interiorStory"},{"resourceURI":"http://gateway.marvel.com/v1/public/stories/28718","name":"Bloodsport Part 3","type":"interiorStory"},{"resourceURI":"http://gateway.marvel.com/v1/public/stories/29304","name":"X-Villains","type":"pinup"},{"resourceURI":"http://gateway.marvel.com/v1/public/stories/30531","name":"Keys of the Kingdom","type":"interiorStory"},{"resourceURI":"http://gateway.marvel.com/v1/public/stories/30533","name":"Beachhead !","type":"interiorStory"},{"resourceURI":"http://gateway.marvel.com/v1/public/stories/30535","name":"Second Front !","type":"interiorStory"}],"returned":20},"events":{"available":1,"collectionURI":"http://gateway.marvel.com/v1/public/characters/1009696/events","items":[{"resourceURI":"http://gateway.marvel.com/v1/public/events/318","name":"Dark Reign"}],"returned":1},"urls":[{"type":"detail","url":"http://marvel.com/characters/2495/viper?utm_campaign=apiRef&utm_source=c928698f3287cd8ee139710b8e84237c"},{"type":"wiki","url":"http://marvel.com/universe/Viper_(Madame_Hydra)?utm_campaign=apiRef&utm_source=c928698f3287cd8ee139710b8e84237c"},{"type":"comiclink","url":"http://marvel.com/comics/characters/1009696/viper?utm_campaign=apiRef&utm_source=c928698f3287cd8ee139710b8e84237c"}]}]}}
data/spec/git_spec.rb ADDED
@@ -0,0 +1,24 @@
1
+ require 'spec_helper'
2
+
3
+ module MarvelExplorer
4
+ describe Explorer do
5
+ before :each do
6
+ Timecop.freeze '2014-12-03T19:01:00+00:00'
7
+ FileUtils.rm_rf 'tmp/'
8
+ @me = Explorer.new 'config.yml'
9
+ end
10
+
11
+ after :each do
12
+ Timecop.return
13
+ end
14
+
15
+ it 'should generate a commit message', :vcr do
16
+ @me.config['marshal_file'] = '/dev/null'
17
+ stub_request(:get, /gateway.marvel.com\/v1\/public\/characters\/1009351\/comics/)
18
+ .to_return(status: 200, body: File.read('spec/fixtures/hulk_comics.json'))
19
+ stub_request(:get, /gateway.marvel.com\/v1\/public\/comics\/19843\/characters/)
20
+ .to_return(status: 200, body: File.read('spec/fixtures/double-shot-characters.json'))
21
+ expect(@me.commit_message).to eq 'Hulk -> Marvel Double Shot -> Avengers'
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,59 @@
1
+ require 'spec_helper'
2
+
3
+ module MarvelExplorer
4
+ describe Explorer do
5
+ before :each do
6
+ FileUtils.rm_rf 'tmp/'
7
+ @me = Explorer.new 'config.yml'
8
+ @me.config['marshal_file'] = '/dev/null'
9
+
10
+ @repopath = 'tmp/marvelexplorer'
11
+ unless File.exists? '%s/index.html' % @repopath
12
+ FileUtils.rm_rf @repopath
13
+ g = Git.clone 'https://github.com/marvelexplorer/marvelexplorer.github.io', @repopath
14
+ g.checkout 'af8bdcbda93eabb4c1c3eb989e4c9ad4a3d78539'
15
+ end
16
+ end
17
+
18
+ it 'should rank correctly', :vcr do
19
+ expect(@me.calculate_rankings repo: @repopath).to eq [
20
+ { 'name' => 'Spider-Man', 'score' => 13 },
21
+ { 'name' => 'X-Men', 'score' => 13 },
22
+ { 'name' => 'Wolverine', 'score' => 6 },
23
+ { 'name' => 'Fantastic Four', 'score' => 5 },
24
+ { 'name' => 'Beast', 'score' => 4 }
25
+ ]
26
+
27
+ expect(@me.calculate_rankings repo: @repopath, commits: 96).to eq [
28
+ { 'name' => 'X-Men', 'score' => 6 },
29
+ { 'name' => 'Spider-Man', 'score' => 5 },
30
+ { 'name' => 'Colossus', 'score' => 3 },
31
+ { 'name' => 'Fantastic Four', 'score' => 3 },
32
+ { 'name' => 'Wolverine', 'score' => 3 }
33
+ ]
34
+
35
+ expect(@me.calculate_rankings repo: @repopath, commits: 1). to eq [
36
+ { 'name' => 'Cable', 'score' => 1 }
37
+ ]
38
+
39
+ expect(@me.calculate_rankings repo: @repopath, commits: 672, limit: 10). to eq [
40
+ { 'name' => 'Spider-Man', 'score' => 13 },
41
+ { 'name' => 'X-Men', 'score' => 13 },
42
+ { 'name' => 'Wolverine', 'score' => 6 },
43
+ { 'name' => 'Fantastic Four', 'score' => 5 },
44
+ { 'name' => 'Beast', 'score' => 4 },
45
+ { 'name' => 'Colossus', 'score' => 4 },
46
+ { 'name' => 'Havok', 'score' => 4 },
47
+ { 'name' => 'Gambit', 'score' => 3 },
48
+ { 'name' => 'Rogue', 'score' => 3 },
49
+ { 'name' => 'Polaris', 'score' => 3 }
50
+ ]
51
+ end
52
+
53
+ it 'should write ranking yaml', :vcr do
54
+ @me.rankings repo: @repopath, commits: 96
55
+ yaml = YAML.load File.read '%s/_data/rankings_96.yml' % @me.config['jekyll_dir']
56
+ expect(yaml[0]['name']).to eq 'X-Men'
57
+ end
58
+ end
59
+ end
@@ -0,0 +1,98 @@
1
+ require 'timecop'
2
+ require 'marvel_explorer'
3
+ require_relative 'support/vcr_setup'
4
+ require 'webmock/rspec'
5
+ require 'fileutils'
6
+
7
+ # This file was generated by the `rspec --init` command. Conventionally, all
8
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
9
+ # The generated `.rspec` file contains `--require spec_helper` which will cause this
10
+ # file to always be loaded, without a need to explicitly require it in any files.
11
+ #
12
+ # Given that it is always loaded, you are encouraged to keep this file as
13
+ # light-weight as possible. Requiring heavyweight dependencies from this file
14
+ # will add to the boot time of your test suite on EVERY test run, even for an
15
+ # individual file that may not need all of that loaded. Instead, consider making
16
+ # a separate helper file that requires the additional dependencies and performs
17
+ # the additional setup, and require it from the spec files that actually need it.
18
+ #
19
+ # The `.rspec` file also contains a few flags that are not defaults but that
20
+ # users commonly want.
21
+ #
22
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
23
+ RSpec.configure do |config|
24
+ # rspec-expectations config goes here. You can use an alternate
25
+ # assertion/expectation library such as wrong or the stdlib/minitest
26
+ # assertions if you prefer.
27
+ config.expect_with :rspec do |expectations|
28
+ # This option will default to `true` in RSpec 4. It makes the `description`
29
+ # and `failure_message` of custom matchers include text for helper methods
30
+ # defined using `chain`, e.g.:
31
+ # be_bigger_than(2).and_smaller_than(4).description
32
+ # # => "be bigger than 2 and smaller than 4"
33
+ # ...rather than:
34
+ # # => "be bigger than 2"
35
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
36
+ end
37
+
38
+ # rspec-mocks config goes here. You can use an alternate test double
39
+ # library (such as bogus or mocha) by changing the `mock_with` option here.
40
+ config.mock_with :rspec do |mocks|
41
+ # Prevents you from mocking or stubbing a method that does not exist on
42
+ # a real object. This is generally recommended, and will default to
43
+ # `true` in RSpec 4.
44
+ mocks.verify_partial_doubles = true
45
+ end
46
+
47
+ config.order = :random
48
+ config.filter_run :focus
49
+ config.run_all_when_everything_filtered = true
50
+ # The settings below are suggested to provide a good initial experience
51
+ # with RSpec, but feel free to customize to your heart's content.
52
+ =begin
53
+ # These two settings work together to allow you to limit a spec run
54
+ # to individual examples or groups you care about by tagging them with
55
+ # `:focus` metadata. When nothing is tagged with `:focus`, all examples
56
+ # get run.
57
+ config.filter_run :focus
58
+ config.run_all_when_everything_filtered = true
59
+
60
+ # Limits the available syntax to the non-monkey patched syntax that is recommended.
61
+ # For more details, see:
62
+ # - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
63
+ # - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
64
+ # - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching
65
+ config.disable_monkey_patching!
66
+
67
+ # This setting enables warnings. It's recommended, but in some cases may
68
+ # be too noisy due to issues in dependencies.
69
+ config.warnings = true
70
+
71
+ # Many RSpec users commonly either run the entire suite or an individual
72
+ # file, and it's useful to allow more verbose output when running an
73
+ # individual spec file.
74
+ if config.files_to_run.one?
75
+ # Use the documentation formatter for detailed output,
76
+ # unless a formatter has already been configured
77
+ # (e.g. via a command-line flag).
78
+ config.default_formatter = 'doc'
79
+ end
80
+
81
+ # Print the 10 slowest examples and example groups at the
82
+ # end of the spec run, to help surface which specs are running
83
+ # particularly slow.
84
+ config.profile_examples = 10
85
+
86
+ # Run specs in random order to surface order dependencies. If you find an
87
+ # order dependency and want to debug it, you can fix the order by providing
88
+ # the seed, which is printed after each run.
89
+ # --seed 1234
90
+ config.order = :random
91
+
92
+ # Seed global randomization in this process using the `--seed` CLI option.
93
+ # Setting this allows you to use `--seed` to deterministically reproduce
94
+ # test failures related to randomization by passing the same `--seed` value
95
+ # as the one that triggered the failure.
96
+ Kernel.srand config.seed
97
+ =end
98
+ end
@@ -0,0 +1,18 @@
1
+ require 'vcr'
2
+
3
+ VCR.configure do |c|
4
+ c.cassette_library_dir = 'spec/cassettes'
5
+ c.hook_into :webmock
6
+ c.default_cassette_options = { :record => :once }
7
+ c.allow_http_connections_when_no_cassette = false
8
+ c.debug_logger = File.open('/tmp/wtf.log', 'w')
9
+
10
+ [
11
+ 'PUBLIC_KEY',
12
+ 'PRIVATE_KEY'
13
+ ].each do |env_var|
14
+ c.filter_sensitive_data("<#{env_var}>") { ENV[env_var] }
15
+ end
16
+
17
+ c.configure_rspec_metadata!
18
+ end
@@ -0,0 +1,24 @@
1
+ require 'spec_helper'
2
+
3
+ module MarvelExplorer
4
+ describe Explorer do
5
+ before :each do
6
+ Timecop.freeze '2014-12-03T19:01:00+00:00'
7
+ FileUtils.rm_rf 'tmp/'
8
+ @me = Explorer.new 'config.yml'
9
+ end
10
+
11
+ after :each do
12
+ Timecop.return
13
+ end
14
+
15
+ it 'should generate a tweet message', :vcr do
16
+ @me.config['marshal_file'] = '/dev/null'
17
+ stub_request(:get, /gateway.marvel.com\/v1\/public\/characters\/1009351\/comics/)
18
+ .to_return(status: 200, body: File.read('spec/fixtures/hulk_comics.json'))
19
+ stub_request(:get, /gateway.marvel.com\/v1\/public\/comics\/19843\/characters/)
20
+ .to_return(status: 200, body: File.read('spec/fixtures/double-shot-characters.json'))
21
+ expect(@me.tweet_message).to eq 'In 2003, Hulk appeared in Marvel Double Shot #2 with Avengers'
22
+ end
23
+ end
24
+ end
data/spec/yaml_spec.rb ADDED
@@ -0,0 +1,38 @@
1
+ require 'spec_helper'
2
+
3
+ module MarvelExplorer
4
+ describe Explorer do
5
+ before :each do
6
+ Timecop.freeze '2014-12-03T19:01:00+00:00'
7
+ FileUtils.rm_rf 'tmp/'
8
+ @me = Explorer.new 'config.yml'
9
+ end
10
+
11
+ after :each do
12
+ Timecop.return
13
+ end
14
+
15
+ it 'should generate correct yaml', :vcr do
16
+ stub_request(:get, /gateway.marvel.com\/v1\/public\/characters\/1009351\/comics/)
17
+ .to_return(status: 200, body: File.read('spec/fixtures/hulk_comics.json'))
18
+ stub_request(:get, /gateway.marvel.com\/v1\/public\/comics\/19843\/characters/)
19
+ .to_return(status: 200, body: File.read('spec/fixtures/double-shot-characters.json'))
20
+ stub_request(:get, /gateway.marvel.com\/v1\/public\/characters\/1009165/)
21
+ .to_return(status: 200, body: File.read('spec/fixtures/spider-man.json'))
22
+ @me.save
23
+ @me.yamlise
24
+ start_yaml = YAML.load File.open '%s/_data/start.yml' % @me.config['jekyll_dir']
25
+ expect(start_yaml['name']).to eq 'Hulk'
26
+ expect(start_yaml['image']['extension']).to eq 'jpg'
27
+
28
+ end_yaml = YAML.load File.open '%s/_data/end.yml' % @me.config['jekyll_dir']
29
+ expect(end_yaml['url']).to match /marvel.com\/universe/
30
+
31
+ comic_yaml = YAML.load File.open '%s/_data/comic.yml' % @me.config['jekyll_dir']
32
+ expect(comic_yaml['date']).to match /2003-02-10/
33
+ expect(comic_yaml['title']).to match /Double Shot/
34
+ expect(comic_yaml['image']['path']).to match /4c3649b0f2abd/
35
+ expect(comic_yaml['series']['period']).to eq '2003'
36
+ end
37
+ end
38
+ end