Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

got model specs to run on Rails 3.0 RC + RSpec 2

 - changed how Dataset is set up
 - `xit` → `pending`
 - `integrate_views` → `render_views`
 - removed old rake tasks
 - cleaned up spec_helper
 - moved "spec/matchers/" to "spec/support/" dir
  • Loading branch information...
commit b8c1594d9d8c61f1644774584f2c02bf41c7d7b8 1 parent 1cacb93
@mislav mislav authored
View
1  .rspec
@@ -0,0 +1 @@
+--colour
View
10 Gemfile
@@ -1,16 +1,18 @@
source :rubygems
-gem 'rails', '3.0.0.beta4', :git => 'git://github.com/rails/rails.git'
+# gem 'rails', '3.0.0.beta4', :git => 'git://github.com/rails/rails.git'
+gem 'rails', '3.0.0.rc' #, :path => '/Users/mislav/.coral/rails-3-0-stable'
gem 'radius', '0.7.0.prerelease', :path => 'vendor/radius'
gem 'RedCloth', '~> 4.2.2', :require => 'redcloth'
gem 'rdiscount', '~> 1.5.8'
gem 'rubypants', '~> 0.2.0'
gem 'highline', '~> 1.5.2'
-gem 'will_paginate', '3.0.pre', :git => 'git://github.com/mislav/will_paginate.git', :branch => 'rails3'
+gem 'will_paginate', '~> 3.0.pre2'
gem 'haml', '~> 2.2.20'
gem 'acts_as_tree', '~> 0.1.1'
gem 'rack-cache', '~> 0.5.2', :require => nil
+gem 'rspec-rails', '~> 2.0.0.beta.8'
group :development do
gem 'sqlite3-ruby', '~> 1.2.5', :require => 'sqlite3'
@@ -22,7 +24,7 @@ group :test do
gem 'cucumber-rails', '~> 0.3.0', :require => nil
gem 'database_cleaner', '~> 0.5.0', :require => nil
gem 'capybara', '~> 0.3.9', :require => nil
- gem 'rspec-rails', '~> 2.0.0.beta.8'
- gem 'dataset', '~> 1.3.1', :require => nil
+ # :path => '/Users/mislav/.coral/dataset-mislav'
+ gem 'dataset', '~> 1.4.0.radiant', :require => nil, :git => 'git://github.com/radiant/dataset.git'
# gem 'ruby-debug', '~> 0.10.3', :require => nil
end
View
141 Gemfile.lock
@@ -1,52 +1,10 @@
GIT
- remote: git://github.com/mislav/will_paginate.git
- revision: 60aa1c7
- branch: rails3
+ remote: git://github.com/radiant/dataset.git
+ revision: 9143cb3
specs:
- will_paginate (3.0.pre)
-
-GIT
- remote: git://github.com/rails/rails.git
- revision: 060ca6a
- specs:
- 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)
- builder (~> 2.1.2)
- erubis (~> 2.6.6)
- i18n (~> 0.4.1)
- rack (~> 1.2.1)
- rack-test (~> 0.5.4)
- tzinfo (~> 0.3.16)
- activemodel (3.0.0.beta4)
- activesupport (= 3.0.0.beta4)
- 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)
- 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 (>= 1.0.0.beta.3)
- 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.7)
+ dataset (1.4.0.radiant)
+ activerecord (>= 2.3.0)
+ activesupport (>= 2.3.0)
PATH
remote: vendor/radius
@@ -58,6 +16,32 @@ GEM
specs:
RedCloth (4.2.3)
abstract (1.0.0)
+ actionmailer (3.0.0.rc)
+ actionpack (= 3.0.0.rc)
+ mail (~> 2.2.5)
+ actionpack (3.0.0.rc)
+ activemodel (= 3.0.0.rc)
+ activesupport (= 3.0.0.rc)
+ builder (~> 2.1.2)
+ erubis (~> 2.6.6)
+ i18n (~> 0.4.1)
+ rack (~> 1.2.1)
+ rack-mount (~> 0.6.9)
+ rack-test (~> 0.5.4)
+ tzinfo (~> 0.3.22)
+ activemodel (3.0.0.rc)
+ activesupport (= 3.0.0.rc)
+ builder (~> 2.1.2)
+ i18n (~> 0.4.1)
+ activerecord (3.0.0.rc)
+ activemodel (= 3.0.0.rc)
+ activesupport (= 3.0.0.rc)
+ arel (~> 0.4.0)
+ tzinfo (~> 0.3.22)
+ activeresource (3.0.0.rc)
+ activemodel (= 3.0.0.rc)
+ activesupport (= 3.0.0.rc)
+ activesupport (3.0.0.rc)
acts_as_tree (0.1.1)
arel (0.4.0)
activesupport (>= 3.0.0.beta)
@@ -70,10 +54,10 @@ GEM
rack-test (>= 0.5.4)
selenium-webdriver (>= 0.0.3)
cgi_multipart_eof_fix (2.5.0)
- cucumber (0.8.3)
+ cucumber (0.8.5)
builder (~> 2.1.2)
diff-lcs (~> 1.1.2)
- gherkin (~> 2.0.2)
+ gherkin (~> 2.1.4)
json_pure (~> 1.4.3)
term-ansicolor (~> 1.0.4)
cucumber-rails (0.3.2)
@@ -81,9 +65,6 @@ GEM
culerity (0.2.10)
daemons (1.1.0)
database_cleaner (0.5.2)
- dataset (1.3.2)
- activerecord (>= 2.3.0)
- activesupport (>= 2.3.0)
diff-lcs (1.1.2)
erubis (2.6.6)
abstract (>= 1.0.0)
@@ -91,12 +72,12 @@ GEM
ffi (0.6.3)
rake (>= 0.8.7)
gem_plugin (0.2.3)
- gherkin (2.0.2)
+ gherkin (2.1.5)
trollop (~> 1.16.2)
haml (2.2.24)
highline (1.5.2)
i18n (0.4.1)
- json_pure (1.4.3)
+ json_pure (1.4.6)
mail (2.2.5)
activesupport (>= 2.3.6)
mime-types
@@ -108,41 +89,59 @@ GEM
fastthread (>= 1.0.1)
gem_plugin (>= 0.2.3)
mysql (2.8.1)
- nokogiri (1.4.2)
+ nokogiri (1.4.3.1)
polyglot (0.3.1)
rack (1.2.1)
rack-cache (0.5.2)
rack (>= 0.4)
+ rack-mount (0.6.9)
+ rack (>= 1.0.0)
rack-test (0.5.4)
rack (>= 1.0)
+ rails (3.0.0.rc)
+ actionmailer (= 3.0.0.rc)
+ actionpack (= 3.0.0.rc)
+ activerecord (= 3.0.0.rc)
+ activeresource (= 3.0.0.rc)
+ activesupport (= 3.0.0.rc)
+ bundler (>= 1.0.0.rc.1)
+ railties (= 3.0.0.rc)
+ railties (3.0.0.rc)
+ actionpack (= 3.0.0.rc)
+ activesupport (= 3.0.0.rc)
+ rake (>= 0.8.3)
+ thor (~> 0.14.0)
rake (0.8.7)
rdiscount (1.5.8.1)
- rspec (2.0.0.beta.17)
- rspec-core (= 2.0.0.beta.17)
- rspec-expectations (= 2.0.0.beta.17)
- rspec-mocks (= 2.0.0.beta.17)
- rspec-core (2.0.0.beta.17)
- rspec-expectations (2.0.0.beta.17)
+ rspec (2.0.0.beta.19)
+ rspec-core (= 2.0.0.beta.19)
+ rspec-expectations (= 2.0.0.beta.19)
+ rspec-mocks (= 2.0.0.beta.19)
+ rspec-core (2.0.0.beta.19)
+ rspec-expectations (2.0.0.beta.19)
diff-lcs (>= 1.1.2)
- rspec-mocks (2.0.0.beta.17)
- rspec-rails (2.0.0.beta.17)
- rspec (>= 2.0.0.beta.14)
- webrat (>= 0.7.0)
+ rspec-mocks (2.0.0.beta.19)
+ rspec-rails (2.0.0.beta.19)
+ rspec (= 2.0.0.beta.19)
+ webrat (>= 0.7.2.beta.1)
rubypants (0.2.0)
- selenium-webdriver (0.0.24)
+ rubyzip (0.9.4)
+ selenium-webdriver (0.0.27)
ffi (>= 0.6.1)
json_pure
+ rubyzip
sqlite3-ruby (1.2.5)
term-ansicolor (1.0.5)
- thor (0.13.7)
+ thor (0.14.0)
treetop (1.4.8)
polyglot (>= 0.3.1)
trollop (1.16.2)
tzinfo (0.3.22)
- webrat (0.7.1)
+ webrat (0.7.2.beta.1)
nokogiri (>= 1.2.0)
rack (>= 1.0)
rack-test (>= 0.5.3)
+ will_paginate (3.0.pre2)
PLATFORMS
ruby
@@ -153,16 +152,16 @@ DEPENDENCIES
capybara (~> 0.3.9)
cucumber-rails (~> 0.3.0)
database_cleaner (~> 0.5.0)
- dataset (~> 1.3.1)
+ dataset (~> 1.4.0.radiant)!
haml (~> 2.2.20)
highline (~> 1.5.2)
mongrel (~> 1.1.5)
mysql (~> 2.8.1)
rack-cache (~> 0.5.2)
radius (= 0.7.0.prerelease)!
- rails (= 3.0.0.beta4)!
+ rails (= 3.0.0.rc)
rdiscount (~> 1.5.8)
rspec-rails (~> 2.0.0.beta.8)
rubypants (~> 0.2.0)
sqlite3-ruby (~> 1.2.5)
- will_paginate (= 3.0.pre)!
+ will_paginate (~> 3.0.pre2)
View
2  Rakefile
@@ -4,4 +4,6 @@
require File.expand_path('../config/application', __FILE__)
require 'rake'
+require 'dataset/tasks'
+
Radiant::Application.load_tasks
View
221 lib/tasks/rspec.rake
@@ -1,221 +0,0 @@
-raise "To avoid rake task loading problems: run 'rake clobber' in vendor/plugins/rspec" if File.directory?(File.join(File.dirname(__FILE__), *%w[.. .. vendor plugins rspec pkg]))
-raise "To avoid rake task loading problems: run 'rake clobber' in vendor/plugins/rspec-rails" if File.directory?(File.join(File.dirname(__FILE__), *%w[.. .. vendor plugins rspec-rails pkg]))
-
-# In rails 1.2, plugins aren't available in the path until they're loaded.
-# Check to see if the rspec plugin is installed first and require
-# it if it is. If not, use the gem version.
-rspec_base = File.expand_path(File.dirname(__FILE__) + '/../../vendor/plugins/rspec/lib')
-$LOAD_PATH.unshift(rspec_base) if File.exist?(rspec_base)
-begin
- require 'spec/rake/spectask'
- require 'cucumber/rake/task'
-
- spec_prereq = File.exist?(Rails.root + 'config/database.yml') ? "db:test:prepare" : :noop
- task :noop do
- end
-
- task :default => :spec
- task :stats => "spec:statsetup"
-
- desc 'Run all specs in spec directory (excluding plugin & generator specs)'
- task :spec => spec_prereq do
- errors = %w(spec:integration spec:models spec:controllers spec:views spec:helpers spec:lib spec:generators spec:extensions).collect do |task|
- begin
- puts %{\nRunning #{task.gsub('spec:', '').titlecase} Spec Task}
- Rake::Task[task].invoke
- nil
- rescue => e
- task
- ensure
- if task == 'spec:integration'
- Rake::Task["db:test:load"].reenable
- Rake::Task["db:schema:load"].reenable
- Rake::Task["db:test:prepare"].execute
- end
- end
- end.compact
- abort "Errors running #{errors.to_sentence}!" if errors.any?
- end
-
- namespace :spec do
- desc "Run all specs in spec directory with RCov (excluding plugin & generator specs)"
- Spec::Rake::SpecTask.new(:rcov) do |t|
- t.spec_opts = ['--options', "\"#{RADIANT_ROOT}/spec/spec.opts\""]
- t.spec_files = FileList.new('spec/**/*_spec.rb') do |fl|
- fl.exclude(/generator/)
- end
- t.rcov = true
- t.rcov_opts = lambda do
- IO.readlines("#{RADIANT_ROOT}/spec/rcov.opts").map {|l| l.chomp.split " "}.flatten
- end
- end
-
- desc "Print Specdoc for all specs (excluding plugin & generator specs)"
- Spec::Rake::SpecTask.new(:doc) do |t|
- t.spec_opts = ["--format", "specdoc", "--dry-run"]
- t.spec_files = FileList.new('spec/**/*_spec.rb') do |fl|
- fl.exclude(/generator/)
- end
- end
-
- desc "Print Specdoc for all plugin specs"
- Spec::Rake::SpecTask.new(:plugin_doc) do |t|
- t.spec_opts = ["--format", "specdoc", "--dry-run"]
- t.spec_files = FileList['vendor/plugins/**/spec/**/*_spec.rb'].exclude('vendor/plugins/rspec/*')
- end
-
- [:models, :controllers, :views, :helpers, :lib].each do |sub|
- desc "Run the specs under spec/#{sub}"
- Spec::Rake::SpecTask.new(sub => spec_prereq) do |t|
- t.spec_opts = ['--options', "\"#{RADIANT_ROOT}/spec/spec.opts\""]
- t.spec_files = FileList["#{RADIANT_ROOT}/spec/#{sub}/**/*_spec.rb"]
- end
- end
- Cucumber::Rake::Task.new(:integration)# do |t|
- # t.cucumber_opts = ["--format","progress"]
- # t.feature_pattern = "#{RADIANT_ROOT}/features/**/*.feature"
- # end
-
- desc 'Run all specs in spec/generators directory'
- task :generators => spec_prereq do
- errors = ['spec:generators:extension_controller', 'spec:generators:extension_mailer',
- 'spec:generators:extension_migration', 'spec:generators:extension_model',
- 'spec:generators:extension', 'spec:generators:instance'].collect do |task|
- begin
- Rake::Task[task].invoke
- nil
- rescue => e
- task
- end
- end.compact
- abort "Errors running #{errors.to_sentence}!" if errors.any?
- end
-
- namespace :generators do
- [:extension_controller, :extension_mailer, :extension_migration, :extension_model, :extension, :instance].each do |generator|
- desc "Run the spec at spec/geneartors/#{generator}_generator_spec.rb"
- Spec::Rake::SpecTask.new(generator => spec_prereq) do |t|
- t.spec_opts = ['--options', "\"#{RADIANT_ROOT}/spec/spec.opts\""]
- t.spec_files = [File.join(RADIANT_ROOT, "spec/generators/#{generator}_generator_spec.rb")]
- end
- end
- end
-
- desc "Run the specs under vendor/plugins (except RSpec's own)"
- Spec::Rake::SpecTask.new(:plugins => spec_prereq) do |t|
- t.spec_opts = ['--options', "\"#{RADIANT_ROOT}/spec/spec.opts\""]
- t.spec_files = FileList['vendor/plugins/**/spec/**/*_spec.rb'].exclude('vendor/plugins/rspec/*').exclude("vendor/plugins/rspec-rails/*")
- end
-
- namespace :plugins do
- desc "Runs the examples for rspec_on_rails"
- Spec::Rake::SpecTask.new(:rspec_on_rails) do |t|
- t.spec_opts = ['--options', "\"#{RADIANT_ROOT}/spec/spec.opts\""]
- t.spec_files = FileList['vendor/plugins/rspec-rails/spec/**/*_spec.rb']
- end
- end
-
- # Setup specs for stats
- task :statsetup do
- require 'code_statistics'
- ::STATS_DIRECTORIES << %w(Model\ specs spec/models) if File.exist?('spec/models')
- ::STATS_DIRECTORIES << %w(View\ specs spec/views) if File.exist?('spec/views')
- ::STATS_DIRECTORIES << %w(Controller\ specs spec/controllers) if File.exist?('spec/controllers')
- ::STATS_DIRECTORIES << %w(Helper\ specs spec/helpers) if File.exist?('spec/helpers')
- ::STATS_DIRECTORIES << %w(Library\ specs spec/lib) if File.exist?('spec/lib')
- ::STATS_DIRECTORIES << %w(Integration\ specs spec/integration) if File.exist?('spec/integration')
- ::STATS_DIRECTORIES << %w(Generator\ specs spec/generators) if File.exist?('spec/generators')
- ::CodeStatistics::TEST_TYPES << "Model specs" if File.exist?('spec/models')
- ::CodeStatistics::TEST_TYPES << "View specs" if File.exist?('spec/views')
- ::CodeStatistics::TEST_TYPES << "Controller specs" if File.exist?('spec/controllers')
- ::CodeStatistics::TEST_TYPES << "Helper specs" if File.exist?('spec/helpers')
- ::CodeStatistics::TEST_TYPES << "Library specs" if File.exist?('spec/lib')
- ::CodeStatistics::TEST_TYPES << "Generator specs" if File.exist?('spec/generators')
- ::STATS_DIRECTORIES.delete_if {|a| a[0] =~ /test/}
- end
-
- namespace :db do
- namespace :fixtures do
- desc "Load fixtures (from spec/fixtures) into the current environment's database. Load specific fixtures using FIXTURES=x,y"
- task :load => :environment do
- require 'active_record/fixtures'
- ActiveRecord::Base.establish_connection(RAILS_ENV.to_sym)
- (ENV['FIXTURES'] ? ENV['FIXTURES'].split(/,/) : Dir.glob(File.join(RADIANT_ROOT, 'spec', 'fixtures', '*.{yml,csv}'))).each do |fixture_file|
- Fixtures.create_fixtures('spec/fixtures', File.basename(fixture_file, '.*'))
- end
- end
- end
- end
-
- namespace :server do
- daemonized_server_pid = Rails.root + 'tmp/spec_server.pid'
-
- desc "start spec_server."
- task :start do
- if File.exist?(daemonized_server_pid)
- $stderr.puts "spec_server is already running."
- else
- $stderr.puts "Starting up spec server."
- system("ruby", "script/spec_server", "--daemon", "--pid", daemonized_server_pid)
- end
- end
-
- desc "stop spec_server."
- task :stop do
- unless File.exist?(daemonized_server_pid)
- $stderr.puts "No server running."
- else
- $stderr.puts "Shutting down spec_server."
- system("kill", "-s", "TERM", File.read(daemonized_server_pid).strip) &&
- File.delete(daemonized_server_pid)
- end
- end
-
- desc "reload spec_server."
- task :restart do
- unless File.exist?(daemonized_server_pid)
- $stderr.puts "No server running."
- else
- $stderr.puts "Reloading down spec_server."
- system("kill", "-s", "USR2", File.read(daemonized_server_pid).strip)
- end
- end
- end
- end
-rescue LoadError
- task :spec_prereq do
- puts "Required dependencies RSpec, RSpec-Rails or Cucumber are missing.\nRun 'rake gems:install RAILS_ENV=test'"
- end
-
- task :spec => :spec_prereq
- namespace :spec do
- %w(integration models controllers views helpers lib generators).each do |t|
- task t => :spec_prereq
- end
-
- namespace :generators do
- [:extension_controller, :extension_mailer, :extension_migration, :extension_model, :extension, :instance].each do |t|
- task t => :spec_prereq
- end
- end
-
- task :plugins => :spec_prereq
- namespace :plugins do
- task :rspec_on_rails => :spec_prereq
- end
-
- task :statsetup => :spec_prereq
-
- namespace :db do
- namespace :fixtures do
- task :load => :spec_prereq
- end
- end
-
- namespace :server do
- [:start, :stop, :restart].each do |t|
- task t => :spec_prereq
- end
- end
- end
-end
View
4 spec/controllers/admin/pages_controller_spec.rb
@@ -60,7 +60,7 @@
end
describe "viewing the sitemap" do
- integrate_views
+ render_views
it "should render when the homepage is present" do
get :index
@@ -192,7 +192,7 @@
describe "prompting page removal" do
- integrate_views
+ render_views
# TODO: This should be in a view or integration spec
it "should render the expanded descendants of the page being removed" do
View
4 spec/lib/radiant/admin_ui/nav_tabs_spec.rb
@@ -90,11 +90,11 @@
describe "generating a relative url" do
# TODO: provide an equivalent in Rails 3
- xit "should return the original url when no relative_url_root is set" do
+ pending "should return the original url when no relative_url_root is set" do
@subitem.relative_url.should == "/admin/pages"
end
- xit "should make the url relative to the relative_url_root when set" do
+ pending "should make the url relative to the relative_url_root when set" do
ActionController::Base.relative_url_root = '/radiant'
@subitem.relative_url.should == "/radiant/admin/pages"
end
View
8 spec/models/standard_tags_spec.rb
@@ -16,12 +16,12 @@
end
end
- xit "<r:url> with a nil relative URL root should scope to the relative root of /" do
+ pending "<r:url> with a nil relative URL root should scope to the relative root of /" do
ActionController::Base.relative_url_root = nil
page(:home).should render("<r:url />").as("/")
end
- xit '<r:url> with a relative URL root should scope to the relative root' do
+ pending '<r:url> with a relative URL root should scope to the relative root' do
page(:home).should render("<r:url />").with_relative_root("/foo").as("/foo/")
end
@@ -636,7 +636,7 @@
page(:parent).should render('<r:children:each><r:link /> </r:children:each>' ).as(expected)
end
- xit "should scope the link within the relative URL root" do
+ pending "should scope the link within the relative URL root" do
page(:assorted).should render('<r:link />').with_relative_root('/foo').as('<a href="/foo/assorted/">Assorted</a>')
end
end
@@ -859,7 +859,7 @@
page(:parent).should render('<r:breadcrumbs nolinks="true" />').as(expected)
end
- xit "with a relative URL root should scope links to the relative root" do
+ pending "with a relative URL root should scope links to the relative root" do
expected = '<a href="/foo/">Home</a> &gt; Assorted'
page(:assorted).should render('<r:breadcrumbs />').with_relative_root('/foo').as(expected)
end
View
89 spec/spec_helper.rb
@@ -3,72 +3,31 @@
SPEC_ROOT = File.expand_path(File.dirname(__FILE__))
- unless defined? RADIANT_ROOT
- if env_file = ENV["RADIANT_ENV_FILE"]
- require env_file
- else
- require File.expand_path(SPEC_ROOT + "/../config/environment")
- end
- end
- require 'spec'
- require 'spec/rails'
+ require File.expand_path("../../config/environment", __FILE__)
+ require 'rspec/rails'
require 'dataset'
-
- module Kernel
- def rputs(*args)
- puts *["<pre>", args.collect {|a| CGI.escapeHTML(a.inspect)}, "</pre>"]
- end
- end
-
- class ActiveSupport::TestCase
- include Dataset
- datasets_directory "#{RADIANT_ROOT}/spec/datasets"
- Dataset::ContextClassMethods.datasets_database_dump_path = File.expand_path(RAILS_ROOT + '/tmp/dataset')
-
- class << self
- # Class method for test helpers
- def test_helper(*names)
- names.each do |name|
- name = name.to_s
- name = $1 if name =~ /^(.*?)_test_helper$/i
- name = name.singularize
- first_time = true
- begin
- constant = (name.camelize + 'TestHelper').constantize
- self.class_eval { include constant }
- rescue NameError
- filename = File.expand_path(SPEC_ROOT + '/../test/helpers/' + name + '_test_helper.rb')
- require filename if first_time
- first_time = false
- retry
- end
- end
- end
- alias :test_helpers :test_helper
- end
- end
-
- Dir[RADIANT_ROOT + '/spec/matchers/*_matcher.rb'].each do |matcher|
- require matcher
- end
-
- module Spec
- module Application
- module ExampleExtensions
- def rails_log
- log = IO.read(RAILS_ROOT + '/log/test.log')
- log.should_not be_nil
- log
- end
- end
- end
- end
-
- Spec::Runner.configure do |config|
- config.include Spec::Application::ExampleExtensions
-
+ require 'dataset/extensions/rspec'
+
+ Dir["#{Rails.root}/spec/support/**/*.rb"].each {|f| require f}
+
+ RSpec.configure do |config|
+ include Spec::Rails::Matchers
+
+ # == Mock Framework
+ #
+ # If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
+ #
+ # config.mock_with :mocha
+ # config.mock_with :flexmock
+ # config.mock_with :rr
+ config.mock_with :rspec
+
+ config.fixture_path = "#{::Rails.root}/spec/fixtures"
+
+ # If you're not using ActiveRecord, or you'd prefer not to run each of your
+ # examples within a transaction, comment the following line or assign false
+ # instead of true.
config.use_transactional_fixtures = true
config.use_instantiated_fixtures = false
- config.fixture_path = RAILS_ROOT + '/spec/fixtures/'
end
-end
+end
View
0  spec/matchers/autotest_matchers.rb → spec/support/autotest_matchers.rb
File renamed without changes
View
0  spec/matchers/generator_matchers.rb → spec/support/generator_matchers.rb
File renamed without changes
View
0  spec/matchers/login_system_matcher.rb → spec/support/login_system_matcher.rb
File renamed without changes
View
0  spec/matchers/render_form_errors_matcher.rb → spec/support/render_form_errors_matcher.rb
File renamed without changes
View
2  spec/matchers/render_matcher.rb → spec/support/render_matcher.rb
@@ -94,7 +94,7 @@ def on(url)
def render_content_with_page(tag_content, page)
page.request = ActionController::TestRequest.new
page.request.params[:sample_param] = 'data'
- page.request.fullpath = @request_uri || page.url
+ page.request.request_uri = @request_uri || page.url
page.request.host = @host || test_host
page.response = ActionController::TestResponse.new
if tag_content.nil?
View
29 spec/support/test_helpers.rb
@@ -0,0 +1,29 @@
+module TestHelperDirective
+ # Class method for test helpers
+ def test_helper(*names)
+ names.each do |name|
+ name = name.to_s
+ name = $1 if name =~ /^(.+)_test_helper$/i
+ name = name.singularize
+ first_time = true
+ begin
+ constant = (name.camelize + 'TestHelper').constantize
+ self.send(:include, constant)
+ rescue NameError
+ if first_time
+ filename = Rails.root + 'test/helpers' + "#{name}_test_helper"
+ require filename
+ first_time = false
+ retry
+ else
+ raise
+ end
+ end
+ end
+ end
+ alias :test_helpers :test_helper
+end
+
+RSpec.configure do |config|
+ config.extend TestHelperDirective
+end
View
2  test/helpers/render_test_helper.rb
@@ -52,7 +52,7 @@ def get_render_output(input, url, host = nil)
def setup_page(url = nil, host = nil)
@page.request = ActionController::TestRequest.new
- @page.request.fullpath = url || @page.url
+ @page.request.request_uri = url || @page.url
@page.request.host = host || "testhost.tld"
@page.response = ActionController::TestResponse.new
end
Please sign in to comment.
Something went wrong with that request. Please try again.