mirror of
https://github.com/samsonjs/instapaper.git
synced 2026-03-25 08:55:49 +00:00
remove should from test clauses
This commit is contained in:
parent
b254d2fd90
commit
c259665346
5 changed files with 41 additions and 41 deletions
|
|
@ -3,19 +3,19 @@ require 'spec_helper'
|
|||
describe Instapaper::Client::Accounts do
|
||||
let(:client) { Instapaper::Client.new }
|
||||
|
||||
describe '.verify_credentials' do
|
||||
describe '#verify_credentials' do
|
||||
before do
|
||||
stub_post('/api/1/account/verify_credentials')
|
||||
.to_return(body: fixture('verify_credentials.json'), headers: {content_type: 'application/json; charset=utf-8'})
|
||||
end
|
||||
|
||||
it 'should get the correct resource' do
|
||||
it 'gets the correct resource' do
|
||||
client.verify_credentials
|
||||
expect(a_post('/api/1/account/verify_credentials'))
|
||||
.to have_been_made
|
||||
end
|
||||
|
||||
it 'should return the user' do
|
||||
it 'returns the user' do
|
||||
user = client.verify_credentials
|
||||
expect(user).to be_a Instapaper::User
|
||||
end
|
||||
|
|
|
|||
|
|
@ -9,19 +9,19 @@ describe Instapaper::Client::Bookmarks do
|
|||
.to_return(body: fixture('bookmarks_list.json'), headers: {content_type: 'application/json; charset=utf-8'})
|
||||
end
|
||||
|
||||
it 'should get the correct resource' do
|
||||
it 'gets the correct resource' do
|
||||
client.bookmarks
|
||||
expect(a_post('/api/1/bookmarks/list'))
|
||||
.to have_been_made
|
||||
end
|
||||
|
||||
it 'should return an array containing bookmarks on success' do
|
||||
it 'returns an array containing bookmarks on success' do
|
||||
bookmarks = client.bookmarks
|
||||
expect(bookmarks).to be_an Array
|
||||
expect(bookmarks.size).to eq(2)
|
||||
end
|
||||
|
||||
it 'should remove the meta and current user objects from the array' do
|
||||
it 'removes the meta and current user objects from the array' do
|
||||
bookmarks = client.bookmarks
|
||||
bookmarks.each do |bookmark|
|
||||
expect(bookmark).to be_an Instapaper::Bookmark
|
||||
|
|
@ -36,13 +36,13 @@ describe Instapaper::Client::Bookmarks do
|
|||
.to_return(body: fixture('bookmarks_update_read_progress.json'), headers: {content_type: 'application/json; charset=utf-8'})
|
||||
end
|
||||
|
||||
it 'should get the correct resource' do
|
||||
it 'gets the correct resource' do
|
||||
client.update_read_progress(123, 0.5, @time)
|
||||
expect(a_post('/api/1/bookmarks/update_read_progress').with(body: {bookmark_id: '123', progress: '0.5', progress_timestamp: @time.to_i.to_s}))
|
||||
.to have_been_made
|
||||
end
|
||||
|
||||
it 'should return an array containing bookmarks on success' do
|
||||
it 'returns an array containing bookmarks on success' do
|
||||
bookmark = client.update_read_progress(123, 0.5, @time)
|
||||
expect(bookmark).to be_an Instapaper::Bookmark
|
||||
expect(bookmark.progress).to eq('0.5')
|
||||
|
|
@ -55,13 +55,13 @@ describe Instapaper::Client::Bookmarks do
|
|||
.to_return(body: fixture('bookmarks_add.json'), headers: {content_type: 'application/json; charset=utf-8'})
|
||||
end
|
||||
|
||||
it 'should get the correct resource' do
|
||||
it 'gets the correct resource' do
|
||||
client.add_bookmark('http://someurl.com', title: 'This is the title', description: 'This is the description')
|
||||
expect(a_post('/api/1/bookmarks/add').with(body: {url: 'http://someurl.com', title: 'This is the title', description: 'This is the description'}))
|
||||
.to have_been_made
|
||||
end
|
||||
|
||||
it 'should return the bookmark on success' do
|
||||
it 'returns the bookmark on success' do
|
||||
bookmark = client.add_bookmark('http://someurl.com', title: 'This is the title', description: 'This is the description')
|
||||
expect(bookmark).to be_an Instapaper::Bookmark
|
||||
end
|
||||
|
|
@ -73,13 +73,13 @@ describe Instapaper::Client::Bookmarks do
|
|||
.to_return(body: '[]', headers: {content_type: 'application/json; charset=utf-8'})
|
||||
end
|
||||
|
||||
it 'should get the correct resource' do
|
||||
it 'gets the correct resource' do
|
||||
client.delete_bookmark(123)
|
||||
expect(a_post('/api/1/bookmarks/delete').with(body: {bookmark_id: '123'}))
|
||||
.to have_been_made
|
||||
end
|
||||
|
||||
it 'should return an array containing bookmarks on success' do
|
||||
it 'returns an array containing bookmarks on success' do
|
||||
confirm = client.delete_bookmark(123)
|
||||
expect(confirm).to be_an Array
|
||||
expect(confirm).to be_empty
|
||||
|
|
@ -92,13 +92,13 @@ describe Instapaper::Client::Bookmarks do
|
|||
.to_return(body: fixture('bookmarks_star.json'), headers: {content_type: 'application/json; charset=utf-8'})
|
||||
end
|
||||
|
||||
it 'should get the correct resource' do
|
||||
it 'gets the correct resource' do
|
||||
client.star_bookmark(123)
|
||||
expect(a_post('/api/1/bookmarks/star').with(body: {bookmark_id: '123'}))
|
||||
.to have_been_made
|
||||
end
|
||||
|
||||
it 'should return a starred bookmark on success' do
|
||||
it 'returns a starred bookmark on success' do
|
||||
bookmark = client.star_bookmark(123)
|
||||
expect(bookmark).to be_an Instapaper::Bookmark
|
||||
expect(bookmark.starred).to eq('1')
|
||||
|
|
@ -111,13 +111,13 @@ describe Instapaper::Client::Bookmarks do
|
|||
.to_return(body: fixture('bookmarks_unstar.json'), headers: {content_type: 'application/json; charset=utf-8'})
|
||||
end
|
||||
|
||||
it 'should get the correct resource' do
|
||||
it 'gets the correct resource' do
|
||||
client.unstar_bookmark(123)
|
||||
expect(a_post('/api/1/bookmarks/unstar').with(body: {bookmark_id: '123'}))
|
||||
.to have_been_made
|
||||
end
|
||||
|
||||
it 'should return an unstarred bookmark on success' do
|
||||
it 'returns an unstarred bookmark on success' do
|
||||
bookmark = client.unstar_bookmark(123)
|
||||
expect(bookmark).to be_an Instapaper::Bookmark
|
||||
expect(bookmark.starred).to eq('0')
|
||||
|
|
@ -130,13 +130,13 @@ describe Instapaper::Client::Bookmarks do
|
|||
.to_return(body: fixture('bookmarks_archive.json'), headers: {content_type: 'application/json; charset=utf-8'})
|
||||
end
|
||||
|
||||
it 'should get the correct resource' do
|
||||
it 'gets the correct resource' do
|
||||
client.archive_bookmark(123)
|
||||
expect(a_post('/api/1/bookmarks/archive').with(body: {bookmark_id: '123'}))
|
||||
.to have_been_made
|
||||
end
|
||||
|
||||
it 'should return the bookmark on success' do
|
||||
it 'returns the bookmark on success' do
|
||||
bookmark = client.archive_bookmark(123)
|
||||
expect(bookmark).to be_an Instapaper::Bookmark
|
||||
end
|
||||
|
|
@ -148,13 +148,13 @@ describe Instapaper::Client::Bookmarks do
|
|||
.to_return(body: fixture('bookmarks_unarchive.json'), headers: {content_type: 'application/json; charset=utf-8'})
|
||||
end
|
||||
|
||||
it 'should get the correct resource' do
|
||||
it 'gets the correct resource' do
|
||||
client.unarchive_bookmark(123)
|
||||
expect(a_post('/api/1/bookmarks/unarchive').with(body: {bookmark_id: '123'}))
|
||||
.to have_been_made
|
||||
end
|
||||
|
||||
it 'should return the bookmark on success' do
|
||||
it 'returns the bookmark on success' do
|
||||
bookmark = client.unarchive_bookmark(123)
|
||||
expect(bookmark).to be_an Instapaper::Bookmark
|
||||
end
|
||||
|
|
@ -166,13 +166,13 @@ describe Instapaper::Client::Bookmarks do
|
|||
.to_return(body: fixture('bookmarks_move.json'), headers: {content_type: 'application/json; charset=utf-8'})
|
||||
end
|
||||
|
||||
it 'should get the correct resource' do
|
||||
it 'gets the correct resource' do
|
||||
client.move_bookmark(123, 12_345)
|
||||
expect(a_post('/api/1/bookmarks/move').with(body: {bookmark_id: '123', folder_id: '12345'}))
|
||||
.to have_been_made
|
||||
end
|
||||
|
||||
it 'should return the bookmark on success' do
|
||||
it 'returns the bookmark on success' do
|
||||
bookmark = client.move_bookmark(123, 12_345)
|
||||
expect(bookmark).to be_an Instapaper::Bookmark
|
||||
end
|
||||
|
|
@ -184,13 +184,13 @@ describe Instapaper::Client::Bookmarks do
|
|||
.to_return(body: fixture('bookmarks_get_text.txt'), headers: {content_type: 'text/html; charset=utf-8'})
|
||||
end
|
||||
|
||||
it 'should get the correct resource' do
|
||||
it 'gets the correct resource' do
|
||||
client.get_text(123)
|
||||
expect(a_post('/api/1/bookmarks/get_text').with(body: {bookmark_id: '123'}))
|
||||
.to have_been_made
|
||||
end
|
||||
|
||||
it "should return the bookmark's html on success" do
|
||||
it "returns the bookmark's html on success" do
|
||||
bookmark = client.get_text(123)
|
||||
expect(bookmark.length).to be > 0
|
||||
expect(bookmark).to include("Ideo's Axioms for Starting Disruptive New Businesses")
|
||||
|
|
|
|||
|
|
@ -9,13 +9,13 @@ describe Instapaper::Client::Folders do
|
|||
.to_return(body: fixture('folders_list.json'), headers: {content_type: 'application/json; charset=utf-8'})
|
||||
end
|
||||
|
||||
it 'should get the correct resource' do
|
||||
it 'gets the correct resource' do
|
||||
client.folders
|
||||
expect(a_post('/api/1/folders/list'))
|
||||
.to have_been_made
|
||||
end
|
||||
|
||||
it 'should return an array containing folders on success' do
|
||||
it 'returns an array containing folders on success' do
|
||||
folders = client.folders
|
||||
expect(folders).to be_an Array
|
||||
expect(folders.size).to eq(2)
|
||||
|
|
@ -29,13 +29,13 @@ describe Instapaper::Client::Folders do
|
|||
.to_return(body: fixture('folders_add.json'), headers: {content_type: 'application/json; charset=utf-8'})
|
||||
end
|
||||
|
||||
it 'should get the correct resource' do
|
||||
it 'gets the correct resource' do
|
||||
client.add_folder('Ruby')
|
||||
expect(a_post('/api/1/folders/add'))
|
||||
.to have_been_made
|
||||
end
|
||||
|
||||
it 'should return an array containing the new folder on success' do
|
||||
it 'returns an array containing the new folder on success' do
|
||||
folder = client.add_folder('Ruby')
|
||||
expect(folder).to be_a Instapaper::Folder
|
||||
end
|
||||
|
|
@ -47,13 +47,13 @@ describe Instapaper::Client::Folders do
|
|||
.to_return(body: fixture('folders_delete.json'), headers: {content_type: 'application/json; charset=utf-8'})
|
||||
end
|
||||
|
||||
it 'should get the correct resource' do
|
||||
it 'gets the correct resource' do
|
||||
client.delete_folder('1')
|
||||
expect(a_post('/api/1/folders/delete'))
|
||||
.to have_been_made
|
||||
end
|
||||
|
||||
it 'should return an empty array on success' do
|
||||
it 'returns an empty array on success' do
|
||||
confirm = client.delete_folder('1')
|
||||
expect(confirm).to be true
|
||||
end
|
||||
|
|
@ -65,13 +65,13 @@ describe Instapaper::Client::Folders do
|
|||
.to_return(body: fixture('folders_set_order.json'), headers: {content_type: 'application/json; charset=utf-8'})
|
||||
end
|
||||
|
||||
it 'should get the correct resource' do
|
||||
it 'gets the correct resource' do
|
||||
client.set_order(['1121173:2', '1121174:1'])
|
||||
expect(a_post('/api/1/folders/set_order'))
|
||||
.to have_been_made
|
||||
end
|
||||
|
||||
it 'should return an array reflecting the new order on success' do
|
||||
it 'returns an array reflecting the new order on success' do
|
||||
folders = client.set_order(['1121173:2', '1121174:1'])
|
||||
expect(folders).to be_an Array
|
||||
expect(folders.first).to be_a Instapaper::Folder
|
||||
|
|
|
|||
|
|
@ -9,12 +9,12 @@ describe Instapaper::Client::Highlights do
|
|||
.to_return(status: 200, body: fixture('highlights_list.json'), headers: {content_type: 'application/json; charset=utf-8'})
|
||||
end
|
||||
|
||||
it 'should get the correct resource' do
|
||||
it 'gets the correct resource' do
|
||||
client.highlights(123)
|
||||
expect(a_post('/api/1.1/bookmarks/123/highlights')).to have_been_made
|
||||
end
|
||||
|
||||
it 'should return an array containing folders on success' do
|
||||
it 'returns an array containing folders on success' do
|
||||
highlights = client.highlights(123)
|
||||
expect(highlights).to be_an Array
|
||||
expect(highlights.size).to eq(2)
|
||||
|
|
@ -28,12 +28,12 @@ describe Instapaper::Client::Highlights do
|
|||
.to_return(status: 200, body: fixture('highlight.json'), headers: {content_type: 'application/json; charset=utf-8'})
|
||||
end
|
||||
|
||||
it 'should get the correct resource' do
|
||||
it 'gets the correct resource' do
|
||||
client.highlight(123, text: 'This is the highlighted text.', position: 22)
|
||||
expect(a_post('/api/1.1/bookmarks/123/highlight')).to have_been_made
|
||||
end
|
||||
|
||||
it 'should return an array containing folders on success' do
|
||||
it 'returns an array containing folders on success' do
|
||||
highlight = client.highlight(123, text: 'This is the highlighted text.', position: 22)
|
||||
expect(highlight).to be_an Instapaper::Highlight
|
||||
end
|
||||
|
|
@ -45,12 +45,12 @@ describe Instapaper::Client::Highlights do
|
|||
.to_return(status: 200, body: '', headers: {content_type: 'application/json; charset=utf-8'})
|
||||
end
|
||||
|
||||
it 'should post to the correct resource' do
|
||||
it 'posts to the correct resource' do
|
||||
client.delete_highlight(123)
|
||||
expect(a_post('/api/1.1/highlights/123/delete')).to have_been_made
|
||||
end
|
||||
|
||||
it 'should return true when successful' do
|
||||
it 'returns true when successful' do
|
||||
response = client.delete_highlight(123)
|
||||
expect(response).to be true
|
||||
end
|
||||
|
|
|
|||
|
|
@ -11,20 +11,20 @@ describe Instapaper::Client::OAuth do
|
|||
.to_return(body: fixture('invalid_credentials.qline'), headers: {content_type: 'text/plain; charset=utf-8'})
|
||||
end
|
||||
|
||||
it 'should get the correct resource' do
|
||||
it 'gets the correct resource' do
|
||||
client.token('ohai', 'p455w0rd')
|
||||
expect(a_post('/api/1/oauth/access_token'))
|
||||
.to have_been_made
|
||||
end
|
||||
|
||||
it 'should return the a hash containing an oauth token and secret' do
|
||||
it 'returns the a hash containing an oauth token and secret' do
|
||||
tokens = client.token('ohai', 'p455w0rd')
|
||||
expect(tokens).to be_a Hash
|
||||
expect(tokens.key?('oauth_token')).to be true
|
||||
expect(tokens.key?('oauth_token_secret')).to be true
|
||||
end
|
||||
|
||||
it 'should return a hash containing the error on invalid credentials' do
|
||||
it 'returns a hash containing the error on invalid credentials' do
|
||||
tokens = client.token('inval1d', 'cr3dentials')
|
||||
expect(tokens).to be_a Hash
|
||||
expect(tokens.key?('error')).to be true
|
||||
|
|
|
|||
Loading…
Reference in a new issue