File: channel_generator_spec.rb

package info (click to toggle)
ruby-rspec-rails 7.1.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,796 kB
  • sloc: ruby: 11,068; sh: 198; makefile: 6
file content (15 lines) | stat: -rw-r--r-- 582 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# Generators are not automatically loaded by Rails
require "generators/rspec/channel/channel_generator"
require 'support/generators'

RSpec.describe Rspec::Generators::ChannelGenerator, type: :generator, skip: !RSpec::Rails::FeatureCheck.has_action_cable_testing? do
  setup_default_destination

  before { run_generator %w[chat] }

  subject(:channel_spec) { file("spec/channels/chat_channel_spec.rb") }

  it "generates a channel spec file" do
    expect(channel_spec).to contain(/require 'rails_helper'/).and(contain(/describe ChatChannel, #{type_metatag(:channel)}/))
  end
end