Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: rspec/rspec-rails
...
head fork: benhamill/rspec-rails
  • 9 commits
  • 15 files changed
  • 0 commit comments
  • 2 contributors
Commits on Nov 29, 2010
@solnic solnic Depend on railties, activesupport and actionpack instead of monolithi…
…c rails gem

- Closes #275.
b88c721
@dchelimsky dchelimsky history db88d25
@dchelimsky dchelimsky Update deps
- rspec ~> M.m.0 (3 digits instead of 2)
- rails gems >= 3.0.0 (not ~> 3.0.0)
e700858
Commits on Nov 30, 2010
@dchelimsky dchelimsky links 1a881dd
@dchelimsky dchelimsky Point cucumber dev dependency to my fork which depends on builder.
- filed pull request with cucumber project - can revert this if/when
  that is merged/released.
4b79a87
@dchelimsky dchelimsky Gemfile can still depend on rails for development 6eb2b25
Commits on Dec 01, 2010
@dchelimsky dchelimsky Got webrat working across request and controller specs
- added --webrat flag for request controller generator
- deprecated --webrat-matchers flag across generators
- Closes #277.
617d675
@dchelimsky dchelimsky bump version to 2.2.1 eb7c5dc
@dchelimsky dchelimsky Make rails gem deps work for anything < 4.0 c89a5ac
View
4 Gemfile
@@ -1,13 +1,13 @@
source "http://rubygems.org"
+gem "rails", :path => File.expand_path("../vendor/rails", __FILE__)
gem "rack", :git => "git://github.com/rack/rack.git"
-gem 'rails', :path => File.expand_path("../vendor/rails", __FILE__)
%w[rspec-rails rspec rspec-core rspec-expectations rspec-mocks].each do |lib|
gem lib, :path => File.expand_path("../../#{lib}", __FILE__)
end
-gem "cucumber", "0.9.4"
+gem "cucumber", :git => "git://github.com/dchelimsky/cucumber", :branch => "update-gemspec"
gem "aruba", "0.2.2"
gem 'webrat', "0.7.2"
gem 'sqlite3-ruby', :require => 'sqlite3'
View
14 History.md
@@ -1,4 +1,16 @@
-## rspec-rails-2 release history (incomplete)
+## rspec-rails-2 release history
+
+### 2.2.1 / 2010-12-01
+
+[full changelog](http://github.com/rspec/rspec-rails/compare/v2.2.0...v2.2.1)
+
+* Bug fixes
+ * Depend on railties, activesupport, and actionpack instead of rails (Piotr
+ Solnica)
+ * Got webrat integration working properly across different types of specs
+
+* Deprecations
+ * --webrat-matchers flag for generators is deprecated. use --webrat instead.
### 2.2.0 / 2010-11-28
View
4 README.md
@@ -6,10 +6,10 @@ NOTE: rspec-2 does _not_ support rails-2. Use rspec-rails-1.3.x for rails-2.
## Documentation
-The [Cucumber features](http://relishapp.com/rspec/rspec-rails/v/2-1) are the
+The [Cucumber features](http://relishapp.com/rspec/rspec-rails/v/2-2) are the
most comprehensive and up-to-date docs for end-users.
-The [RDoc](http://rubydoc.info/gems/rspec-rails/2.1/frames) provides additional
+The [RDoc](http://rubydoc.info/gems/rspec-rails/2.2.1/frames) provides additional
information for contributors and/or extenders.
All of the documentation is open source and a work in progress. If you find it
View
12 lib/generators/rspec/integration/integration_generator.rb
@@ -3,7 +3,9 @@
module Rspec
module Generators
class IntegrationGenerator < Base
- class_option :request_specs, :type => :boolean, :default => true, :desc => "Generate request specs"
+ class_option :request_specs, :type => :boolean, :default => true, :desc => "Generate request specs"
+ class_option :webrat, :type => :boolean, :default => false, :desc => "Use webrat methods/matchers"
+ class_option :webrat_matchers, :type => :boolean, :default => false, :desc => "Use webrat methods/matchers (deprecated - use --webrat)"
def generate_request_spec
return unless options[:request_specs]
@@ -11,6 +13,14 @@ def generate_request_spec
template 'request_spec.rb',
File.join('spec/requests', class_path, "#{table_name}_spec.rb")
end
+
+ protected
+
+ def webrat?
+ RSpec.deprecate("the --webrat-matchers option", "--webrat") if options[:webrat_matchers]
+ options[:webrat] || options[:webrat_matchers]
+ end
+
end
end
end
View
6 lib/generators/rspec/integration/templates/request_spec.rb
@@ -3,7 +3,13 @@
describe "<%= class_name.pluralize %>" do
describe "GET /<%= table_name %>" do
it "works! (now write some real specs)" do
+<% if webrat? -%>
+ visit <%= table_name %>_path
+<% else -%>
+ # Run the generator again with the --webrat flag if you want to use webrat methods/matchers
get <%= table_name %>_path
+<% end -%>
+ response.status.should be(200)
end
end
end
View
6 lib/generators/rspec/scaffold/scaffold_generator.rb
@@ -14,7 +14,8 @@ class ScaffoldGenerator < Base
class_option :controller_specs, :type => :boolean, :default => true, :desc => "Generate controller specs"
class_option :view_specs, :type => :boolean, :default => true, :desc => "Generate view specs"
- class_option :webrat_matchers, :type => :boolean, :default => false, :desc => "Use webrat matchers in view specs"
+ class_option :webrat, :type => :boolean, :default => false, :desc => "Use webrat methods/matchers"
+ class_option :webrat_matchers, :type => :boolean, :default => false, :desc => "Use webrat methods/matchers (deprecated - use --webrat)"
class_option :helper_specs, :type => :boolean, :default => true, :desc => "Generate helper specs"
class_option :routing_specs, :type => :boolean, :default => true, :desc => "Generate routing specs"
@@ -51,7 +52,8 @@ def generate_routing_spec
protected
def webrat?
- options[:webrat_matchers] || @webrat_matchers_requested
+ RSpec.deprecate("--webrat-matchers", "--webrat") if options[:webrat_matchers]
+ options[:webrat] || options[:webrat_matchers]
end
def copy_view(view)
View
2  lib/generators/rspec/scaffold/templates/edit_spec.rb
@@ -20,7 +20,7 @@
<% end -%>
end
<% else -%>
- # Run the generator again with the --webrat-matchers flag if you want to use webrat matchers
+ # Run the generator again with the --webrat flag if you want to use webrat matchers
assert_select "form", :action => <%= file_name %>_path(@<%= file_name %>), :method => "post" do
<% for attribute in output_attributes -%>
assert_select "<%= attribute.input_type -%>#<%= file_name %>_<%= attribute.name %>", :name => "<%= file_name %>[<%= attribute.name %>]"
View
2  lib/generators/rspec/scaffold/templates/index_spec.rb
@@ -22,7 +22,7 @@
<% if webrat? -%>
rendered.should have_selector("tr>td", :content => <%= value_for(attribute) %>.to_s, :count => 2)
<% else -%>
- # Run the generator again with the --webrat-matchers flag if you want to use webrat matchers
+ # Run the generator again with the --webrat flag if you want to use webrat matchers
assert_select "tr>td", :text => <%= value_for(attribute) %>.to_s, :count => 2
<% end -%>
<% end -%>
View
2  lib/generators/rspec/scaffold/templates/new_spec.rb
@@ -19,7 +19,7 @@
<% end -%>
end
<% else -%>
- # Run the generator again with the --webrat-matchers flag if you want to use webrat matchers
+ # Run the generator again with the --webrat flag if you want to use webrat matchers
assert_select "form", :action => <%= table_name %>_path, :method => "post" do
<% for attribute in output_attributes -%>
assert_select "<%= attribute.input_type -%>#<%= file_name %>_<%= attribute.name %>", :name => "<%= file_name %>[<%= attribute.name %>]"
View
2  lib/generators/rspec/scaffold/templates/show_spec.rb
@@ -18,7 +18,7 @@
<% if webrat? -%>
rendered.should contain(<%= value_for(attribute) %>.to_s)
<% else -%>
- # Run the generator again with the --webrat-matchers flag if you want to use webrat matchers
+ # Run the generator again with the --webrat flag if you want to use webrat matchers
rendered.should match(/<%= eval(value_for(attribute)) %>/)
<% end -%>
<% end -%>
View
10 lib/rspec/rails/example/controller_example_group.rb
@@ -157,12 +157,20 @@ module InstanceMethods
end
included do
+ subject { controller }
+
metadata[:type] = :controller
+
before do
@routes = ::Rails.application.routes
ActionController::Base.allow_forgery_protection = false
end
- subject { controller }
+
+ webrat do
+ before do
+ Webrat.configure {|c| c.mode = :rails}
+ end
+ end
end
RSpec.configure &include_self_when_dir_matches('spec','controllers')
View
1  lib/rspec/rails/example/helper_example_group.rb
@@ -61,6 +61,7 @@ def _controller_path
included do
metadata[:type] = :helper
+
before do
controller.controller_path = _controller_path
end
View
21 lib/rspec/rails/example/request_example_group.rb
@@ -21,12 +21,21 @@ module RequestExampleGroup
include ActionDispatch::Assertions
include RSpec::Rails::BrowserSimulators
+ module InstanceMethods
+ def app
+ ::Rails.application
+ end
+ end
+
webrat do
include Webrat::Matchers
include Webrat::Methods
- def app
- ::Rails.application
+ module InstanceMethods
+
+ def last_response
+ @response
+ end
end
end
@@ -44,6 +53,14 @@ def app
before do
@router = ::Rails.application.routes
end
+
+ webrat do
+ before do
+ Webrat.configure do |c|
+ c.mode = :rack
+ end
+ end
+ end
end
RSpec.configure &include_self_when_dir_matches('spec','requests')
View
2  lib/rspec/rails/version.rb
@@ -1,7 +1,7 @@
module RSpec # :nodoc:
module Rails # :nodoc:
module Version # :nodoc:
- STRING = '2.2.0'
+ STRING = '2.2.1'
end
end
end
View
6 rspec-rails.gemspec
@@ -57,7 +57,9 @@ Gem::Specification.new do |s|
**************************************************
}
- s.add_runtime_dependency "rails", "~> 3.0.0"
- s.add_runtime_dependency "rspec", "~> #{RSpec::Rails::Version::STRING.split('.')[0..1].join('.')}"
+ s.add_runtime_dependency(%q<activesupport>, ["~> 3.0"])
+ s.add_runtime_dependency(%q<actionpack>, ["~> 3.0"])
+ s.add_runtime_dependency(%q<railties>, ["~> 3.0"])
+ s.add_runtime_dependency "rspec", "~> #{RSpec::Rails::Version::STRING.split('.')[0..1].concat(['0']).join('.')}"
end

No commit comments for this range

Something went wrong with that request. Please try again.