From 23a521f7c72b3a3481cdc02ccf42ded56c324a31 Mon Sep 17 00:00:00 2001 From: Stefan Penner Date: Mon, 27 Feb 2012 16:41:29 -0600 Subject: [PATCH] quality change --- Gemfile | 1 + Gemfile.lock | 31 +++++++++++++------------------ actions/image.rb | 4 +++- spec/actions/noun_spec.rb | 6 +++--- spec/sources/bing_spec.rb | 1 + 5 files changed, 21 insertions(+), 22 deletions(-) diff --git a/Gemfile b/Gemfile index d37e036..8beaedb 100644 --- a/Gemfile +++ b/Gemfile @@ -13,6 +13,7 @@ gem 'racksh' gem 'rack-cache', require: false gem 'dalli' gem 'unicorn' + group :development,:test do gem 'rspec' gem 'pry' diff --git a/Gemfile.lock b/Gemfile.lock index 608a6f1..d435ba5 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -6,20 +6,18 @@ GEM mime-types xml-simple builder (3.0.0) - coderay (0.9.8) - dalli (1.1.4) + coderay (1.0.5) + dalli (1.1.5) diff-lcs (1.1.3) json (1.6.5) kgio (2.7.2) - method_source (0.6.7) - ruby_parser (>= 2.3.1) + method_source (0.7.0) mime-types (1.17.2) - newrelic_rpm (3.3.1) - pry (0.9.7.4) - coderay (~> 0.9.8) - method_source (~> 0.6.7) - ruby_parser (>= 2.3.1) - slop (~> 2.1.0) + newrelic_rpm (3.3.2) + pry (0.9.8.2) + coderay (~> 1.0.5) + method_source (~> 0.7) + slop (>= 2.4.4, < 3) rack (1.4.1) rack-cache (1.1) rack (>= 0.4) @@ -44,22 +42,19 @@ GEM diff-lcs (~> 1.1.2) rspec-mocks (2.8.0) ruby-prof (0.10.8) - ruby_parser (2.3.1) - sexp_processor (~> 3.0) - sequel (3.31.0) - sexp_processor (3.0.10) + sequel (3.32.0) sinatra (1.3.2) rack (~> 1.3, >= 1.3.6) rack-protection (~> 1.2) tilt (~> 1.3, >= 1.3.3) sinatra-cache-assets (0.0.3) sinatra (>= 1.0) - slop (2.1.0) + slop (2.4.4) tilt (1.3.3) - unicorn (4.1.1) - kgio (~> 2.4) + unicorn (4.2.0) + kgio (~> 2.6) rack - raindrops (~> 0.6) + raindrops (~> 0.7) xml-simple (1.1.1) PLATFORMS diff --git a/actions/image.rb b/actions/image.rb index 664c825..ec51968 100644 --- a/actions/image.rb +++ b/actions/image.rb @@ -78,7 +78,9 @@ def self.annotate(img, noun, shirtastic=false) caption.text(width/2.0, height-(50*factor), "FUCK YEAH\n#{noun.upcase}") caption.draw(picture) - picture.compression = Magick::LosslessJPEGCompression + + picture.to_blob { self.quality = 50 } + tmp = Tempfile.new('asdf') tmp.write(picture.to_blob) tmp diff --git a/spec/actions/noun_spec.rb b/spec/actions/noun_spec.rb index 7567210..1831331 100644 --- a/spec/actions/noun_spec.rb +++ b/spec/actions/noun_spec.rb @@ -3,8 +3,8 @@ require './actions/noun' describe Actions::Noun do - context"valid noun" do - let(:subject) do + context "valid noun" do + subject do Actions::Noun.create("sleepy") end @@ -15,7 +15,7 @@ end - context"nsfw noun" do + context "nsfw noun" do let(:subject) do Actions::Noun.create("boob") end diff --git a/spec/sources/bing_spec.rb b/spec/sources/bing_spec.rb index c28ef23..bbedfee 100644 --- a/spec/sources/bing_spec.rb +++ b/spec/sources/bing_spec.rb @@ -4,6 +4,7 @@ describe '.process_json' do subject { Bing.process_json(Bing.open_json('./spec/support/bing.json')) } + its([:total]) { should equal 5660 } its([:images]) { should respond_to :each } end