GithubHelp home page GithubHelp logo

Comments (5)

palkan avatar palkan commented on May 30, 2024 1

using Rails 6.0.2.1

Then you're using Rails' built-in Action Cable testing tools under the hood.
streams method has been deprecated and wasn't included into Rails version.

Use have_stream matcher instead.

from action-cable-testing.

dthomason avatar dthomason commented on May 30, 2024

thanks for your response. I'm actually using rspec for the testing

➜ rspec -v
RSpec 3.9
  - rspec-core 3.9.1
  - rspec-expectations 3.9.1
  - rspec-mocks 3.9.1
  - rspec-rails 4.0.0
  - rspec-support 3.9.2

But maybe because I'm using Rails 6 it won't work?

I attempted using have_stream(msg) but that is not working either. Guess I'll do some more digging

from action-cable-testing.

palkan avatar palkan commented on May 30, 2024

I'm actually using rspec for the testing

RSpec wraps the API provided by Rails

include ActionCable::Channel::TestCase::Behavior
and defines some additional helpers
def have_rejected_connection
raise_error(::ActionCable::Connection::Authorization::UnauthorizedError)
end
def have_streams
check_subscribed!
RSpec::Rails::Matchers::ActionCable::HaveStream.new
end
def have_stream_from(stream)
check_subscribed!
RSpec::Rails::Matchers::ActionCable::HaveStream.new(stream)
end
def have_stream_for(object)
check_subscribed!
RSpec::Rails::Matchers::ActionCable::HaveStream.new(broadcasting_for(object))
end
.

from action-cable-testing.

dthomason avatar dthomason commented on May 30, 2024

unfortunately that does not allow me to test the modified data from redis that is then being sent to the consumer, that really only verifies the key it's listening to but not the data object being sent.

expect(streams).to include(the_object_being_sent_to_consumer) would be ideal

from action-cable-testing.

palkan avatar palkan commented on May 30, 2024

You should use have_broadcasted_to matcher for that.

from action-cable-testing.

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.