Sha256: 6a9eb7b416f497342ca8db2439e26be103fb76b4d63f410f54216cd8ae5f995a
Contents?: true
Size: 1.49 KB
Versions: 6
Compression:
Stored size: 1.49 KB
Contents
require 'spec_helper' describe VkontakteApi::Error do let(:error_data) do Hashie::Mash.new( error_code: 5, error_msg: 'User authorization failed: invalid access_token.', request_params: [ { key: 'oauth', value: '1' }, { key: 'method', value: 'unknownMethod' }, { key: 'access_token', value: '123' } ] ) end describe "#message" do context "without parameters" do let(:error) { VkontakteApi::Error.new(error_data) } it "returns all needed data about an error" do message = 'VKontakte returned an error 5: \'User authorization failed: invalid access_token.\'' message << ' after calling method \'unknownMethod\' without parameters.' expect { raise error }.to raise_error(error.class, message) end end context "with parameters" do let(:error) do error_data[:request_params] << Hashie::Mash.new(key: 'some', value: 'params') VkontakteApi::Error.new(error_data) end it "returns all needed data about an error" do message = 'VKontakte returned an error 5: \'User authorization failed: invalid access_token.\'' message << ' after calling method \'unknownMethod\' with parameters {"some"=>"params"}.' expect { raise error }.to raise_error(error.class, message) end end end end
Version data entries
6 entries across 6 versions & 1 rubygems