Last active
December 15, 2015 02:39
-
-
Save michaelrkn/5189150 to your computer and use it in GitHub Desktop.
webmock stub example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'spec_helper' | |
| describe Gist do | |
| context '.create' do | |
| it 'POSTs a new Gist to the user\'s account' do | |
| gist = {:public => 'true', | |
| :description => 'a test gist', | |
| :files => {'test_file.rb' => {:content => 'puts "hello world!"'}}} | |
| stub = stub_request(:post, "https://#{GITHUB_USERNAME}:#{GITHUB_PASSWORD}@api.github.com/gists").with(:body => gist.to_json) | |
| Gist.create(gist) | |
| stub.should have_been_requested | |
| end | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment