Sha256: 080834bf4a7a4b42af94d8ad89129537c23a9a65425f6d4b4b478e0a2ae7c570

Contents?: true

Size: 840 Bytes

Versions: 1

Compression:

Stored size: 840 Bytes

Contents

require_relative "test_helper"

class StimulusReflex::ReflexTest < ActionCable::Channel::TestCase
  tests StimulusReflex::Channel

  setup do
    stub_connection(session_id: SecureRandom.uuid)
    def connection.env
      @env ||= {}
    end
    @reflex = StimulusReflex::Reflex.new(subscribe, url: "https://test.stimulusreflex.com")
    @reflex.controller_class.view_paths << Rails.root.join("test/views")
  end

  test "render plain" do
    assert @reflex.render(plain: "Some text") == "Some text"
  end

  test "render template" do
    assert @reflex.render("/hello_template", assigns: {message: "Testing 123"}) == "<p>Hello from template! Testing 123</p>\n"
  end

  test "render partial" do
    assert @reflex.render(partial: "/hello_partial", assigns: {message: "Testing 123"}) == "<p>Hello from partial! Testing 123</p>\n"
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
stimulus_reflex-3.4.0.pre8 test/reflex_test.rb