Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Updated to Rails 3.0.5, Ruby 1.9.2, Mongoid 2.0.0.rc.7

  • Loading branch information...
commit c2b2f5e08303d5e8b8a5c19541b0b3f9e9233f11 1 parent 3afce2b
Dave South authored
View
24 Gemfile
@@ -1,27 +1,31 @@
source 'http://rubygems.org'
-gem 'rails', '3.0.0'
-gem 'mongrel'
-gem 'mongoid', '2.0.0.beta.18'
-gem 'bson_ext', '1.0.4'
+gem 'rails', '3.0.5'
+
+# MongoDB
+gem 'mongoid', '2.0.0.rc.7'
+gem 'bson_ext'
+
+# Template
gem 'haml'
+
+# Authentication
gem 'devise'
-gem 'carrierwave', :git => 'http://github.com/jnicklas/carrierwave.git'
+# Carrierwave
+gem 'carrierwave'
gem 'mini_magick'
-gem 'aws'
-
-gem 'ruby-debug', :group => [:development, :test]
+gem 'fog'
group :development do
gem 'haml-rails'
gem 'jquery-rails'
+ gem 'ruby-debug19'
end
group :test do
- gem 'rspec-rails', '>= 2.0.0.beta.17'
+ gem 'rspec-rails'
gem 'remarkable_mongoid'
gem 'fabrication'
gem 'faker'
- gem 'database_cleaner'
end
View
236 Gemfile.lock
@@ -1,164 +1,168 @@
-GIT
- remote: http://github.com/jnicklas/carrierwave.git
- revision: 015530b3cb83cc7988565d2d6f118d6b64b1f83c
- specs:
- carrierwave (0.5.0.beta2)
- activesupport (>= 3.0.0.rc)
-
GEM
remote: http://rubygems.org/
specs:
abstract (1.0.0)
- actionmailer (3.0.0)
- actionpack (= 3.0.0)
- mail (~> 2.2.5)
- actionpack (3.0.0)
- activemodel (= 3.0.0)
- activesupport (= 3.0.0)
+ actionmailer (3.0.5)
+ actionpack (= 3.0.5)
+ mail (~> 2.2.15)
+ actionpack (3.0.5)
+ activemodel (= 3.0.5)
+ activesupport (= 3.0.5)
builder (~> 2.1.2)
erubis (~> 2.6.6)
- i18n (~> 0.4.1)
+ i18n (~> 0.4)
rack (~> 1.2.1)
- rack-mount (~> 0.6.12)
- rack-test (~> 0.5.4)
+ rack-mount (~> 0.6.13)
+ rack-test (~> 0.5.7)
tzinfo (~> 0.3.23)
- activemodel (3.0.0)
- activesupport (= 3.0.0)
+ activemodel (3.0.5)
+ activesupport (= 3.0.5)
builder (~> 2.1.2)
- i18n (~> 0.4.1)
- activerecord (3.0.0)
- activemodel (= 3.0.0)
- activesupport (= 3.0.0)
- arel (~> 1.0.0)
+ i18n (~> 0.4)
+ activerecord (3.0.5)
+ activemodel (= 3.0.5)
+ activesupport (= 3.0.5)
+ arel (~> 2.0.2)
tzinfo (~> 0.3.23)
- activeresource (3.0.0)
- activemodel (= 3.0.0)
- activesupport (= 3.0.0)
- activesupport (3.0.0)
- arel (1.0.1)
- activesupport (~> 3.0.0)
- aws (2.3.20)
- http_connection
- uuidtools
- xml-simple
- bcrypt-ruby (2.1.2)
- bson (1.0.4)
- bson_ext (1.0.4)
+ activeresource (3.0.5)
+ activemodel (= 3.0.5)
+ activesupport (= 3.0.5)
+ activesupport (3.0.5)
+ archive-tar-minitar (0.5.2)
+ arel (2.0.9)
+ bcrypt-ruby (2.1.4)
+ bson (1.2.4)
+ bson_ext (1.2.4)
builder (2.1.2)
- cgi_multipart_eof_fix (2.5.0)
- columnize (0.3.1)
- daemons (1.1.0)
- database_cleaner (0.5.2)
- devise (1.1.2)
+ carrierwave (0.5.2)
+ activesupport (~> 3.0)
+ columnize (0.3.2)
+ devise (1.1.7)
bcrypt-ruby (~> 2.1.2)
- warden (~> 0.10.7)
+ warden (~> 1.0.2)
diff-lcs (1.1.2)
erubis (2.6.6)
abstract (>= 1.0.0)
- fabrication (0.6.4)
- faker (0.3.1)
- fastthread (1.0.7)
- gem_plugin (0.2.3)
- haml (3.0.18)
- haml-rails (0.2)
+ excon (0.5.6)
+ fabrication (0.9.5)
+ faker (0.9.5)
+ i18n (~> 0.4)
+ fog (0.6.0)
+ builder
+ excon (>= 0.5.5)
+ formatador (>= 0.0.16)
+ json
+ mime-types
+ net-ssh (>= 2.0.23)
+ nokogiri (>= 1.4.4)
+ ruby-hmac
+ formatador (0.0.16)
+ haml (3.0.25)
+ haml-rails (0.3.4)
+ actionpack (~> 3.0)
+ activesupport (~> 3.0)
haml (~> 3.0)
- rails (~> 3.0.0.rc)
- http_connection (1.3.0)
- i18n (0.4.1)
- jquery-rails (0.1.2)
- rails (~> 3.0.0.rc)
- linecache (0.43)
- mail (2.2.5)
+ railties (~> 3.0)
+ i18n (0.5.0)
+ jquery-rails (0.2.7)
+ rails (~> 3.0)
+ thor (~> 0.14.4)
+ json (1.5.1)
+ linecache19 (0.5.11)
+ ruby_core_source (>= 0.1.4)
+ mail (2.2.15)
activesupport (>= 2.3.6)
- mime-types
- treetop (>= 1.4.5)
+ i18n (>= 0.4.0)
+ mime-types (~> 1.16)
+ treetop (~> 1.4.8)
mime-types (1.16)
- mini_magick (2.1)
+ mini_magick (3.2)
subexec (~> 0.0.4)
- mongo (1.0.7)
- bson (>= 1.0.4)
- mongoid (2.0.0.beta.18)
- activemodel (~> 3.0.0)
- bson (= 1.0.4)
- mongo (= 1.0.7)
+ mongo (1.2.4)
+ bson (>= 1.2.4)
+ mongoid (2.0.0.rc.7)
+ activemodel (~> 3.0)
+ mongo (~> 1.2)
tzinfo (~> 0.3.22)
will_paginate (~> 3.0.pre)
- mongrel (1.1.5)
- cgi_multipart_eof_fix (>= 2.4)
- daemons (>= 1.0.3)
- fastthread (>= 1.0.1)
- gem_plugin (>= 0.2.3)
+ net-ssh (2.1.3)
+ nokogiri (1.4.4)
polyglot (0.3.1)
rack (1.2.1)
- rack-mount (0.6.12)
+ rack-mount (0.6.13)
rack (>= 1.0.0)
- rack-test (0.5.4)
+ rack-test (0.5.7)
rack (>= 1.0)
- rails (3.0.0)
- actionmailer (= 3.0.0)
- actionpack (= 3.0.0)
- activerecord (= 3.0.0)
- activeresource (= 3.0.0)
- activesupport (= 3.0.0)
- bundler (~> 1.0.0)
- railties (= 3.0.0)
- railties (3.0.0)
- actionpack (= 3.0.0)
- activesupport (= 3.0.0)
- rake (>= 0.8.4)
- thor (~> 0.14.0)
+ rails (3.0.5)
+ actionmailer (= 3.0.5)
+ actionpack (= 3.0.5)
+ activerecord (= 3.0.5)
+ activeresource (= 3.0.5)
+ activesupport (= 3.0.5)
+ bundler (~> 1.0)
+ railties (= 3.0.5)
+ railties (3.0.5)
+ actionpack (= 3.0.5)
+ activesupport (= 3.0.5)
+ rake (>= 0.8.7)
+ thor (~> 0.14.4)
rake (0.8.7)
remarkable (4.0.0.alpha4)
rspec (>= 2.0.0.alpha11)
remarkable_activemodel (4.0.0.alpha4)
remarkable (~> 4.0.0.alpha4)
rspec (>= 2.0.0.alpha11)
- remarkable_mongoid (0.4.0)
- remarkable_activemodel (>= 4.0.0.alpha2)
- rspec (2.0.0.beta.20)
- rspec-core (= 2.0.0.beta.20)
- rspec-expectations (= 2.0.0.beta.20)
- rspec-mocks (= 2.0.0.beta.20)
- rspec-core (2.0.0.beta.20)
- rspec-expectations (2.0.0.beta.20)
- diff-lcs (>= 1.1.2)
- rspec-mocks (2.0.0.beta.20)
- rspec-rails (2.0.0.beta.20)
- rspec (= 2.0.0.beta.20)
- ruby-debug (0.10.3)
- columnize (>= 0.1)
- ruby-debug-base (~> 0.10.3.0)
- ruby-debug-base (0.10.3)
- linecache (>= 0.3)
+ remarkable_mongoid (0.5.2)
+ remarkable_activemodel (~> 4.0.0.alpha4)
+ rspec (2.5.0)
+ rspec-core (~> 2.5.0)
+ rspec-expectations (~> 2.5.0)
+ rspec-mocks (~> 2.5.0)
+ rspec-core (2.5.1)
+ rspec-expectations (2.5.0)
+ diff-lcs (~> 1.1.2)
+ rspec-mocks (2.5.0)
+ rspec-rails (2.5.0)
+ actionpack (~> 3.0)
+ activesupport (~> 3.0)
+ railties (~> 3.0)
+ rspec (~> 2.5.0)
+ ruby-debug-base19 (0.11.24)
+ columnize (>= 0.3.1)
+ linecache19 (>= 0.5.11)
+ ruby_core_source (>= 0.1.4)
+ ruby-debug19 (0.11.6)
+ columnize (>= 0.3.1)
+ linecache19 (>= 0.5.11)
+ ruby-debug-base19 (>= 0.11.19)
+ ruby-hmac (0.4.0)
+ ruby_core_source (0.1.4)
+ archive-tar-minitar (>= 0.5.2)
subexec (0.0.4)
- thor (0.14.0)
- treetop (1.4.8)
+ thor (0.14.6)
+ treetop (1.4.9)
polyglot (>= 0.3.1)
- tzinfo (0.3.23)
- uuidtools (2.1.1)
- warden (0.10.7)
+ tzinfo (0.3.24)
+ warden (1.0.3)
rack (>= 1.0.0)
will_paginate (3.0.pre2)
- xml-simple (1.0.12)
PLATFORMS
ruby
DEPENDENCIES
- aws
- bson_ext (= 1.0.4)
- carrierwave!
- database_cleaner
+ bson_ext
+ carrierwave
devise
fabrication
faker
+ fog
haml
haml-rails
jquery-rails
mini_magick
- mongoid (= 2.0.0.beta.18)
- mongrel
- rails (= 3.0.0)
+ mongoid (= 2.0.0.rc.7)
+ rails (= 3.0.5)
remarkable_mongoid
- rspec-rails (>= 2.0.0.beta.17)
- ruby-debug
+ rspec-rails
+ ruby-debug19
View
4 app/models/photo.rb
@@ -23,8 +23,8 @@ class Photo
private
def save_dimensions
if image.path
- self.width = MiniMagick::Image.from_file(image.path)[:width]
- self.height = MiniMagick::Image.from_file(image.path)[:height]
+ self.width = MiniMagick::Image.open(image.path)[:width]
+ self.height = MiniMagick::Image.open(image.path)[:height]
end
end
View
30 spec/models/photo_spec.rb
@@ -6,17 +6,13 @@
# any extras we add -- like saving dimensions.
describe Photo do
- before(:each) do
- @story = Fabricate(:story)
- end
+ before { @story = Fabricate(:story) }
# Remarkable/mongoid macro
it { should be_embedded_in(:story) }
describe ".image" do
- before(:each) do
- MiniMagick::Image.stub!(:from_file).and_return(100)
- end
+ before { stub_magick }
it "should fail when no file is assigned" do
@photo = @story.photos.build
@@ -31,9 +27,8 @@
end
describe ".image dimensions" do
- before(:each) do
- MiniMagick::Image.should_receive(:from_file).
- exactly(2).and_return(:width => 640, :height => 480)
+ before do
+ stub_magick(640, 480)
@photo = @story.photos.create :image_filename => "test.jpg"
end
@@ -48,23 +43,21 @@
describe ".image orientation" do
it "should save as landscape" do
- MiniMagick::Image.should_receive(:from_file).
- exactly(2).and_return(:width => 640, :height => 480)
+ stub_magick(640, 480)
@photo = @story.photos.create :image_filename => "test.jpg"
@photo.orientation.should == "landscape"
end
it "should save as portrait" do
- MiniMagick::Image.should_receive(:from_file).
- exactly(2).and_return(:width => 480, :height => 640)
+ stub_magick(480, 640)
@photo = @story.photos.create :image_filename => "test.jpg"
@photo.orientation.should == "portrait"
end
end
describe "position" do
- before(:each) do
- MiniMagick::Image.stub!(:from_file).and_return(100)
+ before do
+ stub_magick
@photo1 = @story.photos.create :image_filename => "image1.jpg"
@photo2 = @story.photos.create :image_filename => "image2.jpg"
@photo3 = @story.photos.create :image_filename => "image3.jpg"
@@ -76,4 +69,11 @@
@photo3.position.should == 3
end
end
+
+ private
+
+ def stub_magick(width=1280, height=960)
+ MiniMagick::Image.stub!(:open).and_return(:width => width, :height => height)
+ end
+
end
View
10 spec/spec_helper.rb
@@ -2,7 +2,6 @@
ENV["RAILS_ENV"] ||= 'test'
require File.expand_path("../../config/environment", __FILE__)
require 'rspec/rails'
-require 'database_cleaner'
require 'fabrication'
# Requires supporting ruby files with custom matchers and macros, etc,
@@ -32,12 +31,9 @@
# instead of true.
# config.use_transactional_fixtures = true
- config.before(:suite) do
- DatabaseCleaner.orm = "mongoid"
- DatabaseCleaner.strategy = :truncation
- end
-
config.before(:each) do
- DatabaseCleaner.clean
+ Mongoid.master.collections.select do |collection|
+ collection.name !~ /system/
+ end.each(&:drop)
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.