Code Monkey home page Code Monkey logo

Comments (16)

 avatar commented on August 28, 2024

FYI @request.session seems to work, so maybe is just a shortcut missing or something

from rspec-cells.

 avatar commented on August 28, 2024

And it also seems I can't access the named routes. Here's a spec to demonstrate the issues I'm having:

require 'spec_helper'
describe HeaderCell do

  it "demonstrates that we have the correct modules included" do
    # This passes
    self.class.included_modules.should include(RSpec::Rails::CellExampleGroup)
    self.class.included_modules.should include(RSpec::Rails::CellExampleGroup::InstanceMethods)
  end

  it "should have access to named routes via the controller" do
    # This passes
    controller.help_path.should == '/help'
  end

  it "should have access to named routes directly from the example" do
    # This FAILS with:
    # (undefined local variable or method `help_path' for #<RSpec::Core::ExampleGroup::Nested_1:0x007fb137698120>)
    help_path.should == '/help'
  end

  it "should have access to the session variable via the request" do
    # This passes
    @request.session[:foo] = 'bar'
    @request.session[:foo].should == 'bar'
  end

  it "should have access to the session directly from the example" do
    # This FAILS with:
    # (undefined local variable or method `session' for #<RSpec::Core::ExampleGroup::Nested_1:0x007fb137666fd0>)
    session[:bar] = 'baz'
    session[:bar].should == 'baz'
  end

end

from rspec-cells.

nickhoffman avatar nickhoffman commented on August 28, 2024

I just encountered this problem after upgrading rspec-rails from 0.0.5 to 0.1.1 .

Is there a workaround other than prefixing named routes with @request.?

from rspec-cells.

nickhoffman avatar nickhoffman commented on August 28, 2024

Bump

from rspec-cells.

PikachuEXE avatar PikachuEXE commented on August 28, 2024

Still happens today
Is there a quick fix?

from rspec-cells.

apotonick avatar apotonick commented on August 28, 2024

@PikachuEXE Please paste the complete stacktrace.

from rspec-cells.

PikachuEXE avatar PikachuEXE commented on August 28, 2024

@apotonick
Here it is:

Failure/Error: session.key?(:js_event_selector).should be_false
     NameError:
       undefined local variable or method `session' for #<RSpec::Core::ExampleGroup::Nested_1::Nested_2::Nested_1::Nested_3::Nested_1:0x007f8045ad8fa0>
     # /Users/PikachuEXE/.rvm/gems/ruby-2.0.0-p247/gems/rspec-expectations-2.14.3/lib/rspec/matchers/method_missing.rb:9:in `method_missing'
     # ./spec/cells/post_auth_js_event_cell_spec.rb:33:in `block (6 levels) in <top (required)>'
     # /Users/PikachuEXE/.rvm/gems/ruby-2.0.0-p247/gems/rspec-core-2.14.5/lib/rspec/core/example.rb:237:in `instance_eval'
     # /Users/PikachuEXE/.rvm/gems/ruby-2.0.0-p247/gems/rspec-core-2.14.5/lib/rspec/core/example.rb:237:in `instance_eval'
     # /Users/PikachuEXE/.rvm/gems/ruby-2.0.0-p247/gems/rspec-core-2.14.5/lib/rspec/core/hooks.rb:21:in `run'
     # /Users/PikachuEXE/.rvm/gems/ruby-2.0.0-p247/gems/rspec-core-2.14.5/lib/rspec/core/hooks.rb:85:in `block in run'
     # /Users/PikachuEXE/.rvm/gems/ruby-2.0.0-p247/gems/rspec-core-2.14.5/lib/rspec/core/hooks.rb:85:in `each'
     # /Users/PikachuEXE/.rvm/gems/ruby-2.0.0-p247/gems/rspec-core-2.14.5/lib/rspec/core/hooks.rb:85:in `run'
     # /Users/PikachuEXE/.rvm/gems/ruby-2.0.0-p247/gems/rspec-core-2.14.5/lib/rspec/core/hooks.rb:446:in `run_hook'
     # /Users/PikachuEXE/.rvm/gems/ruby-2.0.0-p247/gems/rspec-core-2.14.5/lib/rspec/core/example_group.rb:345:in `run_before_each_hooks'
     # /Users/PikachuEXE/.rvm/gems/ruby-2.0.0-p247/gems/rspec-core-2.14.5/lib/rspec/core/example.rb:300:in `run_before_each'
     # /Users/PikachuEXE/.rvm/gems/ruby-2.0.0-p247/gems/rspec-core-2.14.5/lib/rspec/core/example.rb:113:in `block in run'
     # /Users/PikachuEXE/.rvm/gems/ruby-2.0.0-p247/gems/rspec-core-2.14.5/lib/rspec/core/example.rb:254:in `with_around_each_hooks'
     # /Users/PikachuEXE/.rvm/gems/ruby-2.0.0-p247/gems/rspec-core-2.14.5/lib/rspec/core/example.rb:111:in `run'
     # /Users/PikachuEXE/.rvm/gems/ruby-2.0.0-p247/gems/rspec-core-2.14.5/lib/rspec/core/example_group.rb:390:in `block in run_examples'
     # /Users/PikachuEXE/.rvm/gems/ruby-2.0.0-p247/gems/rspec-core-2.14.5/lib/rspec/core/example_group.rb:386:in `map'
     # /Users/PikachuEXE/.rvm/gems/ruby-2.0.0-p247/gems/rspec-core-2.14.5/lib/rspec/core/example_group.rb:386:in `run_examples'
     # /Users/PikachuEXE/.rvm/gems/ruby-2.0.0-p247/gems/rspec-core-2.14.5/lib/rspec/core/example_group.rb:371:in `run'
     # /Users/PikachuEXE/.rvm/gems/ruby-2.0.0-p247/gems/rspec-core-2.14.5/lib/rspec/core/example_group.rb:372:in `block in run'
     # /Users/PikachuEXE/.rvm/gems/ruby-2.0.0-p247/gems/rspec-core-2.14.5/lib/rspec/core/example_group.rb:372:in `map'
     # /Users/PikachuEXE/.rvm/gems/ruby-2.0.0-p247/gems/rspec-core-2.14.5/lib/rspec/core/example_group.rb:372:in `run'
     # /Users/PikachuEXE/.rvm/gems/ruby-2.0.0-p247/gems/rspec-core-2.14.5/lib/rspec/core/example_group.rb:372:in `block in run'
     # /Users/PikachuEXE/.rvm/gems/ruby-2.0.0-p247/gems/rspec-core-2.14.5/lib/rspec/core/example_group.rb:372:in `map'
     # /Users/PikachuEXE/.rvm/gems/ruby-2.0.0-p247/gems/rspec-core-2.14.5/lib/rspec/core/example_group.rb:372:in `run'
     # /Users/PikachuEXE/.rvm/gems/ruby-2.0.0-p247/gems/rspec-core-2.14.5/lib/rspec/core/example_group.rb:372:in `block in run'
     # /Users/PikachuEXE/.rvm/gems/ruby-2.0.0-p247/gems/rspec-core-2.14.5/lib/rspec/core/example_group.rb:372:in `map'
     # /Users/PikachuEXE/.rvm/gems/ruby-2.0.0-p247/gems/rspec-core-2.14.5/lib/rspec/core/example_group.rb:372:in `run'
     # /Users/PikachuEXE/.rvm/gems/ruby-2.0.0-p247/gems/rspec-core-2.14.5/lib/rspec/core/example_group.rb:372:in `block in run'
     # /Users/PikachuEXE/.rvm/gems/ruby-2.0.0-p247/gems/rspec-core-2.14.5/lib/rspec/core/example_group.rb:372:in `map'
     # /Users/PikachuEXE/.rvm/gems/ruby-2.0.0-p247/gems/rspec-core-2.14.5/lib/rspec/core/example_group.rb:372:in `run'
     # /Users/PikachuEXE/.rvm/gems/ruby-2.0.0-p247/gems/rspec-core-2.14.5/lib/rspec/core/command_line.rb:28:in `block (2 levels) in run'
     # /Users/PikachuEXE/.rvm/gems/ruby-2.0.0-p247/gems/rspec-core-2.14.5/lib/rspec/core/command_line.rb:28:in `map'
     # /Users/PikachuEXE/.rvm/gems/ruby-2.0.0-p247/gems/rspec-core-2.14.5/lib/rspec/core/command_line.rb:28:in `block in run'
     # /Users/PikachuEXE/.rvm/gems/ruby-2.0.0-p247/gems/rspec-core-2.14.5/lib/rspec/core/reporter.rb:58:in `report'
     # /Users/PikachuEXE/.rvm/gems/ruby-2.0.0-p247/gems/rspec-core-2.14.5/lib/rspec/core/command_line.rb:25:in `run'
     # /Users/PikachuEXE/.rvm/gems/ruby-2.0.0-p247/gems/rspec-core-2.14.5/lib/rspec/core/runner.rb:77:in `rescue in run'
     # /Users/PikachuEXE/.rvm/gems/ruby-2.0.0-p247/gems/rspec-core-2.14.5/lib/rspec/core/runner.rb:73:in `run'
     # /Users/PikachuEXE/.rvm/gems/ruby-2.0.0-p247/gems/rspec-core-2.14.5/lib/rspec/core/runner.rb:17:in `block in autorun'

from rspec-cells.

apotonick avatar apotonick commented on August 28, 2024

Still an issue with 0.3?

from rspec-cells.

PikachuEXE avatar PikachuEXE commented on August 28, 2024

Let me check next week

from rspec-cells.

PikachuEXE avatar PikachuEXE commented on August 28, 2024

Can't check since I am unable to upgrade to cells 4 yet

from rspec-cells.

apotonick avatar apotonick commented on August 28, 2024

What keeps you from updating? I know the pain, my friend, we just upgraded an app to Rails 3.2 haha.

from rspec-cells.

PikachuEXE avatar PikachuEXE commented on August 28, 2024

The app has too many "old" cells
Need to convert them all into concept cells first 😣

we just upgraded an app to Rails 3.2
Holy... world

from rspec-cells.

andricicezar avatar andricicezar commented on August 28, 2024

I have this bug too. I try to sign_in a user if it is logged in with CASino and it tries to edit its account,.

class RegistrationsController < Devise::RegistrationsController
  include CASino::SessionsHelper

  before_action :ensure_signed_in, only: [:edit]
  skip_before_filter :authenticate_scope!, only: [:edit]

  def edit
    if current_user
      Class.new.extend(Devise::Controllers::Helpers).sign_in(:devise_users, DeviseUser.find(current_user.id))
    end

    super
  end
end

Full trace:

devise (3.4.1) lib/devise/controllers/sign_in_out.rb:89:in `expire_data_after_sign_in!'
devise (3.4.1) lib/devise/controllers/sign_in_out.rb:35:in `sign_in'
app/controllers/registrations_controller.rb:9:in `edit'
actionpack (4.2.3) lib/action_controller/metal/implicit_render.rb:4:in `send_action'
actionpack (4.2.3) lib/abstract_controller/base.rb:198:in `process_action'
actionpack (4.2.3) lib/action_controller/metal/rendering.rb:10:in `process_action'
actionpack (4.2.3) lib/abstract_controller/callbacks.rb:20:in `block in process_action'
activesupport (4.2.3) lib/active_support/callbacks.rb:115:in `call'
activesupport (4.2.3) lib/active_support/callbacks.rb:115:in `call'
activesupport (4.2.3) lib/active_support/callbacks.rb:553:in `block (2 levels) in compile'
activesupport (4.2.3) lib/active_support/callbacks.rb:503:in `call'
activesupport (4.2.3) lib/active_support/callbacks.rb:503:in `call'
activesupport (4.2.3) lib/active_support/callbacks.rb:88:in `run_callbacks'
actionpack (4.2.3) lib/abstract_controller/callbacks.rb:19:in `process_action'
actionpack (4.2.3) lib/action_controller/metal/rescue.rb:29:in `process_action'
actionpack (4.2.3) lib/action_controller/metal/instrumentation.rb:32:in `block in process_action'
activesupport (4.2.3) lib/active_support/notifications.rb:164:in `block in instrument'
activesupport (4.2.3) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (4.2.3) lib/active_support/notifications.rb:164:in `instrument'
actionpack (4.2.3) lib/action_controller/metal/instrumentation.rb:30:in `process_action'
actionpack (4.2.3) lib/action_controller/metal/params_wrapper.rb:250:in `process_action'
activerecord (4.2.3) lib/active_record/railties/controller_runtime.rb:18:in `process_action'
actionpack (4.2.3) lib/abstract_controller/base.rb:137:in `process'
actionview (4.2.3) lib/action_view/rendering.rb:30:in `process'
actionpack (4.2.3) lib/action_controller/metal.rb:196:in `dispatch'
actionpack (4.2.3) lib/action_controller/metal/rack_delegation.rb:13:in `dispatch'
actionpack (4.2.3) lib/action_controller/metal.rb:237:in `block in action'
actionpack (4.2.3) lib/action_dispatch/routing/route_set.rb:76:in `call'
actionpack (4.2.3) lib/action_dispatch/routing/route_set.rb:76:in `dispatch'
actionpack (4.2.3) lib/action_dispatch/routing/route_set.rb:45:in `serve'
actionpack (4.2.3) lib/action_dispatch/routing/mapper.rb:49:in `serve'
actionpack (4.2.3) lib/action_dispatch/journey/router.rb:43:in `block in serve'
actionpack (4.2.3) lib/action_dispatch/journey/router.rb:30:in `each'
actionpack (4.2.3) lib/action_dispatch/journey/router.rb:30:in `serve'
actionpack (4.2.3) lib/action_dispatch/routing/route_set.rb:821:in `call'
warden (1.2.3) lib/warden/manager.rb:35:in `block in call'
warden (1.2.3) lib/warden/manager.rb:34:in `catch'
warden (1.2.3) lib/warden/manager.rb:34:in `call'
rack (1.6.4) lib/rack/etag.rb:24:in `call'
rack (1.6.4) lib/rack/conditionalget.rb:25:in `call'
rack (1.6.4) lib/rack/head.rb:13:in `call'
actionpack (4.2.3) lib/action_dispatch/middleware/params_parser.rb:27:in `call'
actionpack (4.2.3) lib/action_dispatch/middleware/flash.rb:260:in `call'
rack (1.6.4) lib/rack/session/abstract/id.rb:225:in `context'
rack (1.6.4) lib/rack/session/abstract/id.rb:220:in `call'
actionpack (4.2.3) lib/action_dispatch/middleware/cookies.rb:560:in `call'
activerecord (4.2.3) lib/active_record/query_cache.rb:36:in `call'
activerecord (4.2.3) lib/active_record/connection_adapters/abstract/connection_pool.rb:653:in `call'
activerecord (4.2.3) lib/active_record/migration.rb:377:in `call'
actionpack (4.2.3) lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
activesupport (4.2.3) lib/active_support/callbacks.rb:84:in `run_callbacks'
actionpack (4.2.3) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
actionpack (4.2.3) lib/action_dispatch/middleware/reloader.rb:73:in `call'
actionpack (4.2.3) lib/action_dispatch/middleware/remote_ip.rb:78:in `call'
actionpack (4.2.3) lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call'
web-console (2.2.1) lib/web_console/middleware.rb:31:in `call'
actionpack (4.2.3) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
railties (4.2.3) lib/rails/rack/logger.rb:38:in `call_app'
railties (4.2.3) lib/rails/rack/logger.rb:20:in `block in call'
activesupport (4.2.3) lib/active_support/tagged_logging.rb:68:in `block in tagged'
activesupport (4.2.3) lib/active_support/tagged_logging.rb:26:in `tagged'
activesupport (4.2.3) lib/active_support/tagged_logging.rb:68:in `tagged'
railties (4.2.3) lib/rails/rack/logger.rb:20:in `call'
actionpack (4.2.3) lib/action_dispatch/middleware/request_id.rb:21:in `call'
rack (1.6.4) lib/rack/methodoverride.rb:22:in `call'
rack (1.6.4) lib/rack/runtime.rb:18:in `call'
activesupport (4.2.3) lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call'
rack (1.6.4) lib/rack/lock.rb:17:in `call'
actionpack (4.2.3) lib/action_dispatch/middleware/static.rb:116:in `call'
rack (1.6.4) lib/rack/sendfile.rb:113:in `call'
railties (4.2.3) lib/rails/engine.rb:518:in `call'
railties (4.2.3) lib/rails/application.rb:165:in `call'
rack (1.6.4) lib/rack/lock.rb:17:in `call'
rack (1.6.4) lib/rack/content_length.rb:15:in `call'
rack (1.6.4) lib/rack/handler/webrick.rb:88:in `service'
/home/vagrant/.rbenv/versions/2.2.1/lib/ruby/2.2.0/webrick/httpserver.rb:138:in `service'
/home/vagrant/.rbenv/versions/2.2.1/lib/ruby/2.2.0/webrick/httpserver.rb:94:in `run'
/home/vagrant/.rbenv/versions/2.2.1/lib/ruby/2.2.0/webrick/server.rb:294:in `block in start_thread'

from rspec-cells.

apotonick avatar apotonick commented on August 28, 2024

Your breaking spec file would be helpful to see. I have to warn you, though, I don't use Rspec and Devise so it might take a while.

from rspec-cells.

Chongyihyang avatar Chongyihyang commented on August 28, 2024

error1
error1-2
Annoying

from rspec-cells.

PikachuEXE avatar PikachuEXE commented on August 28, 2024

This doesn't seem to be related to cells?

from rspec-cells.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.