spec/paperclip/storage/imgur_spec.rb in paperclip-imgur-0.1.5 vs spec/paperclip/storage/imgur_spec.rb in paperclip-imgur-0.2.0

- old
+ new

@@ -24,11 +24,11 @@ before :all do ActiveRecord::Base.send(:include, Paperclip::Glue) FileUtils.rm_rf 'tmp' FileUtils.mkdir_p 'tmp' - ActiveRecord::Base.establish_connection('sqlite3:///tmp/foo.sqlite3') + ActiveRecord::Base.establish_connection('sqlite3:///tmp/paperclip-imgur.sqlite3') CreateUsers.migrate(:up) Paperclip.options[:log] = false end after :all do @@ -41,11 +41,11 @@ expect { User.new.avatar }.to raise_error ArgumentError end it 'should accept a properly formed hash' do - set_options(imgur_credentials: {client_key: '1', client_secret: '2', access_token: '3', refresh_token: '4'}) + set_options(imgur_credentials: {client_id: '1', client_secret: '2', access_token: '3', refresh_token: '4'}) expect { User.new.avatar }.to_not raise_error end it 'should use config/imgur.yml under a Rails application if we left credentials blank' do @@ -78,22 +78,22 @@ end end describe '#url' do before do - User = Class.new(ActiveRecord::Base) { has_attached_file :avatar, storage: :imgur, imgur_credentials: {client_key: '1', client_secret: '2', access_token: '3', refresh_token: '4'} } + User = Class.new(ActiveRecord::Base) { has_attached_file :avatar, storage: :imgur, imgur_credentials: {client_id: '1', client_secret: '2', access_token: '3', refresh_token: '4', use_ssl: true} } end it "should return the missing image path if there's no image" do expect(User.new.avatar.url).to eq '/avatars/original/missing.png' expect(User.new.avatar.url(:random_size)).to eq '/avatars/random_size/missing.png' end it "should return Imgur's image paths if there's an image" do user = User.create(avatar_file_name: 'random_valid_hash') - expect(user.avatar.url(:random_size)).to eq "http://i.imgur.com/random_valid_hash.jpg" - expect(user.avatar.url(:small_square)).to eq "http://i.imgur.com/random_valid_hashs.jpg" - expect(user.avatar.url(:large_thumbnail)).to eq "http://i.imgur.com/random_valid_hashl.jpg" + expect(user.avatar.url(:random_size)).to eq "https://i.imgur.com/random_valid_hash.jpg" + expect(user.avatar.url(:small_square)).to eq "https://i.imgur.com/random_valid_hashs.jpg" + expect(user.avatar.url(:large_thumbnail)).to eq "https://i.imgur.com/random_valid_hashl.jpg" end end end