- Follow inverse on Facebook
- Follow humans+ on Facebook
- Follow next level on Facebook
- Follow star wars on Facebook
- Follow science & chill on Facebook
- Follow inverse on Flipboard
- Follow inverse on Apple News
Sign up for our newsletter
At Inverse, we obsess over one question: What could happen next? To provide answers — and there are many — we search out emerging ideas, new technologies, and simmering trends as well as fearless innovators, designers, and thinkers. We’re compulsively curious not only because we’re fans of progress, but also because we want a glimpse of the future and the chance to better plan for and enjoy tomorrow.
We prioritize Service Oriented Architecture principles at Inverse. That means we have small, maintainable components with clearly defined responsibilities. They communicate with one another (mostly), via Representational State Transfer, or REST, APIs.
This provides flexibility and has served us well with the exception of one significant facet: Testing. When testing, one should avoid:
Because applications inherently rely on external services, it is critical to have a testing strategy in place for those dependencies.
We recently started using Bypass and I will explain how we arrived there and specifically how we are using it.
Mock methods and return some example data like this:
That was (and I believe still is) the “way to go” in the world of Ruby/Rails. Unfortunately, this fosters bad behavior as best explained here by José Valim.
We then started using ExVCR, which is a great library, but has similar drawbacks as mocks/stubs: It encourages laziness and doesn’t foster the separation of concerns that are critical to well defined APIs. ExVCR enables one to “record” and “playback” real-live data. It’s very easy to integrate (including a few lines in your test and everything else is taken care of). But ideally you have to think about external dependencies in tests, not abstract them out. It might still be a viable choice for scenarios when the endpoint behavior should be tested with minimal overhead (we use it for testing calls to Amazon’s AWS Services like S3).
Adapters work great and promote deliberation around API contracts and clearly defined communication boundaries. We still use this approach, especially when the Adapter is more complex (like a JSON-RPC socket).
This is how an Adapter might look:
But for simple HTTP Endpoints, Adapters seem like a lot of work and have a major drawback: They leave the libraries they consume out of the testing equation. If anything in the HTTP or JSON libraries changes, the tests won’t catch it. The amount of production-critical code that is left untested by this approach is unacceptable.
Bypass allows us to start a very simple web server in tests that simulate external services we use.
Now, we can test the entire stack, including the HTTP library, JSON encoding/decoding library, and authentication mechanisms. The Bypass README is well written, so I will spare implementation details. We do, however, slightly change how we use it in order to keep tests concise and readable:
First off, we do sometimes want to call out to Facebook when tests are run as a full integration suite. We do this irregularly to ensure the Facebook API still functions per our expectations. Adding
--include integration to
mix test does not simulate the API but, instead, calls out to the external service (lines 5, 7).
We are explicit when we simulate requests to external services so that each test that uses Bypass must have the
@tag facebook_bypass (line 7).
handle_fb function (lines 30–39) is being called (given that the
request_path matches). I like matching in the function head as it makes explicit which path we are reacting to and allows us to define different functions for different paths.
So Bypass runs on only tests tagged with
@tag :bypass and when we are not running our integration suite. One more thing we do while setting up Bypass is allowing the tag to pass a page id (lines 8, 20). So here is how a test which uses Bypass looks in all its glory:
As you can see, the
facebook_bypass tag makes it explicit that we are simulating the API (unless we are in integration mode). It allows us to pass information to the simulated API, and it’s very easy to reuse the same Bypass config for different tests.
I hope this helps you test external APIs. You can find me on Twitter (see below) if you have any further questions.
Scroll through our publication and you’ll find stories about neurology research next to criticism of Fetty Wap and reports into the future of genetically modified pumpkins. The topics we cover run the gamut, but our approach does not. We treat the events of the present as evidence we can use to form a not at all unified vision of the future. Our writers use our three verticals — entertainment, science+tech, and life+work — to chase the topics that interest them down a rabbit hole.
We take a scientific approach to analyzing culture and a cultural approach to talking about science. Since our launch in early August, we’ve endeavored to analyze the world thoroughly — if not consistently. Our aim is to better understand tomorrow by examining today. And if you’re into that sort of broad statement, you can check out our mission statement here.
We have offices in San Francisco and Brooklyn and writers posted around the country.
Dave, our CEO, along with the majority of our product and engineering team — Winton, Kameron, John, and Steve — work out of the Flatiron Building in San Francisco. We also have Michael working from Germany, which allows us to have round-the-clock operations. Together, these guys constantly tend to and develop the technology behind the sleek and speedy Inverse. Meanwhile, on the East Coast, we have the editorial staff and a bevy of writers. The editorial team includes Andrew, Sam, Corban, Nick, and myself, Hannah Margaret.
We will go into more detail about the people behind Inverse in the coming blog posts.
Men’s publications have historically leaned on the idea that manhood is an achievable goal, not a default. Different brands have pushed different strategies to achieve their favored form of archetypal machismo. We’re not into that at all. We work to publish stories capable of changing our readers’ worldviews, but we don’t strive to homogenize.
Instead, we offer a multitude of intentionally inconsistent opinions and stories about unexpected subjects. We also endeavor to exist between the internet poles of extreme negativity and willful naivete. We ask questions. We try to answer those questions. We argue about those answers. It’s pretty much that simple.
Having learned some hard lessons working at other online publications, our engineering team deemed it necessary to build our CMS from scratch. They set out to build the fastest site on the internet.
As individuals, as a company, and as a website, we are in pursuit of progress. Our writers will incessantly scan the horizon for whatever might come your way. Our engineers will build you the fastest, most flawless website your phone or browser has ever loaded. And our reach will be gargantuan, because ultimately, Inverse is, and will continue to be, an unprecedented publication aimed at tackling the future together.
I’ve been obsessed with the future since I was a little kid.
Imprinted with images of an advanced world from the sci-fi movies, books, and comics I devoured from an early age, I wasn’t content to get to the future the old fashioned way — by waiting.
To speed up the process, I built myself a time machine out of cardboard boxes and spare wires. It didn’t work (my calculations for the flux capacitor must have been off), but I have, in a sense, been working on that same project ever since.
Fast forward to 2015, and I’ve joined with some phenomenally smart, forward-looking people to launch Inverse, a publication obsessed with the future and hell-bent on accelerating, critiquing, and celebrating its arrival.
This project has its technical and entrepreneurial elements but is fundamentally based on a realization: I’m not alone. Our generation shares my fascination with progress in all its forms. We are unceasingly, some would say naively, optimistic. We expect tomorrow to be better than today, and we’re also not shy about shouting our expectations from the mountaintop.
Of course, we could also still screw it up royally. All claims to the future are by their very nature contested, and there are plenty of mind-bogglingly giant hazards looming: economic uncertainty, social upheaval, manmade cataclysm, earthly or cosmic disaster, and — of course — apathy.
The future, truly, is what we make of it.
You’ll meet more of the team behind Inverse below and learn what possibilities dot their horizons. Thanks for stopping in, and glad to have you along for the ride. Whatever the future holds for us, it’s gonna be heavy.
Dave Nemetz, Founder & CEO
Current Project: Writing as many of the “It’s the Summer of” articles as possible
“What excites me about the future is cities getting more user-friendly and better to live in. In KC, my hometown, for instance, urban revitalization has restored civic pride through art and culture education programs. It’s cool to see this town that, when I was young, people saw as a place to escape, become a place to escape to. I’m not saying that I’m ready to move back home, but it’s dope that people want to live where I’m from. I think other people from other places will, increasingly, have similar experiences with the places they grew up. It’s dope.”
Current Project: Covering the science of sex, drugs, and rock ‘n’ roll
“I’m intensely interested in the new ways science will worm its way into everyday life. With innovations like 3D-printed food and insect flour, we’re already seeing some major changes to the way we eat. Hoverboards, hyperloops, and self-driving cars are just around the corner and will change travel. With teledildonics, science is even finding its way into our sex lives. None of this is to say that science hasn’t alway been present, but we’re suddenly culturally savvy enough to pay attention to it and leverage it creatively.”
Current Project: Speeding up our writer’s tools
“I work from my home in Germany, 3,758 miles from my nearest coworker, but I rarely feel lonely. The Internet, social media, and my phone connect me to the people I need to be connected with, making those relationships immediate and dynamic. As more and more technologies collapse space and ease communication, I look forward to being increasingly independent without having to pay the price in solitude. I see a future where I’m working from the road or Germany or America or wherever I am without feeling any disconnect. The flip side of this will be that those same technologies that make communication easier and easier will also make it easier to turn off communication altogether. That’s not so bad. Sometimes it’s nice to just be where you are.”
Current Project: Writing about all of the culture
“I’m excited about the ways that social media is now being so connected to social concerns. The traditionally marginalized voices of people of color are being, to some degree at least, heard and seen. More so than a symbolic gesture like the election of Barack Obama, the last year of social media activism has rallied people of color around the idea that the future doesn’t have to look like the past. Issues of racism aren’t going to be solved in my lifetime, but seeing conversations more out in the public that can make a change is thrilling.”
Current Project: Performance Dashboards, Benchmarks
“I’m really excited about how our advancements in technology are allowing engineers to act more as strategists and less as foot soldiers. Because we have more tools to quantify and analyze the results of experimentation, we have more incentive to experiment and more reason to think of ourselves as creative people. We write software and music and talk about both. The culture around what I do seems to be changing for the better.”
Current Project: Following Drake’s every move
“The lines between the underground and the mainstream are getting blurrier everyday. Experimental artists can emerge without having to adjust their sound. Pop stars are listening, too, taking more risks with music that millions will hear. I’m excited for a time when the most popular musicians in the world are also truly the best ones.”
Current Project: Developing our CMS and Consumer websites
“Over the course of the last century, the world opened up for travelers. There is a sense now that anyone can go anywhere, but that is only kind of true. It remains incredibly time consuming and difficult to get to a lot of places, but new technologies and new demand is opening the world up even more. Wherever I am today, I can be somewhere else tomorrow. For people like me, people who love to travel, that is both comforting and exciting. And it won’t be too long before we’re shuttling in and out of space. See you in orbit.”
Current Project: Building this post that you’re reading right now
“I’m really loving that podcasts are blowing up right now. It’s such a great medium for telling intimate stories and being honest, and the options are only going to get better and more diverse. I’m anticipating an era when podcasts have gotten so hyperspecific that I’ll be able to listen to people talk about the plays at the small Polish theater in my neighborhood. Whether I agree with those future podcasters or not, I’ll want to hear what they have to say because those other perspectives add depth to an experience. There’s this profound sense of community that actually encourages independent thinking and I’m into that. I’m from the South. We’re talkers.”
Current Project: Working on our first batch of longform features
“I have weird horrible feet, but I always went barefoot as a kid because I liked the feel of grass and the dirt. I can’t do that anymore because I live in NYC and I hear tetanus sucks. I’m not pleased with the deal I’ve struck — the tickle of fine fescue for a subterranean commute to a career — and I’m hoping that new transportation technologies will help me unwind it. I want to work in this city, but I want to spend my nights someplace quiet and soft with a leashless dog and, ideally, a slightly sunburnt woman. Better infrastructure, maybe a hyperloop or an aerial highway, could give me the opportunity to untie my ambition from my physical circumstance. You don’t need shoes to be serious.”
Current Project: Being a professional Jon Snow Lives Truther
“I’m excited about bold ideas and voices in storytelling across the board. In books, this ranges from literary fiction like Margaret Atwood to genre-benders like Jennifer Egan, Chris Adrian, Neil Gaimain, and Emily St. John Mandel, to smart YA like Maggie Stiefvater. With regard to film and TV writers, I’ll always be excited about whatever Joss Whedon and Martin McDonagh do next, and I’m always on the lookout for the next good story and interesting writer. I’m a sucker for fresh takes on familiar stories, so I’m excited about the upcoming Michael Fassbender Macbeth movie and Guy Ritchie’s crazy King Arthur franchise. I will also be following anything and everything J.K. Rowling ever does, and I could be excited about you, if you’ve got an interesting story.”
Current Project: Fixing our functional tests
“We are already eliminating the timesuck of formulaic information exchange. There is no reason, for instance, for me to ever spend time manually filling out my taxes ever again. And machine learning is going to automate an increasing amount of mindless, patience-straining tasks. That means less mental static for me. Instead of thinking about what I already know, I hope that future me will consider — almost exclusively — new, enlightening information and my own creations. I’m hoping that automation provides me with the opportunity to spend less time acting like a robot and more time being weird and human.”
Current Project: Talking to writers while canvassing every happy hour special between Greenpoint and Sunset Park
“I’m excited to not work. Computers have upped efficiency to utopian levels during the past 40 years, but Americans have yet to outgrow the grind-till-you-die Protestant inertia that keeps us from cooking dinner with our families, taking trips, reading thick books, and playing outside. I’m looking for four-day weeks to become the norm and would be down for three 10-hour days, if that works better. The future won’t belong to my commute, and I won’t have to make believe that end-of-day Netflix constitutes an actual hobby. I’ll hang out with my neighbors at 4 p.m. on a Wednesday and, by the way, accomplish double what I could have if I were born 50 years earlier and worked 168-hour weeks.”
Current Project: Writing about space, cities, A.I., and future tech
“I’ve always loved cities. Urban areas are these bombastic spots of humanity at it’s most chaotic, most lively, and most transformative. I catch an infectious energy in every city I visit or reside in, whether it’s been when walking down Manhattan’s canyons of skyscrapers, wading knee-high through Venice’s high tide, enjoying a show of Oakland’s ridiculously absurd amateur wrestling scene, or running from a pissed-off monkey in bustling Kathmandu. By the end of the century, four out every five people living on the planet will be living in cities, and these areas will need to undergo an intense technological metamorphosis to survive and thrive. The next several decades are going to be a great time of upheaval, but I feel pretty lucky to witness and take part in it.”
Current Project: Building Inverse
“I’m excited about the advancement of solar and wind technology because, paired with improvements in energy storage, it is starting to make energy independence look feasible. This is obviously significant in developing countries, where local networks can be built for local needs based on local resources, but it is meaningful for the wifi-enabled world as well. As customers start to have more options, we’ll be able to make energy choices that reflect our personal priorities. I, for one, won’t mind unplugging from utilities. I want to be in absolute control of what I’m consuming and being able to make independent decisions about energy will be a huge step in that direction.”