![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
= FbGraph::Mock
Facebook Graph API mocking helper, originally used in fb_graph gem.
This gem simply mock HTTP request & response using webmock gem, and returns pre-registered JSON response.
It means you can use fb_graph-mock gem even with kwala, rest-client, or any other code which access to Facebook Graph API.
== Installation
gem install fb_graph-mock
== Examples
In spec_helper.rb
require 'fb_graph/mock' include FbGraph::Mock WebMock.disable_net_connect! # Optional
In foo_spec.rb
it do mock_graph :get, 'me', 'users/me_private', :access_token => 'access_token' do user = FbGraph::User.me('access_token').fetch user.website.should == 'http://matake.jp' end end
it do mock_graph :get, 'me', 'users/me_public', :status => [401, 'Unauthorized'] do lambda do FbGraph::User.fetch :me end.should raise_error FbGraph::Unauthorized end end
=== More Examples?
You can see lots of samples in fb_graph's specs. https://github.com/nov/fb_graph
== Registered Mocks and Your Custom Mocks
To improve fb_graph and other projects using this gem, keeping mock JSONs are important.
If you find any legacy response format in this gem's mock_json directory, please report an issue or send a pull request with new JSON file.
You can find all registered responses as below.
FbGraph::Mock.registered_mocks
If it's hard to share your mock JSON (e.g. because of privacy issue), you can use your own response file as below.
file_path = File.join(Rails.root, 'spec/my_own_mock_json/users/me_private.json') mock_graph :get, 'me', file_path do # Do something. end
If a file is found at the given file path, this gem uses the file.
Otherwise, this gem search a registered mock JSON file in its own registry.
mock_graph :get, 'me', 'users/albums/arjun_public' do # => uses "mock_json/users/albums/arjun_public.json" in this gem. # Do something. end
== Note on Patches/Pull Requests
== Copyright
Copyright (c) 2012 nov matake. See LICENSE for details.
FAQs
Unknown package
We found that fb_graph-mock demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.