spec/imgur_spec.rb in imgurapi-2.0.2 vs spec/imgur_spec.rb in imgurapi-3.0.0
- old
+ new
@@ -1,30 +1,30 @@
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
require 'imgur'
-describe Imgur do
+describe Imgurapi do
describe 'placeholder classes' do
it 'should create an Image with the fields provided' do
- image = Imgur::Image.new
- image.should be_an_instance_of Imgur::Image
+ image = Imgurapi::Image.new
+ image.should be_an_instance_of Imgurapi::Image
fields = {:a => 1, :b => 2}
- image = Imgur::Image.new(fields)
- image.should be_an_instance_of Imgur::Image
+ image = Imgurapi::Image.new(fields)
+ image.should be_an_instance_of Imgurapi::Image
image.a.should eq(1)
image.b.should eq(2)
end
it 'should create a Link with the fields provided' do
- links = Imgur::Links.new
- links.should be_an_instance_of Imgur::Links
+ links = Imgurapi::Links.new
+ links.should be_an_instance_of Imgurapi::Links
fields = {:a => 1, :b => 2}
- links = Imgur::Links.new(fields)
- links.should be_an_instance_of Imgur::Links
+ links = Imgurapi::Links.new(fields)
+ links.should be_an_instance_of Imgurapi::Links
links.a.should eq(1)
links.b.should eq(2)
end
end
@@ -46,11 +46,11 @@
describe 'communication' do
before(:all) do
credentials = read_credentials_file
- @session = Imgur::Session.new(credentials)
+ @session = Imgurapi::Session.new(credentials)
end
it 'should parse_message' do
@session.send(:parse_message, '[]').should eq([])
expect { session.send(:parse_message) }.to raise_error
@@ -82,21 +82,21 @@
@session.send(:compose_image, {:images => {:imae => {}, :links => {}}}).should eq(nil)
@session.send(:compose_image, {:images => {:image => {}, :lins => {}}}).should eq(nil)
@session.send(:compose_image, {:images => {}}).should eq(nil)
from_hash = {:images => {:image => {}, :links => {}}}
- @session.send(:compose_image, from_hash).should be_an_instance_of Imgur::Image
- @session.send(:compose_image, from_hash).links.should be_an_instance_of Imgur::Links
+ @session.send(:compose_image, from_hash).should be_an_instance_of Imgurapi::Image
+ @session.send(:compose_image, from_hash).links.should be_an_instance_of Imgurapi::Links
end
end
describe 'image management calls' do
before(:all) do
credentials = read_credentials_file
- @session = Imgur::Session.new(credentials)
+ @session = Imgurapi::Session.new(credentials)
@upload_path, @upload_file = my_sample_image
end
it 'should return my account information' do
@session.account.should be_an_instance_of Hash
@@ -109,24 +109,24 @@
it 'should upload the image' do
expect { @session.upload('') }.to raise_error
expect { @session.upload(:not_the_expected_object) }.to raise_error
@@image_by_path = @session.upload(@upload_path) #FIXME I know this is horrible, but I need to share the same image between tests http://brentlavelle.wordpress.com/2011/04/04/rspec-and-instance-variables/
- @@image_by_path.should be_an_instance_of Imgur::Image
+ @@image_by_path.should be_an_instance_of Imgurapi::Image
@@image_by_file = @session.upload(@upload_file)
- @@image_by_file.should be_an_instance_of Imgur::Image
+ @@image_by_file.should be_an_instance_of Imgurapi::Image
end
it 'should retrieve the image' do
expect { @session.find(:not_an_image_hash) }.to raise_error
expect { @session.find('r4ndom ha5h') }.to raise_error
image = @session.find('valid_hash_not_related_to_any_image')
image.should be_nil
image = @session.find(@@image_by_path.hash)
- image.should be_an_instance_of Imgur::Image
+ image.should be_an_instance_of Imgurapi::Image
image.hash.should eq(@@image_by_path.hash)
end
it 'should delete the image' do