The document discusses various techniques for testing services in Ruby on Rails applications. It begins by defining what a service is and why testing services is important. It then covers different approaches to stubbing or mocking external services in tests to avoid making real HTTP requests, including using libraries like WebMock, VCR, and ShamRack. The document recommends stubbing or mocking services when possible for fast, reliable tests and also discusses tools for automatically recording and replaying responses like Puffing Billy.
Remember that time where setting up a login page was easy? It seems like nowadays, it take many weeks to start a project just to create a signup form, a login form and a forget password screen. And that is if you don’t need 2 factor authentication or passwordless authentication. In a world of security breaches and privacy violations, it is important for developers to understand how modern identity work.
This talk will be in two parts.
For starters, the attendees will be introduced to modern security protocols like OpenID Connect and OAuth. The basics of token authentication will be explained using simple examples that are easy to understand. The concept of tokens will also be explained, more specifically how JWTs work.
In the second part of this presentation, the attendees will learn how to implement their own authentication server, how to secure their APIs and how to protect their Single Page Applications by making use of the protocols described in the first part.
Finally, the presenter will show the participants how to add Auth0 as an authentication server with minimal code changes and will demonstrate the simplicity of using a third party to handle login, signups, lost password as well as 2 factor authentication or passwordless logins.
A sure way to make data and ML work for you in a 10x manner is to start with low-hanging fruit: a recommender system. It's been a useful application of data science to the consumer-facing web since the early days of the internet. This talk explains how one was built to recommend colleges to prospective high school students, the application of popularity tables and collaborative filters, as well as other approaches and the reasons for doing them.
An introduction to AWS Elastic Beanstalk, a service to help run your Java web applications on the Amazon cloud, leaving you free to focus on your app. Slides from the London Java Community meetup, 1st June 2011.
Remember that time where setting up a login page was easy? It seems like nowadays, it take many weeks to start a project just to create a signup form, a login form and a forget password screen. And that is if you don’t need 2 factor authentication or passwordless authentication. In a world of security breaches and privacy violations, it is important for developers to understand how modern identity work.
This talk will be in two parts.
For starters, the attendees will be introduced to modern security protocols like OpenID Connect and OAuth. The basics of token authentication will be explained using simple examples that are easy to understand. The concept of tokens will also be explained, more specifically how JWTs work.
In the second part of this presentation, the attendees will learn how to implement their own authentication server, how to secure their APIs and how to protect their Single Page Applications by making use of the protocols described in the first part.
Finally, the presenter will show the participants how to add Auth0 as an authentication server with minimal code changes and will demonstrate the simplicity of using a third party to handle login, signups, lost password as well as 2 factor authentication or passwordless logins.
A sure way to make data and ML work for you in a 10x manner is to start with low-hanging fruit: a recommender system. It's been a useful application of data science to the consumer-facing web since the early days of the internet. This talk explains how one was built to recommend colleges to prospective high school students, the application of popularity tables and collaborative filters, as well as other approaches and the reasons for doing them.
An introduction to AWS Elastic Beanstalk, a service to help run your Java web applications on the Amazon cloud, leaving you free to focus on your app. Slides from the London Java Community meetup, 1st June 2011.
2019-03 PHP without PHP Architecture @ Confooterry chay
An obscure but ubiquitous design pattern in PHP development is known as Funky Caching. Using real architectural examples as a lens to look at this one simple PHP design pattern, we see how we can design web architectures that are "organic, democratic, and lasting"
Components are the Future of the Web: It’s Going To Be OkayFITC
Presented at Web Unleashed on September 16-17, 2015 in Toronto, Canada
More info at www.fitc.ca/webu
Components are the Future of the Web: It’s Going To Be Okay
with Tessa Thornton
OVERVIEW
Overview JavaScript innovations in 2014 coalesced on a common theme: the public release of React.js, the announcments of the roadmaps for Ember and Angular 2.0, and Google betting big on Polymer, all emphasize that the future of the web lies in declarative components. This direction can seem radical and backwards to those of us with painful memories of inline event handlers and XML, who fear re-living the hell of tightly-coupled, unmaintainable code. This talk will focus on the real-world motivations behind this shift, and explain why `ng-click` is not your grandma’s onClick. I’ll also discuss the popular (currently usable!) implementations of this philosophy, and how leveraging components can lead to happier developers and more maintainable code, regardless of your framework of choice.
OBJECTIVE
Convey the motivations and benefits behind recent directions in front-end JavaScript development.
TARGET AUDIENCE
Novice web/JavaScript developers that aren’t yet sold on a framework.
ASSUMED AUDIENCE KNOWLEDGE
Basic JavaScript and HTML knowledge.
FIVE THINGS AUDIENCE MEMBERS WILL LEARN
A brief history of how JavaScript got to where it is
The difference between imperative and declarative programming
How writing declarative code can simplify front-end development
How declarative APIs are being introduced to the browser
How you can take advantage of declarative components today, regardless of framework/library
There have long been links on the internet that take the unwary user to a page with unexpected or malicious content. Most of these attempts rely on the user to click on the link to be successful. However, the latest variation has moved beyond simple text links to "Google-image poisoning" - placing malware in the middle of Google searches for images where users have traditionally had no reason to be wary. Our presentation will focus on How malware writers are able to infect the average website; detailed analyses of the PHP script used to infect s ites and SEO techniques to get infected images at the top of search results.
10 Things You're Not Doing [IBM Lotus Notes Domino Application Development]Chris Toohey
My Lotusphere 2011 SpeedGeeking session - 10 Things You're Not Doing!
Gave this presentation in 5 minutes 13 times [in a row, back to back], and had a blast!
MTC 2013 Berlin - Best Practices for Multi DevicesHasan Hosgel
Here you can experience the learnings, which the presenter got during development of the ImmobilienScout24 Android application. The presentation doesn't cover Design, UX or Fragments, but it gives an introduction and samples of using different resources, in special layouts. These folders can be used for filtering specific configurations, referencing other resources and using layout aliases. This session aims at people with knowledge of coding for Android.
Technical SEO - Gone is Never Gone - Fixing Generational Cruft and Technical ...Dawn Anderson MSc DigM
You have a shiny new site and your brand is looking for a fresh start with their offering. It may be one of many past migrations, protocol switches and redirections you're undertaken historically. But then you find that things didn't quite go as you expected. You never really got back to where you wanted to be in organic search. Part of this is because 'Gone is never Gone'. Every URL that ever was known of on your site is listed in the history logs in the Google search engine system and history logs are used to determine the amount of time your site will be apportioned crawling. You inherited technical SEO debt and generational cruft where everything gets blurred for Google in understanding which is the target URL for a particular term. This can be particularly prevalent when you migrate from one ecommerce platform to another because past crawling rules developed for your site are now not applicable but are still in the history and crawl patterns discovered.
Fetch me if you can - Handling API data in different JS frameworksMarco Pagni
Here my slides from berlinjs on 09/19/2019:
Fetching and displaying third party API data has become a very popular coding challenge, either before or during interview processes. Having seen several candidates going through this exercise, I'd like to walk you through on how to do this in React, Vue and Svelte, show you pitfalls and common struggles, and explain what the interviewer wants to learn about your skill set with this approach
Intro to developing for @twitterapi (updated)Raffi Krikorian
A short primer on how to develop for the Twitter API.
This is the newly edited version of http://www.slideshare.net/raffikrikorian/intro-to-developing-for-twitterapi
2019-03 PHP without PHP Architecture @ Confooterry chay
An obscure but ubiquitous design pattern in PHP development is known as Funky Caching. Using real architectural examples as a lens to look at this one simple PHP design pattern, we see how we can design web architectures that are "organic, democratic, and lasting"
Components are the Future of the Web: It’s Going To Be OkayFITC
Presented at Web Unleashed on September 16-17, 2015 in Toronto, Canada
More info at www.fitc.ca/webu
Components are the Future of the Web: It’s Going To Be Okay
with Tessa Thornton
OVERVIEW
Overview JavaScript innovations in 2014 coalesced on a common theme: the public release of React.js, the announcments of the roadmaps for Ember and Angular 2.0, and Google betting big on Polymer, all emphasize that the future of the web lies in declarative components. This direction can seem radical and backwards to those of us with painful memories of inline event handlers and XML, who fear re-living the hell of tightly-coupled, unmaintainable code. This talk will focus on the real-world motivations behind this shift, and explain why `ng-click` is not your grandma’s onClick. I’ll also discuss the popular (currently usable!) implementations of this philosophy, and how leveraging components can lead to happier developers and more maintainable code, regardless of your framework of choice.
OBJECTIVE
Convey the motivations and benefits behind recent directions in front-end JavaScript development.
TARGET AUDIENCE
Novice web/JavaScript developers that aren’t yet sold on a framework.
ASSUMED AUDIENCE KNOWLEDGE
Basic JavaScript and HTML knowledge.
FIVE THINGS AUDIENCE MEMBERS WILL LEARN
A brief history of how JavaScript got to where it is
The difference between imperative and declarative programming
How writing declarative code can simplify front-end development
How declarative APIs are being introduced to the browser
How you can take advantage of declarative components today, regardless of framework/library
There have long been links on the internet that take the unwary user to a page with unexpected or malicious content. Most of these attempts rely on the user to click on the link to be successful. However, the latest variation has moved beyond simple text links to "Google-image poisoning" - placing malware in the middle of Google searches for images where users have traditionally had no reason to be wary. Our presentation will focus on How malware writers are able to infect the average website; detailed analyses of the PHP script used to infect s ites and SEO techniques to get infected images at the top of search results.
10 Things You're Not Doing [IBM Lotus Notes Domino Application Development]Chris Toohey
My Lotusphere 2011 SpeedGeeking session - 10 Things You're Not Doing!
Gave this presentation in 5 minutes 13 times [in a row, back to back], and had a blast!
MTC 2013 Berlin - Best Practices for Multi DevicesHasan Hosgel
Here you can experience the learnings, which the presenter got during development of the ImmobilienScout24 Android application. The presentation doesn't cover Design, UX or Fragments, but it gives an introduction and samples of using different resources, in special layouts. These folders can be used for filtering specific configurations, referencing other resources and using layout aliases. This session aims at people with knowledge of coding for Android.
Technical SEO - Gone is Never Gone - Fixing Generational Cruft and Technical ...Dawn Anderson MSc DigM
You have a shiny new site and your brand is looking for a fresh start with their offering. It may be one of many past migrations, protocol switches and redirections you're undertaken historically. But then you find that things didn't quite go as you expected. You never really got back to where you wanted to be in organic search. Part of this is because 'Gone is never Gone'. Every URL that ever was known of on your site is listed in the history logs in the Google search engine system and history logs are used to determine the amount of time your site will be apportioned crawling. You inherited technical SEO debt and generational cruft where everything gets blurred for Google in understanding which is the target URL for a particular term. This can be particularly prevalent when you migrate from one ecommerce platform to another because past crawling rules developed for your site are now not applicable but are still in the history and crawl patterns discovered.
Fetch me if you can - Handling API data in different JS frameworksMarco Pagni
Here my slides from berlinjs on 09/19/2019:
Fetching and displaying third party API data has become a very popular coding challenge, either before or during interview processes. Having seen several candidates going through this exercise, I'd like to walk you through on how to do this in React, Vue and Svelte, show you pitfalls and common struggles, and explain what the interviewer wants to learn about your skill set with this approach
Intro to developing for @twitterapi (updated)Raffi Krikorian
A short primer on how to develop for the Twitter API.
This is the newly edited version of http://www.slideshare.net/raffikrikorian/intro-to-developing-for-twitterapi
Stop the noise! - Introduction to the JSON:API specification in DrupalBjörn Brala
If you’ve ever argued about the way your JSON responses should be formatted, JSON:API can be your anti-bikeshedding tool. JSON:API is a great way to expose a consistent API in your application.
In this session, we will talk about how JSON:API got to where it is today and how it can help you make Drupal the core of all your online transactions. We will check out the specifications and look at the main benefits of JSON:API and see how Drupal implemented the spec.
Expect to learn the structure and features of the JSON:API specifications and why it should be your smart default. You should be able to get started right away with some examples we will provide in this session.
Web APIs have revolutionized all kinds of products and services, and still continue to do so. Nowadays the most relevant architecture is REST along with the JSON media type. Furthermore, lots of specifications to serialize those media types are appearing. JSON API has released its first version last May.
In this talk, Shubhra Kar from StrongLoop will cover best practices for securing APIs. He'll give an overview of how to integrate Passport, oAuth and social logins into your Node app. Also, presented will be user and login management, SSL termination, rate limiting and throttling plus reverse proxy.
Full-Text Search Explained - Philipp Krenn - Codemotion Rome 2017Codemotion
Today’s applications are expected to provide powerful full-text search. But how does that work in general and how do I implement it on my site or in my application? Actually, this is not as hard as it sounds at first. This talk covers: * How full-text search works in general and what the differences to databases are. * How the score or quality of a search result is calculated. * How to implement this with Elasticsearch. Attendees will learn how to add common search patterns to their applications without breaking a sweat.
Similar to Effectively Testing Services on Rails - Railsconf 2014 (20)
Software Engineering, Software Consulting, Tech Lead, Spring Boot, Spring Cloud, Spring Core, Spring JDBC, Spring Transaction, Spring MVC, OpenShift Cloud Platform, Kafka, REST, SOAP, LLD & HLD.
Navigating the Metaverse: A Journey into Virtual Evolution"Donna Lenk
Join us for an exploration of the Metaverse's evolution, where innovation meets imagination. Discover new dimensions of virtual events, engage with thought-provoking discussions, and witness the transformative power of digital realms."
GraphSummit Paris - The art of the possible with Graph TechnologyNeo4j
Sudhir Hasbe, Chief Product Officer, Neo4j
Join us as we explore breakthrough innovations enabled by interconnected data and AI. Discover firsthand how organizations use relationships in data to uncover contextual insights and solve our most pressing challenges – from optimizing supply chains, detecting fraud, and improving customer experiences to accelerating drug discoveries.
Developing Distributed High-performance Computing Capabilities of an Open Sci...Globus
COVID-19 had an unprecedented impact on scientific collaboration. The pandemic and its broad response from the scientific community has forged new relationships among public health practitioners, mathematical modelers, and scientific computing specialists, while revealing critical gaps in exploiting advanced computing systems to support urgent decision making. Informed by our team’s work in applying high-performance computing in support of public health decision makers during the COVID-19 pandemic, we present how Globus technologies are enabling the development of an open science platform for robust epidemic analysis, with the goal of collaborative, secure, distributed, on-demand, and fast time-to-solution analyses to support public health.
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoamtakuyayamamoto1800
In this slide, we show the simulation example and the way to compile this solver.
In this solver, the Helmholtz equation can be solved by helmholtzFoam. Also, the Helmholtz equation with uniformly dispersed bubbles can be simulated by helmholtzBubbleFoam.
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Globus
The Earth System Grid Federation (ESGF) is a global network of data servers that archives and distributes the planet’s largest collection of Earth system model output for thousands of climate and environmental scientists worldwide. Many of these petabyte-scale data archives are located in proximity to large high-performance computing (HPC) or cloud computing resources, but the primary workflow for data users consists of transferring data, and applying computations on a different system. As a part of the ESGF 2.0 US project (funded by the United States Department of Energy Office of Science), we developed pre-defined data workflows, which can be run on-demand, capable of applying many data reduction and data analysis to the large ESGF data archives, transferring only the resultant analysis (ex. visualizations, smaller data files). In this talk, we will showcase a few of these workflows, highlighting how Globus Flows can be used for petabyte-scale climate analysis.
In software engineering, the right architecture is essential for robust, scalable platforms. Wix has undergone a pivotal shift from event sourcing to a CRUD-based model for its microservices. This talk will chart the course of this pivotal journey.
Event sourcing, which records state changes as immutable events, provided robust auditing and "time travel" debugging for Wix Stores' microservices. Despite its benefits, the complexity it introduced in state management slowed development. Wix responded by adopting a simpler, unified CRUD model. This talk will explore the challenges of event sourcing and the advantages of Wix's new "CRUD on steroids" approach, which streamlines API integration and domain event management while preserving data integrity and system resilience.
Participants will gain valuable insights into Wix's strategies for ensuring atomicity in database updates and event production, as well as caching, materialization, and performance optimization techniques within a distributed system.
Join us to discover how Wix has mastered the art of balancing simplicity and extensibility, and learn how the re-adoption of the modest CRUD has turbocharged their development velocity, resilience, and scalability in a high-growth environment.
Software Engineering, Software Consulting, Tech Lead.
Spring Boot, Spring Cloud, Spring Core, Spring JDBC, Spring Security,
Spring Transaction, Spring MVC,
Log4j, REST/SOAP WEB-SERVICES.
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus
As part of the DOE Integrated Research Infrastructure (IRI) program, NERSC at Lawrence Berkeley National Lab and ALCF at Argonne National Lab are working closely with General Atomics on accelerating the computing requirements of the DIII-D experiment. As part of the work the team is investigating ways to speedup the time to solution for many different parts of the DIII-D workflow including how they run jobs on HPC systems. One of these routes is looking at Globus Compute as a way to replace the current method for managing tasks and we describe a brief proof of concept showing how Globus Compute could help to schedule jobs and be a tool to connect compute at different facilities.
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Globus
Large Language Models (LLMs) are currently the center of attention in the tech world, particularly for their potential to advance research. In this presentation, we'll explore a straightforward and effective method for quickly initiating inference runs on supercomputers using the vLLM tool with Globus Compute, specifically on the Polaris system at ALCF. We'll begin by briefly discussing the popularity and applications of LLMs in various fields. Following this, we will introduce the vLLM tool, and explain how it integrates with Globus Compute to efficiently manage LLM operations on Polaris. Attendees will learn the practical aspects of setting up and remotely triggering LLMs from local machines, focusing on ease of use and efficiency. This talk is ideal for researchers and practitioners looking to leverage the power of LLMs in their work, offering a clear guide to harnessing supercomputing resources for quick and effective LLM inference.
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...Juraj Vysvader
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I didn't get rich from it but it did have 63K downloads (powered possible tens of thousands of websites).
How to Position Your Globus Data Portal for Success Ten Good PracticesGlobus
Science gateways allow science and engineering communities to access shared data, software, computing services, and instruments. Science gateways have gained a lot of traction in the last twenty years, as evidenced by projects such as the Science Gateways Community Institute (SGCI) and the Center of Excellence on Science Gateways (SGX3) in the US, The Australian Research Data Commons (ARDC) and its platforms in Australia, and the projects around Virtual Research Environments in Europe. A few mature frameworks have evolved with their different strengths and foci and have been taken up by a larger community such as the Globus Data Portal, Hubzero, Tapis, and Galaxy. However, even when gateways are built on successful frameworks, they continue to face the challenges of ongoing maintenance costs and how to meet the ever-expanding needs of the community they serve with enhanced features. It is not uncommon that gateways with compelling use cases are nonetheless unable to get past the prototype phase and become a full production service, or if they do, they don't survive more than a couple of years. While there is no guaranteed pathway to success, it seems likely that for any gateway there is a need for a strong community and/or solid funding streams to create and sustain its success. With over twenty years of examples to draw from, this presentation goes into detail for ten factors common to successful and enduring gateways that effectively serve as best practices for any new or developing gateway.
Quarkus Hidden and Forbidden ExtensionsMax Andersen
Quarkus has a vast extension ecosystem and is known for its subsonic and subatomic feature set. Some of these features are not as well known, and some extensions are less talked about, but that does not make them less interesting - quite the opposite.
Come join this talk to see some tips and tricks for using Quarkus and some of the lesser known features, extensions and development techniques.
May Marketo Masterclass, London MUG May 22 2024.pdfAdele Miller
Can't make Adobe Summit in Vegas? No sweat because the EMEA Marketo Engage Champions are coming to London to share their Summit sessions, insights and more!
This is a MUG with a twist you don't want to miss.
Essentials of Automations: The Art of Triggers and Actions in FMESafe Software
In this second installment of our Essentials of Automations webinar series, we’ll explore the landscape of triggers and actions, guiding you through the nuances of authoring and adapting workspaces for seamless automations. Gain an understanding of the full spectrum of triggers and actions available in FME, empowering you to enhance your workspaces for efficient automation.
We’ll kick things off by showcasing the most commonly used event-based triggers, introducing you to various automation workflows like manual triggers, schedules, directory watchers, and more. Plus, see how these elements play out in real scenarios.
Whether you’re tweaking your current setup or building from the ground up, this session will arm you with the tools and insights needed to transform your FME usage into a powerhouse of productivity. Join us to discover effective strategies that simplify complex processes, enhancing your productivity and transforming your data management practices with FME. Let’s turn complexity into clarity and make your workspaces work wonders!
Providing Globus Services to Users of JASMIN for Environmental Data AnalysisGlobus
JASMIN is the UK’s high-performance data analysis platform for environmental science, operated by STFC on behalf of the UK Natural Environment Research Council (NERC). In addition to its role in hosting the CEDA Archive (NERC’s long-term repository for climate, atmospheric science & Earth observation data in the UK), JASMIN provides a collaborative platform to a community of around 2,000 scientists in the UK and beyond, providing nearly 400 environmental science projects with working space, compute resources and tools to facilitate their work. High-performance data transfer into and out of JASMIN has always been a key feature, with many scientists bringing model outputs from supercomputers elsewhere in the UK, to analyse against observational or other model data in the CEDA Archive. A growing number of JASMIN users are now realising the benefits of using the Globus service to provide reliable and efficient data movement and other tasks in this and other contexts. Further use cases involve long-distance (intercontinental) transfers to and from JASMIN, and collecting results from a mobile atmospheric radar system, pushing data to JASMIN via a lightweight Globus deployment. We provide details of how Globus fits into our current infrastructure, our experience of the recent migration to GCSv5.4, and of our interest in developing use of the wider ecosystem of Globus services for the benefit of our user community.
46. ENV['RAILS_ENV'] ||= 'test'
require File.expand_path('../../config/environment', __FILE__)
require 'rspec/autorun'
require 'rspec/rails’
require 'fb_graph/mock'
Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }
ActiveRecord::Migration.check_pending! if defined?(ActiveRecord::Migration)
RSpec.configure do |config|
config.infer_base_class_for_anonymous_controllers = false
config.order = 'random'
config.include FbGraph::Mock
end
WebMock.disable_net_connect!
spec/spec_helper.rb
47. describe FacebookWrapper, '.user_link' do
it 'retrieves user link' do
mock_graph :get, 'arjun', 'users/arjun_public' do
user_id = FacebookWrapper.user_id('arjun')
expect(user_id).to eq '7901103'
end
end
end
spec/lib/facebook_wrapper_spec.rb
48. describe FacebookWrapper, '.user_link' do
it 'retrieves user link' do
mock_graph :get, 'arjun', 'users/arjun_public' do
user_id = FacebookWrapper.user_id('arjun')
expect(user_id).to eq '7901103'
end
end
end
spec/lib/facebook_wrapper_spec.rb
52. ENV['RAILS_ENV'] ||= 'test'
require File.expand_path('../../config/environment', __FILE__)
require 'rspec/autorun'
require 'rspec/rails’
Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }
ActiveRecord::Migration.check_pending! if defined?(ActiveRecord::Migration)
RSpec.configure do |config|
config.infer_base_class_for_anonymous_controllers = false
config.order = 'random’
end
WebMock.disable_net_connect!
spec/spec_helper.rb
53. ShamRack.at('graph.facebook.com', 443).sinatra do
get '/:username' do
%Q|{
"id": "7901103",
"name": "Arjun Banker",
"first_name": "Arjun",
"last_name": "Banker",
"link": "http://www.facebook.com/#{params[:username]}",
"location": {
"id": 114952118516947,
"name": "San Francisco, California"
},
"gender": "male"
}|
end
end
spec/support/fake_facebook.rb
54. ShamRack.at('graph.facebook.com', 443).sinatra do
get '/:username' do
%Q|{
"id": "7901103",
"name": "Arjun Banker",
"first_name": "Arjun",
"last_name": "Banker",
"link": "http://www.facebook.com/#{params[:username]}",
"location": {
"id": 114952118516947,
"name": "San Francisco, California"
},
"gender": "male"
}|
end
end
spec/support/fake_facebook.rb
55. ShamRack.at('graph.facebook.com', 443).sinatra do
get '/:username' do
%Q|{
"id": "7901103",
"name": "Arjun Banker",
"first_name": "Arjun",
"last_name": "Banker",
"link": "http://www.facebook.com/#{params[:username]}",
"location": {
"id": 114952118516947,
"name": "San Francisco, California"
},
"gender": "male"
}|
end
end
spec/support/fake_facebook.rb
56. ShamRack.at('graph.facebook.com', 443).sinatra do
get '/:username' do
%Q|{
"id": "7901103",
"name": "Arjun Banker",
"first_name": "Arjun",
"last_name": "Banker",
"link": "http://www.facebook.com/#{params[:username]}",
"location": {
"id": 114952118516947,
"name": "San Francisco, California"
},
"gender": "male"
}|
end
end
spec/support/fake_facebook.rb
57. describe FacebookWrapper, '.user_link' do
it 'retrieves user link' do
user_id = FacebookWrapper.user_id('arjun')
expect(user_id).to eq '7901103’
end
end
spec/lib/facebook_wrapper_spec.rb
60. ENV['RAILS_ENV'] ||= 'test'
require File.expand_path('../../config/environment', __FILE__)
require 'rspec/autorun'
require 'rspec/rails’
Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }
ActiveRecord::Migration.check_pending! if defined?(ActiveRecord::Migration)
RSpec.configure do |config|
config.infer_base_class_for_anonymous_controllers = false
config.order = 'random’
end
WebMock.disable_net_connect!
VCR.configure do |c|
c.cassette_library_dir = 'spec/fixtures/vcr_cassettes'
c.hook_into :webmock
end
spec/spec_helper.rb
61. describe FacebookWrapper, '.user_link' do
it 'retrieves user link' do
VCR.use_cassette('fb_user_arjun') do
user_id = FacebookWrapper.user_id('arjun')
expect(user_id).to eq '7901103'
end
end
end
spec/lib/facebook_wrapper_spec.rb
62. describe FacebookWrapper, '.user_link' do
it 'retrieves user link' do
VCR.use_cassette('fb_user_arjun') do
user_id = FacebookWrapper.user_id('arjun')
expect(user_id).to eq '7901103'
end
end
end
spec/lib/facebook_wrapper_spec.rb
Includes: things like Stripe, or an internal API, or an iPhone app calling into an API exposed by your rails app
LA kings checkingchicagoblackhawks
Can back with yaml
Can back with yaml
Can back with yaml
Can back with yaml
Re-writing web proxyAllowed to record and reuse (like VCR)
Can back with yaml
Ubiquitous PowerfulIn-browser (so easy!)
Easily send requestsEasy-to-use GUI
Postman without the GUICould run small scripts around it
re-writing web proxyTest mobile as well as desktopGood for collecting a lot of responsesGood for testing things that aren’t specific page loads in ChromeGood when you don’t know what’s even being requested!