Sha256: a8a7c5ee839efddd0d67fda9f9921f61f790281a2fb31f2cbc621cb282b9d36e

Contents?: true

Size: 1.43 KB

Versions: 98

Compression:

Stored size: 1.43 KB

Contents

if DependencyHelper.rails_present?
  require "action_view"

  describe Appsignal::EventFormatter::ActionView::RenderFormatter do
    before { allow(Rails.root).to receive(:to_s).and_return("/var/www/app/20130101") }
    let(:klass) { Appsignal::EventFormatter::ActionView::RenderFormatter }
    let(:formatter) { klass.new }

    it "should register render_partial.action_view and render_template.action_view" do
      expect(Appsignal::EventFormatter.registered?("render_partial.action_view", klass)).to be_truthy
      expect(Appsignal::EventFormatter.registered?("render_template.action_view", klass)).to be_truthy
    end

    describe "#root_path" do
      subject { formatter.root_path }

      it "returns Rails root path" do
        is_expected.to eq "/var/www/app/20130101/"
      end
    end

    describe "#format" do
      subject { formatter.format(payload) }

      context "with an identifier" do
        let(:payload) { { :identifier => "/var/www/app/20130101/app/views/home/index/html.erb" } }

        it { is_expected.to eq ["app/views/home/index/html.erb", nil] }
      end

      context "with a frozen identifier" do
        let(:payload) { { :identifier => "/var/www/app/20130101/app/views/home/index/html.erb".freeze } }

        it { is_expected.to eq ["app/views/home/index/html.erb", nil] }
      end

      context "without an identifier" do
        let(:payload) { {} }

        it { is_expected.to be_nil }
      end
    end
  end
end

Version data entries

98 entries across 98 versions & 1 rubygems

Version Path
appsignal-2.9.3 spec/lib/appsignal/event_formatter/action_view/render_formatter_spec.rb
appsignal-2.9.3-java spec/lib/appsignal/event_formatter/action_view/render_formatter_spec.rb
appsignal-2.9.2 spec/lib/appsignal/event_formatter/action_view/render_formatter_spec.rb
appsignal-2.9.2-java spec/lib/appsignal/event_formatter/action_view/render_formatter_spec.rb
appsignal-2.9.2.alpha.1 spec/lib/appsignal/event_formatter/action_view/render_formatter_spec.rb
appsignal-2.9.2.alpha.1-java spec/lib/appsignal/event_formatter/action_view/render_formatter_spec.rb
appsignal-2.9.1-java spec/lib/appsignal/event_formatter/action_view/render_formatter_spec.rb
appsignal-2.9.1 spec/lib/appsignal/event_formatter/action_view/render_formatter_spec.rb
appsignal-2.9.0-java spec/lib/appsignal/event_formatter/action_view/render_formatter_spec.rb
appsignal-2.9.0 spec/lib/appsignal/event_formatter/action_view/render_formatter_spec.rb
appsignal-2.8.4 spec/lib/appsignal/event_formatter/action_view/render_formatter_spec.rb
appsignal-2.8.4-java spec/lib/appsignal/event_formatter/action_view/render_formatter_spec.rb
appsignal-2.8.4.beta.1 spec/lib/appsignal/event_formatter/action_view/render_formatter_spec.rb
appsignal-2.8.4.beta.1-java spec/lib/appsignal/event_formatter/action_view/render_formatter_spec.rb
appsignal-2.8.3 spec/lib/appsignal/event_formatter/action_view/render_formatter_spec.rb
appsignal-2.8.3-java spec/lib/appsignal/event_formatter/action_view/render_formatter_spec.rb
appsignal-2.8.3.beta.1 spec/lib/appsignal/event_formatter/action_view/render_formatter_spec.rb
appsignal-2.8.3.beta.1-java spec/lib/appsignal/event_formatter/action_view/render_formatter_spec.rb
appsignal-2.8.2 spec/lib/appsignal/event_formatter/action_view/render_formatter_spec.rb
appsignal-2.8.2-java spec/lib/appsignal/event_formatter/action_view/render_formatter_spec.rb