Skip to content
Browse files

Fixes for Rails 3.0.3 and RSpec 2.3

  • Loading branch information...
1 parent ada334c commit 11d7dca85a523cefbb6c2aeea9eb9445a2ab2c47 @jferris jferris committed with jferris
View
4 Gemfile
@@ -1,9 +1,9 @@
source 'http://rubygems.org'
-gem 'rails', '3.0.0.beta4'
+gem 'rails', '3.0.3'
gem 'sqlite3-ruby', :require => 'sqlite3'
gem 'mocha'
-gem 'rspec-rails', '2.0.0.beta.12'
+gem 'rspec-rails'
gem 'ruby-debug'
gem 'cucumber'
View
132 Gemfile.lock
@@ -2,49 +2,48 @@ GEM
remote: http://rubygems.org/
specs:
abstract (1.0.0)
- actionmailer (3.0.0.beta4)
- actionpack (= 3.0.0.beta4)
- mail (~> 2.2.3)
- actionpack (3.0.0.beta4)
- activemodel (= 3.0.0.beta4)
- activesupport (= 3.0.0.beta4)
+ actionmailer (3.0.3)
+ actionpack (= 3.0.3)
+ mail (~> 2.2.9)
+ actionpack (3.0.3)
+ activemodel (= 3.0.3)
+ activesupport (= 3.0.3)
builder (~> 2.1.2)
- erubis (~> 2.6.5)
- i18n (~> 0.4.1)
- rack (~> 1.1.0)
- rack-mount (~> 0.6.3)
- rack-test (~> 0.5.4)
- tzinfo (~> 0.3.16)
- activemodel (3.0.0.beta4)
- activesupport (= 3.0.0.beta4)
+ erubis (~> 2.6.6)
+ i18n (~> 0.4)
+ rack (~> 1.2.1)
+ rack-mount (~> 0.6.13)
+ rack-test (~> 0.5.6)
+ tzinfo (~> 0.3.23)
+ activemodel (3.0.3)
+ activesupport (= 3.0.3)
builder (~> 2.1.2)
- i18n (~> 0.4.1)
- activerecord (3.0.0.beta4)
- activemodel (= 3.0.0.beta4)
- activesupport (= 3.0.0.beta4)
- arel (~> 0.4.0)
- tzinfo (~> 0.3.16)
- activeresource (3.0.0.beta4)
- activemodel (= 3.0.0.beta4)
- activesupport (= 3.0.0.beta4)
- activesupport (3.0.0.beta4)
- arel (0.4.0)
- activesupport (>= 3.0.0.beta)
+ i18n (~> 0.4)
+ activerecord (3.0.3)
+ activemodel (= 3.0.3)
+ activesupport (= 3.0.3)
+ arel (~> 2.0.2)
+ tzinfo (~> 0.3.23)
+ activeresource (3.0.3)
+ activemodel (= 3.0.3)
+ activesupport (= 3.0.3)
+ activesupport (3.0.3)
+ arel (2.0.6)
builder (2.1.2)
- columnize (0.3.1)
- cucumber (0.9.4)
- builder (~> 2.1.2)
+ columnize (0.3.2)
+ cucumber (0.10.0)
+ builder (>= 2.1.2)
diff-lcs (~> 1.1.2)
- gherkin (~> 2.2.9)
+ gherkin (~> 2.3.2)
json (~> 1.4.6)
term-ansicolor (~> 1.0.5)
diff-lcs (1.1.2)
erubis (2.6.6)
abstract (>= 1.0.0)
- gherkin (2.2.9)
+ gherkin (2.3.2)
json (~> 1.4.6)
term-ansicolor (~> 1.0.5)
- i18n (0.4.1)
+ i18n (0.5.0)
json (1.4.6)
linecache (0.43)
mail (2.2.12)
@@ -55,53 +54,50 @@ GEM
mime-types (1.16)
mocha (0.9.10)
rake
- nokogiri (1.4.4)
polyglot (0.3.1)
- rack (1.1.0)
+ rack (1.2.1)
rack-mount (0.6.13)
rack (>= 1.0.0)
rack-test (0.5.6)
rack (>= 1.0)
- rails (3.0.0.beta4)
- actionmailer (= 3.0.0.beta4)
- actionpack (= 3.0.0.beta4)
- activerecord (= 3.0.0.beta4)
- activeresource (= 3.0.0.beta4)
- activesupport (= 3.0.0.beta4)
- bundler (>= 0.9.26)
- railties (= 3.0.0.beta4)
- railties (3.0.0.beta4)
- actionpack (= 3.0.0.beta4)
- activesupport (= 3.0.0.beta4)
- rake (>= 0.8.3)
- thor (~> 0.13.6)
+ rails (3.0.3)
+ actionmailer (= 3.0.3)
+ actionpack (= 3.0.3)
+ activerecord (= 3.0.3)
+ activeresource (= 3.0.3)
+ activesupport (= 3.0.3)
+ bundler (~> 1.0)
+ railties (= 3.0.3)
+ railties (3.0.3)
+ actionpack (= 3.0.3)
+ activesupport (= 3.0.3)
+ rake (>= 0.8.7)
+ thor (~> 0.14.4)
rake (0.8.7)
- rspec (2.0.0.beta.12)
- rspec-core (= 2.0.0.beta.12)
- rspec-expectations (= 2.0.0.beta.12)
- rspec-mocks (= 2.0.0.beta.12)
- rspec-core (2.0.0.beta.12)
- rspec-expectations (2.0.0.beta.12)
- diff-lcs (>= 1.1.2)
- rspec-mocks (2.0.0.beta.12)
- rspec-rails (2.0.0.beta.12)
- rspec (= 2.0.0.beta.12)
- webrat (>= 0.7.0)
- ruby-debug (0.10.3)
+ rspec (2.3.0)
+ rspec-core (~> 2.3.0)
+ rspec-expectations (~> 2.3.0)
+ rspec-mocks (~> 2.3.0)
+ rspec-core (2.3.0)
+ rspec-expectations (2.3.0)
+ diff-lcs (~> 1.1.2)
+ rspec-mocks (2.3.0)
+ rspec-rails (2.3.0)
+ actionpack (~> 3.0)
+ activesupport (~> 3.0)
+ railties (~> 3.0)
+ rspec (~> 2.3.0)
+ ruby-debug (0.10.4)
columnize (>= 0.1)
- ruby-debug-base (~> 0.10.3.0)
- ruby-debug-base (0.10.3)
+ ruby-debug-base (~> 0.10.4.0)
+ ruby-debug-base (0.10.4)
linecache (>= 0.3)
sqlite3-ruby (1.3.2)
term-ansicolor (1.0.5)
- thor (0.13.8)
+ thor (0.14.6)
treetop (1.4.9)
polyglot (>= 0.3.1)
tzinfo (0.3.23)
- webrat (0.7.2)
- nokogiri (>= 1.2.0)
- rack (>= 1.0)
- rack-test (>= 0.5.3)
PLATFORMS
ruby
@@ -109,7 +105,7 @@ PLATFORMS
DEPENDENCIES
cucumber
mocha
- rails (= 3.0.0.beta4)
- rspec-rails (= 2.0.0.beta.12)
+ rails (= 3.0.3)
+ rspec-rails
ruby-debug
sqlite3-ruby
View
3 Rakefile
@@ -19,10 +19,13 @@ Rake::RDocTask.new { |rdoc|
RSpec::Core::RakeTask.new do |t|
t.pattern = "spec/**/*_spec.rb"
+ t.rspec_opts = '--color --format progress'
+ t.verbose = false
end
desc "Run code-coverage analysis using rcov"
RSpec::Core::RakeTask.new(:coverage) do |t|
+ t.rspec_opts = '--color --format progress'
t.rcov = true
t.rcov_opts = %{--exclude osx\/objc,spec,gems\/ --failure-threshold 100}
t.pattern = "spec/**/*_spec.rb"
View
6 features/step_definitions/rails3_steps.rb
@@ -1,11 +1,11 @@
When /^I generate a new rails application$/ do
@terminal.cd(TEMP_ROOT)
- @terminal.run("rails _3.0.0.beta4_ new #{APP_NAME}")
+ @terminal.run("rails _3.0.3_ new #{APP_NAME}")
steps %{
When I save the following as "Gemfile"
"""
source "http://rubygems.org"
- gem 'rails', '3.0.0.beta4'
+ gem 'rails', '3.0.3'
gem 'sqlite3-ruby', :require => 'sqlite3'
"""
}
@@ -29,7 +29,7 @@
end
When /^I configure the application to use rspec\-rails$/ do
- append_to_gemfile "gem 'rspec-rails', '= 2.0.0.beta.12'"
+ append_to_gemfile "gem 'rspec-rails'"
steps %{And I run "bundle install"}
end
View
8 lib/shoulda/active_record/allow_mass_assignment_of_matcher.rb
@@ -21,12 +21,12 @@ def matches?(subject)
@subject = subject
if attr_mass_assignable?
if whitelisting?
- @failure_message = "#{@attribute} was made accessible"
+ @negative_failure_message = "#{@attribute} was made accessible"
else
if protected_attributes.empty?
@negative_failure_message = "no attributes were protected"
else
- @failure_message = "#{class_name} is protecting " <<
+ @negative_failure_message = "#{class_name} is protecting " <<
"#{protected_attributes.to_a.to_sentence}, " <<
"but not #{@attribute}."
end
@@ -34,10 +34,10 @@ def matches?(subject)
true
else
if whitelisting?
- @negative_failure_message =
+ @failure_message =
"Expected #{@attribute} to be accessible"
else
- @negative_failure_message =
+ @failure_message =
"Did not expect #{@attribute} to be protected"
end
false
View
1 spec/rails3_root/config/environments/test.rb
@@ -29,4 +29,5 @@
# This is necessary if your schema can't be completely dumped by the schema dumper,
# like if you have constraints or database-specific column types
# config.active_record.schema_format = :sql
+ config.active_support.deprecation = :stderr
end
View
4 spec/rails3_root/config/routes.rb
@@ -1,4 +1,2 @@
-Rails.application.routes.draw do |map|
- map.resources :users, :has_many => :posts
- map.resources :posts
+Rails3Root::Application.routes.draw do
end
View
12 spec/shoulda/action_controller/route_matcher_spec.rb
@@ -5,15 +5,14 @@
context "given a controller with a defined glob url" do
before do
@controller = define_controller('Examples').new
- define_routes do |map|
- map.connect 'examples/*id', :controller => 'examples',
- :action => 'example'
+ define_routes do
+ match 'examples/*id', :to => 'examples#example'
end
end
it "should accept glob route" do
@controller.should route(:get, '/examples/foo/bar').
- to(:action => 'example', :id => ['foo', 'bar'])
+ to(:action => 'example', :id => 'foo/bar')
end
end
@@ -21,9 +20,8 @@
context "given a controller with a defined route" do
before do
@controller = define_controller('Examples').new
- define_routes do |map|
- map.connect 'examples/:id', :controller => 'examples',
- :action => 'example'
+ define_routes do
+ match 'examples/:id', :to => 'examples#example'
end
end
View
2 spec/shoulda/active_record/allow_mass_assignment_of_matcher_spec.rb
@@ -66,7 +66,7 @@
it "should assign a negative failure message" do
matcher = allow_mass_assignment_of(:attr)
- matcher.matches?(@model)
+ matcher.matches?(@model).should == true
matcher.negative_failure_message.should_not be_nil
end
end
View
2 spec/spec_helper.rb
@@ -1,5 +1,5 @@
ENV['RAILS_ENV'] = 'test'
-ENV['RAILS_VERSION'] ||= '3.0.0.beta4'
+ENV['RAILS_VERSION'] ||= '3.0.3'
RAILS_GEM_VERSION = ENV['RAILS_VERSION']
rails_root = File.dirname(__FILE__) + '/rails3_root'
View
15 spec/support/model_builder.rb
@@ -6,7 +6,6 @@ def self.included(example_group)
example_group.class_eval do
before do
@created_tables ||= []
- @defined_constants ||= []
end
after { teardown_defined_constants }
@@ -32,11 +31,10 @@ def define_constant(class_name, base, &block)
klass = Class.new(base)
Object.const_set(class_name, klass)
+ klass.unloadable
klass.class_eval(&block) if block_given?
- @defined_constants << class_name
-
klass
end
@@ -81,8 +79,8 @@ def build_response(opts = {}, &block)
klass = define_controller('Examples')
block ||= lambda { render :nothing => true }
klass.class_eval { layout false; define_method(action, &block) }
- define_routes do |map|
- map.connect 'examples', :controller => 'examples', :action => action
+ define_routes do
+ match 'examples', :to => "examples##{action}"
end
create_view("examples/#{action}.html.erb", "abc")
@@ -111,10 +109,7 @@ def create_view(path, contents)
end
def teardown_defined_constants
- @defined_constants.each do |class_name|
- Object.send(:remove_const, class_name)
- end
- @defined_constants = []
+ ActiveSupport::Dependencies.clear
@created_tables.each do |table_name|
ActiveRecord::Base.
@@ -124,7 +119,7 @@ def teardown_defined_constants
FileUtils.rm_rf(TMP_VIEW_PATH)
- Rails.application.routes_reloader.reload!
+ Rails.application.reload_routes!
end
end

0 comments on commit 11d7dca

Please sign in to comment.
Something went wrong with that request. Please try again.