Sha256: cff6c05a7141767697734f81b55573fc6e860ab1f549e3f78eba3bbb583898c6

Contents?: true

Size: 1.3 KB

Versions: 1

Compression:

Stored size: 1.3 KB

Contents

if DependencyHelper.rails_present?
  require "action_view"

  describe Appsignal::EventFormatter::ActionView::RenderFormatter do
    before { Rails.root.stub(:to_s => "/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
      Appsignal::EventFormatter.registered?("render_partial.action_view", klass).should be_true
      Appsignal::EventFormatter.registered?("render_template.action_view", klass).should be_true
    end

    describe "#root_path" do
      its(:root_path) { should eq "/var/www/app/20130101/" }
    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 { should 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 { should eq ["app/views/home/index/html.erb", nil] }
      end

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

        it { should be_nil }
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
appsignal-2.1.0.beta.1 spec/lib/appsignal/event_formatter/action_view/render_formatter_spec.rb