rspec-rails 2.0.0.beta.20 → 2.0.0.beta.22

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -11,10 +11,11 @@ gem 'rspec', :path => "../rspec"
11
11
 
12
12
  gem 'cucumber'
13
13
  gem 'aruba', ">= 0.2.0", :require => nil
14
- gem 'jeweler'
15
14
  gem 'webrat', ">= 0.7.2.beta.1"
16
15
  gem 'sqlite3-ruby', :require => 'sqlite3'
17
16
 
17
+ gem 'autotest'
18
+
18
19
  case RUBY_VERSION
19
20
  when /^1\.9/
20
21
  gem 'ruby-debug19'
@@ -0,0 +1,33 @@
1
+ ## rspec-rails release history (incomplete)
2
+
3
+ ### 2.0.0.beta.22 / 2010-09-12
4
+
5
+ [full changelog](http://github.com/rspec/rspec-rails/compare/v2.0.0.beta.20...v2.0.0.beta.22)
6
+
7
+ * Enhancements
8
+ * autotest mapping improvements (Andreas Neuhaus)
9
+
10
+ * Bug fixes
11
+ * delegate flunk to assertion delegate
12
+
13
+ ### 2.0.0.beta.20 / 2010-08-24
14
+
15
+ [full changelog](http://github.com/rspec/rspec-rails/compare/v2.0.0.beta.19...v2.0.0.beta.20)
16
+
17
+ * Enhancements
18
+ * infer controller and action path_params in view specs
19
+ * more cucumber features (Justin Ko)
20
+ * clean up spec helper (Andre Arko)
21
+ * render views in controller specs if controller class is not
22
+ ActionController::Base
23
+ * routing specs can access named routes
24
+ * add assign(name, value) to helper specs (Justin Ko)
25
+ * stub_model supports primary keys other than id (Justin Ko)
26
+ * encapsulate Test::Unit and/or MiniTest assertions in a separate object
27
+ * support choice between Webrat/Capybara (Justin Ko)
28
+ * removed hard dependency on Webrat
29
+ * support specs for 'abstract' subclasses of ActionController::Base (Mike Gehard)
30
+ * be_a_new matcher supports args (Justin Ko)
31
+
32
+ * Bug fixes
33
+ * support T::U components in mailer and request specs (Brasten Sager)
@@ -2,26 +2,24 @@
2
2
 
3
3
  rspec-2 for rails-3 with lightweight extensions to each
4
4
 
5
- NOTICE: rspec-rails-2.0.0.beta.17 only works with rails-3.0.0.beta4 or higher.
6
-
7
5
  ## Install
8
6
 
9
7
  gem install rspec-rails --pre
10
8
 
11
9
  This installs the following gems:
12
10
 
13
- * rspec
14
- * rspec-core
15
- * rspec-expectations
16
- * rspec-mocks
17
- * rspec-rails
11
+ rspec
12
+ rspec-core
13
+ rspec-expectations
14
+ rspec-mocks
15
+ rspec-rails
18
16
 
19
17
  ## Configure:
20
18
 
21
19
  Add `rspec-rails` to the `:test` and `:development` groups in the Gemfile:
22
20
 
23
21
  group :test, :development do
24
- gem "rspec-rails", ">= 2.0.0.beta.19"
22
+ gem "rspec-rails", ">= 2.0.0.beta.22"
25
23
  end
26
24
 
27
25
  It needs to be in the `:development` group to expose generators and rake
@@ -32,11 +30,32 @@ Now you can run:
32
30
  script/rails generate rspec:install
33
31
 
34
32
  This adds the spec directory and some skeleton files, including
35
- the "rake spec" task. Note that this is the only rspec generator you'll
36
- actually see. That's because RSpec is registered with Rails as the test
37
- framework, so whenever you generate application components like models,
33
+ the "rake spec" task.
34
+
35
+ ### Generators
36
+
37
+ If you type `script/rails generate`, the only RSpec generator you'll actually
38
+ see is `rspec:install`. That's because RSpec is registered with Rails as the
39
+ test framework, so whenever you generate application components like models,
38
40
  controllers, etc, RSpec specs are generated instead of Test::Unit tests.
39
41
 
42
+ Note that the generators are there to help you get started, but they are no
43
+ substitute for writing your own examples, and they are only guaranteed to work
44
+ out of the box for the default scenario (`ActiveRecord` + `Webrat`).
45
+
46
+ ### Autotest
47
+
48
+ The `rspec:install` generator creates an `./autotest/discover.rb` file, which
49
+ tells Autotest that you're using RSpec and Rails. You'll also need to add the
50
+ autotest (not autotest-rails) gem to your Gemfile:
51
+
52
+ gem "autotest"
53
+
54
+ At this point, if all of the gems in your Gemfile are installed in system
55
+ gems, you can just type `autotest`. If, however, Bundler is managing any gems
56
+ for you directly (i.e. you've got `:git` or `:path` attributes in the `Gemfile`),
57
+ you'll need to run `bundle exec autotest`.
58
+
40
59
  ### Webrat and Capybara
41
60
 
42
61
  You can choose between webrat or capybara for simulating a browser, automating
@@ -50,8 +69,9 @@ Note that Capybara matchers are not available in view or helper specs.
50
69
 
51
70
  ## Living on edge
52
71
 
53
- If you prefer to exploit bundler's support for pointing a gem at a github repo,
54
- be sure to do so for all five of the relevant rspec gems:
72
+ Bundler makes it a snap to use the latest code for any gem your app depends on. For
73
+ rspec-rails, you'll need to point bundler to the git repositories for `rspec-rails`
74
+ and the other rspec related gems it depends on:
55
75
 
56
76
  gem "rspec-rails", :git => "git://github.com/rspec/rspec-rails.git"
57
77
  gem "rspec", :git => "git://github.com/rspec/rspec.git"
@@ -59,9 +79,13 @@ be sure to do so for all five of the relevant rspec gems:
59
79
  gem "rspec-expectations", :git => "git://github.com/rspec/rspec-expectations.git"
60
80
  gem "rspec-mocks", :git => "git://github.com/rspec/rspec-mocks.git"
61
81
 
62
- Keep in mind that each of these repos is under active development, which means
63
- that its very likely that you'll pull from these repos and they won't play nice
64
- together. If playing nice is important to you, stick to the published gems.
82
+ Run `bundle install` and you'll have whatever is in git right now. Any time you
83
+ want to update to a newer head, just run `bundle update`.
84
+
85
+ Keep in mind that each of these codebases is under active development, which
86
+ means that its entirely possible that you'll pull from these repos and they won't
87
+ play nice together. If playing nice is important to you, stick to the published
88
+ gems.
65
89
 
66
90
  ## Backwards compatibility
67
91
 
@@ -213,6 +237,10 @@ Routing specs live in spec/routing.
213
237
  end
214
238
  end
215
239
 
240
+ ### * Upgrade note
241
+
242
+ `route_for` from rspec-rails-1.x is gone. Use `route_to` and `be_routable` instead.
243
+
216
244
  # Helper specs
217
245
 
218
246
  Helper specs live in spec/helpers, and mix in ActionView::TestCase::Behavior.
data/Rakefile CHANGED
@@ -10,14 +10,12 @@ MESSAGE
10
10
  end
11
11
  require "bundler"
12
12
  Bundler.setup
13
+ Bundler::GemHelper.install_tasks
13
14
 
14
15
  require 'rake'
15
16
  require 'yaml'
16
17
 
17
- $LOAD_PATH.unshift File.expand_path('../lib', __FILE__)
18
-
19
18
  require 'rake/rdoctask'
20
- require 'rspec/rails/version'
21
19
  require 'rspec'
22
20
  require 'rspec/core/rake_task'
23
21
  require 'cucumber/rake/task'
@@ -32,71 +30,13 @@ class Cucumber::Rake::Task::ForkedCucumberRunner
32
30
  end
33
31
  Cucumber::Rake::Task.new(:cucumber)
34
32
 
35
- begin
36
- require 'jeweler'
37
- Jeweler::Tasks.new do |gem|
38
- gem.name = "rspec-rails"
39
- gem.version = RSpec::Rails::Version::STRING
40
- gem.summary = "rspec-rails-#{RSpec::Rails::Version::STRING}"
41
- gem.description = "RSpec-2 for Rails-3"
42
- gem.email = "dchelimsky@gmail.com;chad.humphries@gmail.com"
43
- gem.homepage = "http://github.com/rspec/rspec-rails"
44
- gem.authors = ["David Chelimsky", "Chad Humphries"]
45
- gem.rubyforge_project = "rspec"
46
- gem.add_dependency "rspec", RSpec::Rails::Version::STRING
47
- gem.post_install_message = <<-EOM
48
- #{"*"*50}
49
-
50
- Thank you for installing #{gem.summary}!
51
-
52
- This version of rspec-rails only works with versions of rails >= 3.0.0.beta.4.
53
-
54
- To configure your app to use rspec-rails, add a declaration to your Gemfile.
55
- If you are using Bundler's grouping feature in your Gemfile, be sure to include
56
- rspec-rails in the :development group as well as the :test group so that you
57
- can access its generators and rake tasks.
58
-
59
- group :development, :test do
60
- gem "rspec-rails", ">= #{RSpec::Rails::Version::STRING}"
61
- end
62
-
63
- Be sure to run the following command in each of your Rails apps if you're
64
- upgrading:
65
-
66
- script/rails generate rspec:install
67
-
68
- Even if you've run it before, this ensures that you have the latest updates
69
- to spec/spec_helper.rb and any other support files.
70
-
71
- Previous versions of rspec-rails-2.0.0.beta installed files that are no
72
- longer being used, so please remove these files if you have them:
73
-
74
- lib/tasks/rspec.rake
75
- config/initializers/rspec_generator.rb
76
-
77
- Lastly, be sure to look at Upgrade.markdown to see what might have changed
78
- since the last release.
79
-
80
- #{"*"*50}
81
- EOM
82
- end
83
- rescue LoadError
84
- puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
85
- end
86
-
87
- namespace :gem do
88
- desc "push to gemcutter"
89
- task :push => :build do
90
- system "gem push pkg/rspec-rails-#{RSpec::Rails::Version::STRING}.gem"
91
- end
92
- end
93
-
94
33
  namespace :generate do
95
34
  desc "generate a fresh app with rspec installed"
96
35
  task :app do |t|
97
36
  unless File.directory?('./tmp/example_app')
98
37
  sh "bundle exec rails new ./tmp/example_app"
99
38
  sh "cp ./templates/Gemfile ./tmp/example_app/"
39
+ sh "cp ./specs.watchr ./tmp/example_app/"
100
40
  end
101
41
  end
102
42
 
@@ -25,55 +25,60 @@ $:.push(*Dir["vendor/rails/*/lib"])
25
25
  require 'active_support/core_ext'
26
26
  require 'autotest/rspec2'
27
27
 
28
- Autotest.add_hook :initialize do |at|
29
- %w{config/ coverage/ db/ doc/ log/ public/ script/ tmp/ vendor/rails vendor/plugins vendor/gems}.each do |exception|
30
- at.add_exception("^#{exception}")
31
- end
28
+ class Autotest::RailsRspec2 < Autotest::Rspec2
32
29
 
33
- at.clear_mappings
30
+ def initialize
31
+ super
32
+ setup_rails_rspec2_mappings
33
+ end
34
34
 
35
- at.add_mapping(%r%^(test|spec)/fixtures/(.*).yml$%) { |_, m|
36
- ["spec/models/#{m[2].singularize}_spec.rb"] + at.files_matching(%r%^spec\/views\/#{m[2]}/.*_spec\.rb$%)
37
- }
38
- at.add_mapping(%r%^spec/(models|controllers|routing|views|helpers|mailers|lib)/.*rb$%) { |filename, _|
39
- filename
40
- }
41
- at.add_mapping(%r%^app/models/(.*)\.rb$%) { |_, m|
42
- ["spec/models/#{m[1]}_spec.rb"]
43
- }
44
- at.add_mapping(%r%^app/views/(.*)$%) { |_, m|
45
- at.files_matching %r%^spec/views/#{m[1]}_spec.rb$%
46
- }
47
- at.add_mapping(%r%^app/controllers/(.*)\.rb$%) { |_, m|
48
- if m[1] == "application"
49
- at.files_matching %r%^spec/controllers/.*_spec\.rb$%
50
- else
51
- ["spec/controllers/#{m[1]}_spec.rb"]
52
- end
53
- }
54
- at.add_mapping(%r%^app/helpers/(.*)_helper\.rb$%) { |_, m|
55
- if m[1] == "application" then
56
- at.files_matching(%r%^spec/(views|helpers)/.*_spec\.rb$%)
57
- else
58
- ["spec/helpers/#{m[1]}_helper_spec.rb"] + at.files_matching(%r%^spec\/views\/#{m[1]}/.*_spec\.rb$%)
35
+ def setup_rails_rspec2_mappings
36
+ %w{config/ coverage/ db/ doc/ log/ public/ script/ tmp/ vendor/rails vendor/plugins vendor/gems}.each do |exception|
37
+ add_exception(/^([\.\/]*)?#{exception}/)
59
38
  end
60
- }
61
- at.add_mapping(%r%^config/routes\.rb$%) {
62
- at.files_matching %r%^spec/(controllers|routing|views|helpers)/.*_spec\.rb$%
63
- }
64
- at.add_mapping(%r%^config/database\.yml$%) { |_, m|
65
- at.files_matching %r%^spec/models/.*_spec\.rb$%
66
- }
67
- at.add_mapping(%r%^(spec/(spec_helper|shared/.*)|config/(boot|environment(s/test)?))\.rb$%) {
68
- at.files_matching %r%^spec/(models|controllers|routing|views|helpers)/.*_spec\.rb$%
69
- }
70
- at.add_mapping(%r%^lib/(.*)\.rb$%) { |_, m|
71
- ["spec/lib/#{m[1]}_spec.rb"]
72
- }
73
- at.add_mapping(%r%^app/mailers/(.*)\.rb$%) { |_, m|
74
- ["spec/mailers/#{m[1]}_spec.rb"]
75
- }
76
- end
77
39
 
78
- class Autotest::RailsRspec2 < Autotest::Rspec2
40
+ clear_mappings
41
+
42
+ add_mapping(%r%^(test|spec)/fixtures/(.*).yml$%) { |_, m|
43
+ ["spec/models/#{m[2].singularize}_spec.rb"] + files_matching(%r%^spec\/views\/#{m[2]}/.*_spec\.rb$%)
44
+ }
45
+ add_mapping(%r%^spec/(models|controllers|routing|views|helpers|mailers|requests|lib)/.*rb$%) { |filename, _|
46
+ filename
47
+ }
48
+ add_mapping(%r%^app/models/(.*)\.rb$%) { |_, m|
49
+ ["spec/models/#{m[1]}_spec.rb"]
50
+ }
51
+ add_mapping(%r%^app/views/(.*)$%) { |_, m|
52
+ files_matching %r%^spec/views/#{m[1]}_spec.rb$%
53
+ }
54
+ add_mapping(%r%^app/controllers/(.*)\.rb$%) { |_, m|
55
+ if m[1] == "application"
56
+ files_matching %r%^spec/controllers/.*_spec\.rb$%
57
+ else
58
+ ["spec/controllers/#{m[1]}_spec.rb"]
59
+ end
60
+ }
61
+ add_mapping(%r%^app/helpers/(.*)_helper\.rb$%) { |_, m|
62
+ if m[1] == "application" then
63
+ files_matching(%r%^spec/(views|helpers)/.*_spec\.rb$%)
64
+ else
65
+ ["spec/helpers/#{m[1]}_helper_spec.rb"] + files_matching(%r%^spec\/views\/#{m[1]}/.*_spec\.rb$%)
66
+ end
67
+ }
68
+ add_mapping(%r%^config/routes\.rb$%) {
69
+ files_matching %r%^spec/(controllers|routing|views|helpers)/.*_spec\.rb$%
70
+ }
71
+ add_mapping(%r%^config/database\.yml$%) { |_, m|
72
+ files_matching %r%^spec/models/.*_spec\.rb$%
73
+ }
74
+ add_mapping(%r%^(spec/(spec_helper|shared/.*)|config/(boot|environment(s/test)?))\.rb$%) {
75
+ files_matching %r%^spec/(models|controllers|routing|views|helpers)/.*_spec\.rb$%
76
+ }
77
+ add_mapping(%r%^lib/(.*)\.rb$%) { |_, m|
78
+ ["spec/lib/#{m[1]}_spec.rb"]
79
+ }
80
+ add_mapping(%r%^app/mailers/(.*)\.rb$%) { |_, m|
81
+ ["spec/mailers/#{m[1]}_spec.rb"]
82
+ }
83
+ end
79
84
  end
@@ -6,8 +6,8 @@ module Rspec
6
6
  argument :actions, :type => :array, :default => [], :banner => "action action"
7
7
 
8
8
  class_option :template_engine, :desc => "Template engine to generate view files"
9
- class_option :controllers, :type => :boolean, :default => true
10
- class_option :views, :type => :boolean, :default => true
9
+ class_option :controller_specs, :type => :boolean, :default => true
10
+ class_option :view_specs, :type => :boolean, :default => true
11
11
 
12
12
  def create_controller_files
13
13
  return unless options[:controllers]
@@ -17,10 +17,11 @@ RSpec.configure do |config|
17
17
  # config.mock_with :rr
18
18
  config.mock_with :rspec
19
19
 
20
+ # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
20
21
  config.fixture_path = "#{::Rails.root}/spec/fixtures"
21
22
 
22
23
  # If you're not using ActiveRecord, or you'd prefer not to run each of your
23
- # examples within a transaction, comment the following line or assign false
24
+ # examples within a transaction, remove the following line or assign false
24
25
  # instead of true.
25
26
  config.use_transactional_fixtures = true
26
27
  end
@@ -1,3 +1,13 @@
1
+ module RSpec
2
+ module Rails
3
+ class << self
4
+ def using_active_record?
5
+ ::Rails.configuration.generators.options[:rails][:orm] == :active_record
6
+ end
7
+ end
8
+ end
9
+ end
10
+
1
11
  require 'rspec/core'
2
12
  require 'rspec/rails/extensions'
3
13
  require 'rspec/rails/view_rendering'
@@ -32,7 +32,7 @@ module RSpec
32
32
 
33
33
  module ClassMethods
34
34
  def assertion_method_names
35
- Test::Unit::Assertions.public_instance_methods.select{|m| m.to_s =~ /^assert/} +
35
+ Test::Unit::Assertions.public_instance_methods.select{|m| m.to_s =~ /^(assert|flunk)/} +
36
36
  [:build_message]
37
37
  end
38
38
 
@@ -1,6 +1,6 @@
1
- if defined?(ActiveRecord::Base)
2
- module RSpec
3
- module Rails
1
+ module RSpec
2
+ module Rails
3
+ if using_active_record?
4
4
  module Extensions
5
5
  module ActiveRecord
6
6
  module ClassMethods
@@ -33,12 +33,12 @@ if defined?(ActiveRecord::Base)
33
33
  end
34
34
  end
35
35
  end
36
- end
37
- end
38
36
 
39
- class ActiveRecord::Base #:nodoc:
40
- extend RSpec::Rails::Extensions::ActiveRecord::ClassMethods
41
- include RSpec::Rails::Extensions::ActiveRecord::InstanceMethods
37
+ class ::ActiveRecord::Base #:nodoc:
38
+ extend RSpec::Rails::Extensions::ActiveRecord::ClassMethods
39
+ include RSpec::Rails::Extensions::ActiveRecord::InstanceMethods
40
+ end
41
+ end
42
42
  end
43
43
  end
44
44
 
@@ -1,33 +1,30 @@
1
- if defined?(ActiveRecord)
2
- module RSpec
3
- module Rails
1
+ module RSpec
2
+ module Rails
3
+ if using_active_record?
4
4
  module FixtureSupport
5
5
  extend ActiveSupport::Concern
6
6
 
7
7
  include RSpec::Rails::SetupAndTeardownAdapter
8
8
  include RSpec::Rails::TestUnitAssertionAdapter
9
+ include ActiveRecord::TestFixtures
9
10
 
10
11
  included do
11
- if RSpec.configuration.use_transactional_fixtures
12
- # TODO - figure out how to move this outside the included block
13
- include ActiveRecord::TestFixtures
14
-
15
- self.fixture_path = RSpec.configuration.fixture_path
16
- self.use_transactional_fixtures = RSpec.configuration.use_transactional_fixtures
17
- self.use_instantiated_fixtures = RSpec.configuration.use_instantiated_fixtures
18
- fixtures RSpec.configuration.global_fixtures if RSpec.configuration.global_fixtures
19
- end
12
+ self.fixture_path = RSpec.configuration.fixture_path
13
+ self.use_transactional_fixtures = RSpec.configuration.use_transactional_fixtures
14
+ self.use_instantiated_fixtures = RSpec.configuration.use_instantiated_fixtures
15
+ fixtures RSpec.configuration.global_fixtures if RSpec.configuration.global_fixtures
20
16
  end
21
17
  end
22
- end
23
- end
24
18
 
25
- RSpec.configure do |c|
26
- c.include RSpec::Rails::FixtureSupport
27
- c.add_setting :use_transactional_fixtures
28
- c.add_setting :use_transactional_examples, :alias => :use_transactional_fixtures
29
- c.add_setting :use_instantiated_fixtures
30
- c.add_setting :global_fixtures
31
- c.add_setting :fixture_path
19
+ RSpec.configure do |c|
20
+ c.include RSpec::Rails::FixtureSupport
21
+ c.add_setting :use_transactional_fixtures
22
+ c.add_setting :use_transactional_examples, :alias => :use_transactional_fixtures
23
+ c.add_setting :use_instantiated_fixtures
24
+ c.add_setting :global_fixtures
25
+ c.add_setting :fixture_path
26
+ end
27
+ end
32
28
  end
33
29
  end
30
+
@@ -88,6 +88,9 @@ EOM
88
88
  def @object.instance_of?(other)
89
89
  other == #{model_class}
90
90
  end
91
+ def @object.respond_to?(method_name)
92
+ #{model_class}.respond_to?(:column_names) && #{model_class}.column_names.include?(method_name.to_s) || super
93
+ end
91
94
  def @object.class
92
95
  #{model_class}
93
96
  end
@@ -1,7 +1,8 @@
1
1
  require 'rspec/core'
2
2
  require 'rspec/core/rake_task'
3
3
  Rake.application.instance_variable_get('@tasks')['default'].prerequisites.delete('test')
4
- spec_prereq = Rails.root.join('config', 'database.yml').exist? ? "db:test:prepare" : :noop
4
+
5
+ spec_prereq = Rails.configuration.generators.options[:rails][:orm] == :active_record ? "db:test:prepare" : :noop
5
6
  task :noop do; end
6
7
  task :default => :spec
7
8
 
@@ -1,7 +1,7 @@
1
1
  module RSpec # :nodoc:
2
2
  module Rails # :nodoc:
3
3
  module Version # :nodoc:
4
- STRING = File.readlines(File.expand_path('../../../../VERSION', __FILE__)).first
4
+ STRING = '2.0.0.beta.22'
5
5
  end
6
6
  end
7
7
  end
@@ -1,138 +1,30 @@
1
- # Generated by jeweler
2
- # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
1
  # -*- encoding: utf-8 -*-
2
+ $LOAD_PATH.unshift File.expand_path("../lib", __FILE__)
3
+ require "rspec/rails/version"
5
4
 
6
5
  Gem::Specification.new do |s|
7
- s.name = %q{rspec-rails}
8
- s.version = "2.0.0.beta.20"
9
-
10
- s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["David Chelimsky", "Chad Humphries"]
12
- s.date = %q{2010-08-24}
13
- s.description = %q{RSpec-2 for Rails-3}
14
- s.email = %q{dchelimsky@gmail.com;chad.humphries@gmail.com}
15
- s.extra_rdoc_files = [
16
- "README.markdown"
17
- ]
18
- s.files = [
19
- ".document",
20
- ".gitignore",
21
- "Gemfile",
22
- "Gotchas.markdown",
23
- "README.markdown",
24
- "Rakefile",
25
- "Upgrade.markdown",
26
- "VERSION",
27
- "autotest/discover.rb",
28
- "cucumber.yml",
29
- "features/README.markdown",
30
- "features/controller_specs/anonymous_controller.feature",
31
- "features/controller_specs/isolation_from_views.feature",
32
- "features/controller_specs/readers.feature",
33
- "features/controller_specs/render_views.feature",
34
- "features/helper_specs/helper_spec.feature",
35
- "features/mailer_specs/url_helpers.feature",
36
- "features/matchers/be_routable_matcher.feature",
37
- "features/matchers/new_record_matcher.feature",
38
- "features/matchers/redirect_to_matcher.feature",
39
- "features/matchers/render_template_matcher.feature",
40
- "features/mocks/mock_model.feature",
41
- "features/mocks/stub_model.feature",
42
- "features/model_specs/errors_on.feature",
43
- "features/model_specs/transactional_examples.feature",
44
- "features/routing_specs/access_to_named_routes.feature",
45
- "features/step_definitions/model_steps.rb",
46
- "features/support/env.rb",
47
- "features/view_specs/inferred_controller_path.feature",
48
- "features/view_specs/view_spec.feature",
49
- "lib/autotest/rails_rspec2.rb",
50
- "lib/generators/rspec.rb",
51
- "lib/generators/rspec/controller/controller_generator.rb",
52
- "lib/generators/rspec/controller/templates/controller_spec.rb",
53
- "lib/generators/rspec/controller/templates/view_spec.rb",
54
- "lib/generators/rspec/helper/helper_generator.rb",
55
- "lib/generators/rspec/helper/templates/helper_spec.rb",
56
- "lib/generators/rspec/install/install_generator.rb",
57
- "lib/generators/rspec/install/templates/.rspec",
58
- "lib/generators/rspec/install/templates/autotest/discover.rb",
59
- "lib/generators/rspec/install/templates/spec/spec_helper.rb",
60
- "lib/generators/rspec/integration/integration_generator.rb",
61
- "lib/generators/rspec/integration/templates/request_spec.rb",
62
- "lib/generators/rspec/mailer/mailer_generator.rb",
63
- "lib/generators/rspec/mailer/templates/fixture",
64
- "lib/generators/rspec/mailer/templates/mailer_spec.rb",
65
- "lib/generators/rspec/model/model_generator.rb",
66
- "lib/generators/rspec/model/templates/fixtures.yml",
67
- "lib/generators/rspec/model/templates/model_spec.rb",
68
- "lib/generators/rspec/observer/observer_generator.rb",
69
- "lib/generators/rspec/observer/templates/observer_spec.rb",
70
- "lib/generators/rspec/scaffold/scaffold_generator.rb",
71
- "lib/generators/rspec/scaffold/templates/controller_spec.rb",
72
- "lib/generators/rspec/scaffold/templates/edit_spec.rb",
73
- "lib/generators/rspec/scaffold/templates/index_spec.rb",
74
- "lib/generators/rspec/scaffold/templates/new_spec.rb",
75
- "lib/generators/rspec/scaffold/templates/routing_spec.rb",
76
- "lib/generators/rspec/scaffold/templates/show_spec.rb",
77
- "lib/generators/rspec/view/templates/view_spec.rb",
78
- "lib/generators/rspec/view/view_generator.rb",
79
- "lib/rspec-rails.rb",
80
- "lib/rspec/rails.rb",
81
- "lib/rspec/rails/adapters.rb",
82
- "lib/rspec/rails/browser_simulators.rb",
83
- "lib/rspec/rails/example.rb",
84
- "lib/rspec/rails/example/controller_example_group.rb",
85
- "lib/rspec/rails/example/helper_example_group.rb",
86
- "lib/rspec/rails/example/mailer_example_group.rb",
87
- "lib/rspec/rails/example/model_example_group.rb",
88
- "lib/rspec/rails/example/rails_example_group.rb",
89
- "lib/rspec/rails/example/request_example_group.rb",
90
- "lib/rspec/rails/example/routing_example_group.rb",
91
- "lib/rspec/rails/example/view_example_group.rb",
92
- "lib/rspec/rails/extensions.rb",
93
- "lib/rspec/rails/extensions/active_record/base.rb",
94
- "lib/rspec/rails/fixture_support.rb",
95
- "lib/rspec/rails/matchers.rb",
96
- "lib/rspec/rails/matchers/be_a_new.rb",
97
- "lib/rspec/rails/matchers/have_extension.rb",
98
- "lib/rspec/rails/matchers/redirect_to.rb",
99
- "lib/rspec/rails/matchers/render_template.rb",
100
- "lib/rspec/rails/matchers/routing_matchers.rb",
101
- "lib/rspec/rails/mocks.rb",
102
- "lib/rspec/rails/module_inclusion.rb",
103
- "lib/rspec/rails/tasks/rspec.rake",
104
- "lib/rspec/rails/version.rb",
105
- "lib/rspec/rails/view_assigns.rb",
106
- "lib/rspec/rails/view_rendering.rb",
107
- "rspec-rails.gemspec",
108
- "spec/rspec/rails/assertion_adapter_spec.rb",
109
- "spec/rspec/rails/example/controller_example_group_spec.rb",
110
- "spec/rspec/rails/example/helper_example_group_spec.rb",
111
- "spec/rspec/rails/example/mailer_example_group_spec.rb",
112
- "spec/rspec/rails/example/model_example_group_spec.rb",
113
- "spec/rspec/rails/example/request_example_group_spec.rb",
114
- "spec/rspec/rails/example/routing_example_group_spec.rb",
115
- "spec/rspec/rails/example/view_example_group_spec.rb",
116
- "spec/rspec/rails/example/view_rendering_spec.rb",
117
- "spec/rspec/rails/matchers/be_a_new_spec.rb",
118
- "spec/rspec/rails/matchers/errors_on_spec.rb",
119
- "spec/rspec/rails/matchers/redirect_to_spec.rb",
120
- "spec/rspec/rails/matchers/render_template_spec.rb",
121
- "spec/rspec/rails/matchers/route_to_spec.rb",
122
- "spec/rspec/rails/mocks/ar_classes.rb",
123
- "spec/rspec/rails/mocks/mock_model_spec.rb",
124
- "spec/rspec/rails/mocks/stub_model_spec.rb",
125
- "spec/spec_helper.rb",
126
- "spec/support/helpers.rb",
127
- "specs.watchr",
128
- "templates/Gemfile",
129
- "templates/generate_stuff.rb",
130
- "templates/run_specs.rb"
131
- ]
132
- s.homepage = %q{http://github.com/rspec/rspec-rails}
133
- s.post_install_message = %q{**************************************************
134
-
135
- Thank you for installing rspec-rails-2.0.0.beta.20!
6
+ s.name = "rspec-rails"
7
+ s.version = RSpec::Rails::Version::STRING
8
+ s.platform = Gem::Platform::RUBY
9
+ s.authors = ["David Chelimsky", "Chad Humphries"]
10
+ s.email = "dchelimsky@gmail.com;chad.humphries@gmail.com"
11
+ s.homepage = "http://github.com/rspec/rspec-rails"
12
+ s.summary = "rspec-rails-#{RSpec::Rails::Version::STRING}"
13
+ s.description = "RSpec-2 for Rails-3"
14
+
15
+ s.rubygems_version = "1.3.7"
16
+ s.rubyforge_project = "rspec"
17
+
18
+ s.files = `git ls-files`.split("\n")
19
+ s.test_files = `git ls-files -- {spec,features}/*`.split("\n")
20
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
21
+ s.extra_rdoc_files = [ "README.markdown" ]
22
+ s.rdoc_options = ["--charset=UTF-8"]
23
+ s.require_path = "lib"
24
+
25
+ s.post_install_message = %Q{**************************************************
26
+
27
+ Thank you for installing #{s.summary}!
136
28
 
137
29
  This version of rspec-rails only works with versions of rails >= 3.0.0.beta.4.
138
30
 
@@ -142,7 +34,7 @@ Gem::Specification.new do |s|
142
34
  can access its generators and rake tasks.
143
35
 
144
36
  group :development, :test do
145
- gem "rspec-rails", ">= 2.0.0.beta.20"
37
+ gem "rspec-rails", ">= #{RSpec::Rails::Version::STRING}"
146
38
  end
147
39
 
148
40
  Be sure to run the following command in each of your Rails apps if you're
@@ -164,44 +56,7 @@ Gem::Specification.new do |s|
164
56
 
165
57
  **************************************************
166
58
  }
167
- s.rdoc_options = ["--charset=UTF-8"]
168
- s.require_paths = ["lib"]
169
- s.rubyforge_project = %q{rspec}
170
- s.rubygems_version = %q{1.3.7}
171
- s.summary = %q{rspec-rails-2.0.0.beta.20}
172
- s.test_files = [
173
- "spec/rspec/rails/assertion_adapter_spec.rb",
174
- "spec/rspec/rails/example/controller_example_group_spec.rb",
175
- "spec/rspec/rails/example/helper_example_group_spec.rb",
176
- "spec/rspec/rails/example/mailer_example_group_spec.rb",
177
- "spec/rspec/rails/example/model_example_group_spec.rb",
178
- "spec/rspec/rails/example/request_example_group_spec.rb",
179
- "spec/rspec/rails/example/routing_example_group_spec.rb",
180
- "spec/rspec/rails/example/view_example_group_spec.rb",
181
- "spec/rspec/rails/example/view_rendering_spec.rb",
182
- "spec/rspec/rails/matchers/be_a_new_spec.rb",
183
- "spec/rspec/rails/matchers/errors_on_spec.rb",
184
- "spec/rspec/rails/matchers/redirect_to_spec.rb",
185
- "spec/rspec/rails/matchers/render_template_spec.rb",
186
- "spec/rspec/rails/matchers/route_to_spec.rb",
187
- "spec/rspec/rails/mocks/ar_classes.rb",
188
- "spec/rspec/rails/mocks/mock_model_spec.rb",
189
- "spec/rspec/rails/mocks/stub_model_spec.rb",
190
- "spec/spec_helper.rb",
191
- "spec/support/helpers.rb"
192
- ]
193
-
194
- if s.respond_to? :specification_version then
195
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
196
- s.specification_version = 3
197
-
198
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
199
- s.add_runtime_dependency(%q<rspec>, ["= 2.0.0.beta.20"])
200
- else
201
- s.add_dependency(%q<rspec>, ["= 2.0.0.beta.20"])
202
- end
203
- else
204
- s.add_dependency(%q<rspec>, ["= 2.0.0.beta.20"])
205
- end
59
+
60
+ s.add_runtime_dependency "rspec", RSpec::Rails::Version::STRING
206
61
  end
207
62
 
@@ -0,0 +1,25 @@
1
+ require "spec_helper"
2
+ require "autotest/rails_rspec2"
3
+
4
+ describe Autotest::RailsRspec2 do
5
+ before(:each) do
6
+ rails_rspec2_autotest = Autotest::RailsRspec2.new
7
+ @re = rails_rspec2_autotest.exceptions
8
+ end
9
+
10
+ it "should match './log/test.log'" do
11
+ @re.should match('./log/test.log')
12
+ end
13
+
14
+ it "should match 'log/test.log'" do
15
+ @re.should match('log/test.log')
16
+ end
17
+
18
+ it "should not match './spec/models/user_spec.rb'" do
19
+ @re.should_not match('./spec/models/user_spec.rb')
20
+ end
21
+
22
+ it "should not match 'spec/models/user_spec.rb'" do
23
+ @re.should_not match('spec/models/user_spec.rb')
24
+ end
25
+ end
@@ -3,7 +3,7 @@ require "spec_helper"
3
3
  describe RSpec::Rails::TestUnitAssertionAdapter do
4
4
  include RSpec::Rails::TestUnitAssertionAdapter
5
5
 
6
- Test::Unit::Assertions.public_instance_methods.select{|m| m.to_s =~ /^assert/}.each do |m|
6
+ Test::Unit::Assertions.public_instance_methods.select{|m| m.to_s =~ /^(assert|flunk)/}.each do |m|
7
7
  if m.to_s == "assert_equal"
8
8
  it "exposes #{m} to host examples" do
9
9
  assert_equal 3,3
@@ -0,0 +1,17 @@
1
+ require "spec_helper"
2
+
3
+ module RSpec::Rails
4
+ describe FixtureSupport do
5
+ context "with use_transactional_fixtures set to false" do
6
+ it "still supports fixture_path" do
7
+ RSpec.configuration.stub(:use_transactional_fixtures) { false }
8
+ group = RSpec::Core::ExampleGroup.describe do
9
+ include FixtureSupport
10
+ end
11
+
12
+ group.should respond_to(:fixture_path)
13
+ group.should respond_to(:fixture_path=)
14
+ end
15
+ end
16
+ end
17
+ end
@@ -12,6 +12,10 @@ module NoConnections
12
12
  end
13
13
  end
14
14
 
15
+ class NonActiveRecordModel
16
+ extend ActiveModel::Naming
17
+ end
18
+
15
19
  class MockableModel < ActiveRecord::Base
16
20
  include NoConnections
17
21
  has_one :associated_model
@@ -140,6 +140,28 @@ describe "mock_model(RealModel)" do
140
140
  end
141
141
  end
142
142
 
143
+ describe "#respond_to?" do
144
+ context "with an ActiveRecord model" do
145
+ before(:each) do
146
+ MockableModel.stub(:column_names).and_return(["column_a", "column_b"])
147
+ @model = mock_model(MockableModel)
148
+ end
149
+ it "says it will respond_to?(key) if RealModel has the attribute 'key'" do
150
+ @model.respond_to?("column_a").should be(true)
151
+ end
152
+ it "does not say it will respond_to?(key) if RealModel does not have the attribute 'key'" do
153
+ @model.respond_to?("column_c").should be(false)
154
+ end
155
+ end
156
+
157
+ context "with a non-ActiveRecord model" do
158
+ it "responds as normal" do
159
+ model = NonActiveRecordModel.new
160
+ model.should respond_to(:to_param)
161
+ end
162
+ end
163
+ end
164
+
143
165
  describe "#destroyed?" do
144
166
  context "default" do
145
167
  it "returns false" do
@@ -1,6 +1,10 @@
1
- require 'active_record'
2
- require 'action_controller'
3
- require 'action_mailer'
1
+ require 'rails/all'
2
+
3
+ module RSpecRails
4
+ class Application < ::Rails::Application
5
+ end
6
+ end
7
+
4
8
  require 'rspec/rails'
5
9
 
6
10
  Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
@@ -13,4 +13,6 @@ group :development, :test do
13
13
  gem "rspec-mocks", :path => "../../../rspec-mocks"
14
14
  gem "rcov"
15
15
  gem "webrat"
16
+ gem "autotest"
17
+ gem "watchr"
16
18
  end
metadata CHANGED
@@ -7,8 +7,8 @@ version: !ruby/object:Gem::Version
7
7
  - 0
8
8
  - 0
9
9
  - beta
10
- - 20
11
- version: 2.0.0.beta.20
10
+ - 22
11
+ version: 2.0.0.beta.22
12
12
  platform: ruby
13
13
  authors:
14
14
  - David Chelimsky
@@ -17,7 +17,7 @@ autorequire:
17
17
  bindir: bin
18
18
  cert_chain: []
19
19
 
20
- date: 2010-08-24 00:00:00 -05:00
20
+ date: 2010-09-12 00:00:00 -05:00
21
21
  default_executable:
22
22
  dependencies:
23
23
  - !ruby/object:Gem::Dependency
@@ -32,8 +32,8 @@ dependencies:
32
32
  - 0
33
33
  - 0
34
34
  - beta
35
- - 20
36
- version: 2.0.0.beta.20
35
+ - 22
36
+ version: 2.0.0.beta.22
37
37
  type: :runtime
38
38
  prerelease: false
39
39
  version_requirements: *id001
@@ -50,10 +50,10 @@ files:
50
50
  - .gitignore
51
51
  - Gemfile
52
52
  - Gotchas.markdown
53
+ - History.md
53
54
  - README.markdown
54
55
  - Rakefile
55
56
  - Upgrade.markdown
56
- - VERSION
57
57
  - autotest/discover.rb
58
58
  - cucumber.yml
59
59
  - features/README.markdown
@@ -135,6 +135,7 @@ files:
135
135
  - lib/rspec/rails/view_assigns.rb
136
136
  - lib/rspec/rails/view_rendering.rb
137
137
  - rspec-rails.gemspec
138
+ - spec/autotest/rails_rspec2_spec.rb
138
139
  - spec/rspec/rails/assertion_adapter_spec.rb
139
140
  - spec/rspec/rails/example/controller_example_group_spec.rb
140
141
  - spec/rspec/rails/example/helper_example_group_spec.rb
@@ -144,6 +145,7 @@ files:
144
145
  - spec/rspec/rails/example/routing_example_group_spec.rb
145
146
  - spec/rspec/rails/example/view_example_group_spec.rb
146
147
  - spec/rspec/rails/example/view_rendering_spec.rb
148
+ - spec/rspec/rails/fixture_support_spec.rb
147
149
  - spec/rspec/rails/matchers/be_a_new_spec.rb
148
150
  - spec/rspec/rails/matchers/errors_on_spec.rb
149
151
  - spec/rspec/rails/matchers/redirect_to_spec.rb
@@ -165,7 +167,7 @@ licenses: []
165
167
  post_install_message: |
166
168
  **************************************************
167
169
 
168
- Thank you for installing rspec-rails-2.0.0.beta.20!
170
+ Thank you for installing rspec-rails-2.0.0.beta.22!
169
171
 
170
172
  This version of rspec-rails only works with versions of rails >= 3.0.0.beta.4.
171
173
 
@@ -175,7 +177,7 @@ post_install_message: |
175
177
  can access its generators and rake tasks.
176
178
 
177
179
  group :development, :test do
178
- gem "rspec-rails", ">= 2.0.0.beta.20"
180
+ gem "rspec-rails", ">= 2.0.0.beta.22"
179
181
  end
180
182
 
181
183
  Be sure to run the following command in each of your Rails apps if you're
@@ -206,7 +208,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
206
208
  requirements:
207
209
  - - ">="
208
210
  - !ruby/object:Gem::Version
209
- hash: 4009655746568462970
211
+ hash: 4218695540923363031
210
212
  segments:
211
213
  - 0
212
214
  version: "0"
@@ -226,8 +228,29 @@ rubyforge_project: rspec
226
228
  rubygems_version: 1.3.7
227
229
  signing_key:
228
230
  specification_version: 3
229
- summary: rspec-rails-2.0.0.beta.20
231
+ summary: rspec-rails-2.0.0.beta.22
230
232
  test_files:
233
+ - features/README.markdown
234
+ - features/controller_specs/anonymous_controller.feature
235
+ - features/controller_specs/isolation_from_views.feature
236
+ - features/controller_specs/readers.feature
237
+ - features/controller_specs/render_views.feature
238
+ - features/helper_specs/helper_spec.feature
239
+ - features/mailer_specs/url_helpers.feature
240
+ - features/matchers/be_routable_matcher.feature
241
+ - features/matchers/new_record_matcher.feature
242
+ - features/matchers/redirect_to_matcher.feature
243
+ - features/matchers/render_template_matcher.feature
244
+ - features/mocks/mock_model.feature
245
+ - features/mocks/stub_model.feature
246
+ - features/model_specs/errors_on.feature
247
+ - features/model_specs/transactional_examples.feature
248
+ - features/routing_specs/access_to_named_routes.feature
249
+ - features/step_definitions/model_steps.rb
250
+ - features/support/env.rb
251
+ - features/view_specs/inferred_controller_path.feature
252
+ - features/view_specs/view_spec.feature
253
+ - spec/autotest/rails_rspec2_spec.rb
231
254
  - spec/rspec/rails/assertion_adapter_spec.rb
232
255
  - spec/rspec/rails/example/controller_example_group_spec.rb
233
256
  - spec/rspec/rails/example/helper_example_group_spec.rb
@@ -237,6 +260,7 @@ test_files:
237
260
  - spec/rspec/rails/example/routing_example_group_spec.rb
238
261
  - spec/rspec/rails/example/view_example_group_spec.rb
239
262
  - spec/rspec/rails/example/view_rendering_spec.rb
263
+ - spec/rspec/rails/fixture_support_spec.rb
240
264
  - spec/rspec/rails/matchers/be_a_new_spec.rb
241
265
  - spec/rspec/rails/matchers/errors_on_spec.rb
242
266
  - spec/rspec/rails/matchers/redirect_to_spec.rb
data/VERSION DELETED
@@ -1 +0,0 @@
1
- 2.0.0.beta.20