rspec / rspec-rails Goto Github PK
View Code? Open in Web Editor NEWRSpec for Rails 6+
Home Page: https://rspec.info
License: MIT License
RSpec for Rails 6+
Home Page: https://rspec.info
License: MIT License
Allow using non active_record or non sql/relational databases, such as document or key-value stores. Have an adapter API with a sample Adapter implementation fx for Mongo DB :)
rspec-rails-2 forces transactions around each example - add ability to turn it off
Right now it only gen's a controller spec
Hello there.
The following view spec produces this exception: "undefined method `assert_template' for #Rspec::Matchers::Matcher:0x482a600"
describe 'posts/show' do
it "renders the article" do
render
response.should render_template('posts/_article')
end
end
response returns an ActiveSupport::SafeBuffer object, is it normal?
I'm on the master branch, latest commit.
describe 'posts/index'
context "when no post is published yet"
it "should do something"
render # tries to render "when no post is published yet" file
end
end
end
Is this normal and should I change my habits with rspec2 or is it a bug?
Hi!
I read in the README file that view isolation is not implemented in controller specs. I'm missing it and thought it might be of some use to share that need here.
Very likely that rspec-mocks just needs to implement to_str
undefined method `keys' for nil:NilClass is raised when using render_template:
class PostsController < ApplicationController
def show
render :template => "posts/details"
end
end
describe PostsController do
it "should render the correct template" do
get :show
response.should render_template("posts/details")
end
end
ActiveSupport::Notifications.subscribe's argment is changed on this commit
http://github.com/rails/rails/commit/731d4392e478ff5526b595074d9caa999da8bd0c
Please backport.
Since rspec-rails 2.0.0.beta.8 there is no method called "controller". The instance variable is still in place. This might be consistent with test/unit (not sure), but is not consistent with previous versions of rspec.
I've a patch but how can I send it to you?
here's the command i'm running, with the results summary next to each line
bundle exec spec /path/to/some_spec.rb --line_number=n
1. require 'spec_helper' # 0 examples, 0 failures
2. # 0 examples, 0 failures
3. describe 'something or other' do # 2 examples, 1 failures
4. it 'should pass' do # 1 example, 0 failures
5. true.should be_true # 0 examples, 0 failures
6. end # 0 examples, 0 failures
7. # 0 examples, 0 failures
8. it 'should fail' do # 1 example, 1 failures
9. fail # 0 examples, 0 failures
10. end # 0 examples, 0 failures
11. end # 0 examples, 0 failures
12. # 0 examples, 0 failures
Helper specs get generated, but they are not really "helper specs" in that they offer no specific support yet for spec'ing helpers.
They need to:
There's no rspec-rails.gemspec file in the repository (I guess you generate it manually).
The effet to that is we can't use bundler to get and use the edge version.
Could it be possible to add the gemspec file ?
I am using MongoMapper with Rails 3. My application specifically doesn't include active record. My application.rb looks like this
/config/application.rb
3 %w(
4 action_controller
5 action_mailer
6 active_resource
7 rails/test_unit
8 ).each do |framework|
9 require "#{framework}/railtie"
10 end
When I debug through the app, ActiveRecord is not loaded the line before "require 'rspec/rails'". However, it is directly after.
Would be nice to have the option to configure rails to not generate view specs if you prefer not to. Like Paul Barry does in this post:
http://paulbarry.com/articles/2010/01/13/customizing-generators-in-rails-3
That is to configure like:
g.test_framework :rspec, :views => false
I've updated to recent (master) version of rspec-rails and noticed that request specs don't render templates anymore ("RSpec-generated template" text instead).
I've reverted to ref 38c04ca and it works there so it looks like recent changes to rendering broke things.
Hello,
I'm trying to write some routing specs for my controller.
As you're doing in the routing generator : http://github.com/rspec/rspec-rails/blob/master/lib/generators/rspec/scaffold/templates/routing_spec.rb
I've creates spec/routing/controller_routing_spec.rb
with my routing specs.
However I constantly get the two following errors :
undefined method `params_from' for #<Rspec::Core::ExampleGroup::Nested_5::Nested_6:0x10a07ae80>
undefined method `route_for' for #<Rspec::Core::ExampleGroup::Nested_5::Nested_6:0x10a07ae80>
I guess that's because routing specing isn't implemented yet. So I create this ticket as a "todo".
Please update it to use beta.3 tag in the example ;)
spec/lib/rspec/rails/transactional_database_support_spec.rb doesn't exist.
should be spec/rspec/rails/transactional_database_support_spec.rb instead
When describing a controller it has no type, so Rspec.configuration.include(Foo, :type => :controller) doesn't work.
While it is possible to specify it by hand, it would be nice if controllers have a type automatically (or the manual type declaration is generated in the file).
Per #22.
Hi,
When I try to start up autospec by running:
AUTOFEATURE=true autospec
Is resulting in:
/opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/gems/1.8/gems/rspec-rails-1.3.2/lib/autotest/rails_rspec.rb:36: undefined method `singularize' for "permissions":String (NoMethodError)
I tried to install various versions of the gem, rspec and ZenTest and in different combinations but I keep on getting those errors.
Is this something I'm doing wrong?
To me it seems Rails' inflections are not loaded at the time rspec-rails needs them...
Wout
rails g scaffold tester title:string
rake spec
Several controller specs fail with:
TestersController PUT update with invalid params re-renders the 'edit' template
Failure/Error: Unable to find matching line from backtrace
Stub "errors" received unexpected message :any? with (no args)
Why was this removed from git? You can no longer use bundle install in Rails 3 to grab the latest version of rspec-rails.
Apologies if this is a non-issue, as I've got rspec-rails working with cucumber in rails 3 when I follow your installation instructions. Thanks!
However just in case it's useful, thought I'd post the output I got when I tried to use the edge version in my Gemfile:
gem 'rspec-rails', :git => "git://github.com/rspec/rspec-rails.git"
Nick
Hi,
I needed #persisted? on my mocks so that activepack can handle routes properly within form helpers. I forked rspec-rails and applied a patch, there are no specs though.
Here is the commit: http://github.com/jbpros/rspec-rails/commit/ceaa1613034a77128b070d1b12860e982e2680f2
HTH,
Julien.
I am using RSpec-2 on a Rails 3 project.
I have a view spec similar to
describe "some_controller/index.html.haml" do
it "renders some text" do
render
response.should contain "some text"
end
context "something specific" do
it "renders something else" do
render #breaks here
response.should have_selector("a")
end
end
end
The second call to render breaks the spec because, by default it tries to render template "/something specific" or the description passed to context (describe). The render error is similar to:
Missing template /something specific with {:formats=>nil} in view path
I believe in rspec-1, rspec-rails-1.3.2 the second call to render would still, by default, render some_controller/index.html.haml.
Hi!
I'd like to spec a partial and I need to pass local variables to it. The render method in view specs does not allow any parameters, as it was the case with Rspec1. Is there another way to set locals for the view or is it currently missing from Rspec2?
Thanks!
Julien.
This should replicate the bug:
class SomeController < ApplicationController
def test
head :ok
end
end
describe SomeController do
it "should not blow up when setting a cookie" do
cookies[:a] = "b"
get :test
end
end
This raises quite a cryptic error. I tracked down the problem to the interaction between the ActionDispatch::Integration::Runner and ControllerExampleGroupBehaviour:
def app
described_class.action(@_action).tap do |endpoint|
def endpoint.routes
Rails.application.routes
end
end
end
%w[get post put delete head].map do |method|
eval <<-CODE
def #{method}(*args)
@_action = args.shift
super '/', *args
end
CODE
end
When cookies gets called on the runner the integration_session gets set up with the app - but since @_action still hasn't been set the integration_session ends up with an app with no action. When post gets called @_action gets set, but the app has already been cached and the test request fails.
If autospec throws an exception for whatever reason, it's promptly eaten by ZenTest and no debug information is displayed to the user.
Here's an example:
$ autospec
loading autotest/rails_rspec
$
Not very helpful. :)
Here's a patch to fix this: http://gist.github.com/364403
Per https://rspec.lighthouseapp.com/projects/5645/tickets/962
Need to add support for:
Widget.should have(1).error_on(:name)
Widget.should have(2).errors_on(:email)
I've recently tried ruby 1.9.1 with my Rails apps. RSpec breaks with:
undefined method `root' for Spec::Rails:Module
This happens when I use things like Rails.root.join('spec', 'fixtures', 'bla.jpg') or Rails.env.production?
Obviously when I prefix Rails with :: the error goes away. On Ruby 1.8.7 the error doesn't exist.
on UserController.rb,i write following code :
@user = User.new
but on UserController spec file
assigns[:user].should_not be_nil # failed!!
assigns[:user] return nil alway.
./lib/generators/rspec/install/templates/spec/spec_helper.rb:
generates this:
But should generate this:
I'm building several engines from individual apps for an in-house project, and I test them with rspec. When run as an engine, the MyApp::Application type is not loaded (and imho it shouldn't be, there's a separate MyApp::Engine that is loaded instead.)
To wit, rspec's generated initializer breaks in this situation, since MyApp::Application is unavailable. Appending "if defined? MyApp::Application" to the final "end" is enough to fix it.
If I have spec/ (with real specs) and test/ (with scaffold tests) in rails project tree I got an error:
�[f/usr/lib/ruby/gems/svn/gems/rspec-rails-2.0.0.beta.8/lib/autotest/rails_rspec2.rb:36:in block (2 levels) in <top (required)>': undefined method
singularize' for "companies":String (NoMethodError)
from /usr/lib/ruby/gems/svn/gems/autotest-4.2.10/lib/autotest.rb:529:in call' from /usr/lib/ruby/gems/svn/gems/autotest-4.2.10/lib/autotest.rb:529:in
test_files_for'
from /usr/lib/ruby/gems/svn/gems/autotest-4.2.10/lib/autotest.rb:401:in block in find_files_to_test' from /usr/lib/ruby/gems/svn/gems/autotest-4.2.10/lib/autotest.rb:401:in
each'
from /usr/lib/ruby/gems/svn/gems/autotest-4.2.10/lib/autotest.rb:401:in map' from /usr/lib/ruby/gems/svn/gems/autotest-4.2.10/lib/autotest.rb:401:in
find_files_to_test'
from /usr/lib/ruby/gems/svn/gems/autotest-4.2.10/lib/autotest.rb:256:in run_tests' from /usr/lib/ruby/gems/svn/gems/autotest-4.2.10/lib/autotest.rb:245:in
get_to_green'
from /usr/lib/ruby/gems/svn/gems/cucumber-0.7.2/lib/autotest/cucumber_mixin.rb:54:in get_to_green' from /usr/lib/ruby/gems/svn/gems/cucumber-0.7.2/lib/autotest/cucumber_mixin.rb:28:in
block in run'
from /usr/lib/ruby/gems/svn/gems/cucumber-0.7.2/lib/autotest/cucumber_mixin.rb:26:in loop' from /usr/lib/ruby/gems/svn/gems/cucumber-0.7.2/lib/autotest/cucumber_mixin.rb:26:in
run'
from /usr/lib/ruby/gems/svn/gems/autotest-4.2.10/lib/autotest.rb:135:in run' from /usr/lib/ruby/gems/svn/gems/autotest-4.2.10/bin/autotest:54:in
<top (required)>'
from /usr/bin/autotest:19:in load' from /usr/bin/autotest:19:in
'
But if I move test/ to test2/ all is ok.
My system settings:
Arch Linux x86_64
ruby 1.9.3dev (2010-05-08 trunk 27674) x86_64-linux
Rails 3.0.0.beta.3
# gem-svn list | grep rspec
rspec (2.0.0.beta.8)
rspec-core (2.0.0.beta.8)
rspec-expectations (2.0.0.beta.8)
rspec-mocks (2.0.0.beta.8)
rspec-rails (2.0.0.beta.8)gem-svn list | grep autotest
autotest (4.2.10)
autotest-growl (0.2.4)
autotest-rails-pure (4.1.0)
Gemfile:
source 'http://rubygems.org'
gem 'rails', '3.0.0.beta3'
gem 'devise', '1.1.rc1'
gem 'mysql'
group :test do
gem 'database_cleaner'
gem 'rspec-rails', '>=2.0.0.beta.8'
gem 'rspec', '>=2.0.0.beta.8'
gem 'test-unit'
gem 'cucumber', '0.7.2'
gem 'cucumber-rails', '0.3.1'#, :git => 'git://github.com/aslakhellesoy/cucumber-rails.git'
gem 'capybara'
gem 'autotest'
gem 'autotest-rails-pure'
gem 'autotest-growl'
gem 'machinist'
end
Trying to stub a controller method throws an error when the controller action is called, e.g.:
controller.stub!(:current_host).and_return(Factory.build(:host))
post :create
Results in:
Failure/Error: post :create
can't convert nil into String
# (eval):3:in `post'
Removing the stub doesn't cause the error and the post is fails as expected. In fact even trying to dump the controller before the post causes this error (as I wasn't sure if it was still controller or had
been moved to an instance variable).
Hi,
I have a suggestion for rspec-rails: no generation of a rspec.rake files. Instead, you can use the new Railtie possibilities of Rails3 to load rake tasks from the rspec-rails gem. An example of how to do this on paperclip is here: http://github.com/nono/paperclip/blob/rails3/lib/paperclip/railtie.rb
I think it will avoid the problems of out-of-date rspec.rake. What do you think of it?
In the generated Rakefile and spec_helper, It should use Rails.root as it is meant to be used:
rspec.rake:
-spec_prereq = File.exist?(File.join(Rails.root, 'config', 'database.yml')) ? "db:test:prepare" : :noop
+spec_prereq = Rails.root.join('config', 'database.yml').exist? ? "db:test:prepare" : :noop
spec_helper.rb:
-require File.dirname(FILE) + "/../config/environment" unless defined?(RAILS_ROOT)
+require File.dirname(FILE) + "/../config/environment" unless defined?(Rails)
Using Ruby 1.9.1, Rails Edge, RSpec "Edge", RSpec-Rails "Edge". Generators configuration in application.rb
config.generators do |g| g.test_framework :rspec, :fixture => true, :views => false g.fixture_replacement :factory_girl, :dir => "spec/factories" end
When trying to generate scaffolds RSpec causes exception:
$ rails generate scaffold foo invoke active_record create db/migrate/20100417161944_create_foos.rb create app/models/foo.rb invoke rspec create spec/models/foo_spec.rb (erb):1:in `template': undefined local variable or method `class_nesting_depth' for # (NameError) from /Users/alfanick/.rvm/rubies/ruby-1.9.1-p378/lib/ruby/1.9.1/erb.rb:753:in `eval' from /Users/alfanick/.rvm/rubies/ruby-1.9.1-p378/lib/ruby/1.9.1/erb.rb:753:in `result' from /Users/alfanick/.rvm/gems/ruby-1.9.1-p378/gems/thor-0.13.4/lib/thor/actions/file_manipulation.rb:83:in `block in template' from /Users/alfanick/.rvm/gems/ruby-1.9.1-p378/gems/thor-0.13.4/lib/thor/actions/create_file.rb:52:in `call' from /Users/alfanick/.rvm/gems/ruby-1.9.1-p378/gems/thor-0.13.4/lib/thor/actions/create_file.rb:52:in `render' from /Users/alfanick/.rvm/gems/ruby-1.9.1-p378/gems/thor-0.13.4/lib/thor/actions/create_file.rb:61:in `block (2 levels) in invoke!' from /Users/alfanick/.rvm/gems/ruby-1.9.1-p378/gems/thor-0.13.4/lib/thor/actions/create_file.rb:61:in `open' from /Users/alfanick/.rvm/gems/ruby-1.9.1-p378/gems/thor-0.13.4/lib/thor/actions/create_file.rb:61:in `block in invoke!' from /Users/alfanick/.rvm/gems/ruby-1.9.1-p378/gems/thor-0.13.4/lib/thor/actions/empty_directory.rb:114:in `call' from /Users/alfanick/.rvm/gems/ruby-1.9.1-p378/gems/thor-0.13.4/lib/thor/actions/empty_directory.rb:114:in `invoke_with_conflict_check' from /Users/alfanick/.rvm/gems/ruby-1.9.1-p378/gems/thor-0.13.4/lib/thor/actions/create_file.rb:59:in `invoke!' from /Users/alfanick/.rvm/gems/ruby-1.9.1-p378/gems/thor-0.13.4/lib/thor/actions.rb:86:in `action' from /Users/alfanick/.rvm/gems/ruby-1.9.1-p378/gems/thor-0.13.4/lib/thor/actions/create_file.rb:24:in `create_file' from /Users/alfanick/.rvm/gems/ruby-1.9.1-p378/gems/thor-0.13.4/lib/thor/actions/file_manipulation.rb:82:in `template' from /Volumes/WD Data/Projekty/Websites/photographers_catalog/lib/generators/rspec/model/model_generator.rb:10:in `create_test_file' from /Users/alfanick/.rvm/gems/ruby-1.9.1-p378/gems/thor-0.13.4/lib/thor/task.rb:33:in `run' from /Users/alfanick/.rvm/gems/ruby-1.9.1-p378/gems/thor-0.13.4/lib/thor/invocation.rb:109:in `block in invoke' from /Users/alfanick/.rvm/gems/ruby-1.9.1-p378/gems/thor-0.13.4/lib/thor/invocation.rb:118:in `each' from /Users/alfanick/.rvm/gems/ruby-1.9.1-p378/gems/thor-0.13.4/lib/thor/invocation.rb:118:in `map' from /Users/alfanick/.rvm/gems/ruby-1.9.1-p378/gems/thor-0.13.4/lib/thor/invocation.rb:118:in `invoke' from /Users/alfanick/.rvm/gems/ruby-1.9.1-p378/gems/thor-0.13.4/lib/thor/group.rb:267:in `block in _invoke_for_class_method' from /Users/alfanick/.rvm/gems/ruby-1.9.1-p378/gems/thor-0.13.4/lib/thor/shell.rb:69:in `with_padding' from /Users/alfanick/.rvm/gems/ruby-1.9.1-p378/gems/thor-0.13.4/lib/thor/group.rb:256:in `_invoke_for_class_method' from /Users/alfanick/.rvm/gems/ruby-1.9.1-p378/gems/thor-0.13.4/lib/thor/group.rb:165:in `_invoke_from_option_test_framework' from /Users/alfanick/.rvm/gems/ruby-1.9.1-p378/gems/thor-0.13.4/lib/thor/task.rb:33:in `run' from /Users/alfanick/.rvm/gems/ruby-1.9.1-p378/gems/thor-0.13.4/lib/thor/invocation.rb:109:in `block in invoke' from /Users/alfanick/.rvm/gems/ruby-1.9.1-p378/gems/thor-0.13.4/lib/thor/invocation.rb:118:in `each' from /Users/alfanick/.rvm/gems/ruby-1.9.1-p378/gems/thor-0.13.4/lib/thor/invocation.rb:118:in `map' from /Users/alfanick/.rvm/gems/ruby-1.9.1-p378/gems/thor-0.13.4/lib/thor/invocation.rb:118:in `invoke' from /Users/alfanick/.rvm/gems/ruby-1.9.1-p378/gems/thor-0.13.4/lib/thor/group.rb:267:in `block in _invoke_for_class_method' from /Users/alfanick/.rvm/gems/ruby-1.9.1-p378/gems/thor-0.13.4/lib/thor/shell.rb:69:in `with_padding' from /Users/alfanick/.rvm/gems/ruby-1.9.1-p378/gems/thor-0.13.4/lib/thor/group.rb:256:in `_invoke_for_class_method' from /Users/alfanick/.rvm/gems/ruby-1.9.1-p378/gems/thor-0.13.4/lib/thor/group.rb:165:in `_invoke_from_option_orm' from /Users/alfanick/.rvm/gems/ruby-1.9.1-p378/gems/thor-0.13.4/lib/thor/task.rb:33:in `run' from /Users/alfanick/.rvm/gems/ruby-1.9.1-p378/gems/thor-0.13.4/lib/thor/invocation.rb:109:in `block in invoke' from /Users/alfanick/.rvm/gems/ruby-1.9.1-p378/gems/thor-0.13.4/lib/thor/invocation.rb:118:in `each' from /Users/alfanick/.rvm/gems/ruby-1.9.1-p378/gems/thor-0.13.4/lib/thor/invocation.rb:118:in `map' from /Users/alfanick/.rvm/gems/ruby-1.9.1-p378/gems/thor-0.13.4/lib/thor/invocation.rb:118:in `invoke' from /Users/alfanick/.rvm/gems/ruby-1.9.1-p378/gems/thor-0.13.4/lib/thor/group.rb:36:in `block in start' from /Users/alfanick/.rvm/gems/ruby-1.9.1-p378/gems/thor-0.13.4/lib/thor/base.rb:378:in `start' from /Users/alfanick/.rvm/gems/ruby-1.9.1-p378/gems/thor-0.13.4/lib/thor/group.rb:29:in `start' from /Users/alfanick/.rvm/gems/ruby-1.9.1-p378/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/railties/lib/rails/generators.rb:163:in `invoke' from /Users/alfanick/.rvm/gems/ruby-1.9.1-p378/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/railties/lib/rails/commands/generate.rb:9:in `' from /Users/alfanick/.rvm/gems/ruby-1.9.1-p378/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/activesupport/lib/active_support/dependencies.rb:209:in `require' from /Users/alfanick/.rvm/gems/ruby-1.9.1-p378/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/activesupport/lib/active_support/dependencies.rb:209:in `block in require' from /Users/alfanick/.rvm/gems/ruby-1.9.1-p378/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/activesupport/lib/active_support/dependencies.rb:195:in `block in load_dependency' from /Users/alfanick/.rvm/gems/ruby-1.9.1-p378/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/activesupport/lib/active_support/dependencies.rb:523:in `new_constants_in' from /Users/alfanick/.rvm/gems/ruby-1.9.1-p378/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/activesupport/lib/active_support/dependencies.rb:195:in `load_dependency' from /Users/alfanick/.rvm/gems/ruby-1.9.1-p378/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/activesupport/lib/active_support/dependencies.rb:209:in `require' from /Users/alfanick/.rvm/gems/ruby-1.9.1-p378/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/railties/lib/rails/commands.rb:30:in `' from script/rails:9:in `require' from script/rails:9:in `'
It's all about some class_nesting_depth, but I can't find anything useful online. Looks like a bug in lib/generators/rspec/model/model_generator.rb
As of beta.8, there is no fixture support.
It looks like this file does not exist in the standard library of ruby1.9.1..
/home/mbj/.gem/ruby/1.9.1/gems/activesupport-3.0.0.beta/lib/active_support/dependencies.rb:169:in require': no such file to load -- test/unit/assertionfailederror (LoadError) from /home/mbj/.gem/ruby/1.9.1/gems/activesupport-3.0.0.beta/lib/active_support/dependencies.rb:169:in
require'
from /home/mbj/.bundle/ruby/1.9.1/gems/rspec-rails-2.0.0.a10/lib/rspec/rails/matchers.rb:2:in <top (required)>' from /home/mbj/.gem/ruby/1.9.1/gems/activesupport-3.0.0.beta/lib/active_support/dependencies.rb:169:in
require'
from /home/mbj/.gem/ruby/1.9.1/gems/activesupport-3.0.0.beta/lib/active_support/dependencies.rb:169:in require' from /home/mbj/.bundle/ruby/1.9.1/gems/rspec-rails-2.0.0.a10/lib/rspec/rails.rb:2:in
<top (required)>'
from /home/mbj/.gem/ruby/1.9.1/gems/activesupport-3.0.0.beta/lib/active_support/dependencies.rb:169:in require' from /home/mbj/.gem/ruby/1.9.1/gems/activesupport-3.0.0.beta/lib/active_support/dependencies.rb:169:in
require'
from /home/mbj/devel/testapp/vehicles/spec/spec_helper.rb:5:in <top (required)>' from ./spec/controllers/vehicles_controller_spec.rb:1:in
require'
from ./spec/controllers/vehicles_controller_spec.rb:1:in `
Hi!
post = mock_model(Post).as_new_record
post.new_record?.should be_true # fails
Is it implemented yet?
I'm using CanCan for authorisation and it relies on params[:action] and params[:controller] to determine what resource to load for authorisation checks in a before filter. The specs work when CanCan is disabled so the routing etc is all correct.
The spec is:
describe "GET 'new'" do
it "should be successful" do
get 'new'
response.should be_success
end
end
I can see that the params hash is empty within the action method which is wrong as it should have the action and controller entries. I can work around this by modifying the spec for now, i.e.:
describe "GET 'new'" do
it "should be successful" do
get 'new', { :action => :new, :controller => :users }
response.should be_success
end
end
I suspect this is due to the usage of ActionDispatch::Integration as you mention on similar issues (http://rspec.lighthouseapp.com/projects/5645/tickets/963-request-is-nil and http://github.com/rspec/rspec-rails/issues#issue/10).
From lib/rspec/rails/example/controller_example_group.rb:22. Grep says TemplateAssertions isn't defined anywhere in the rspec-* beta.6 packages
As of beta.8, webrat is hard-coded and the only choice - should make this configurable
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.