Sha256: 0af0503731f8d31684b40fac8144837a60d9b2d480f7a86f6f32ee5d7ee8aafc

Contents?: true

Size: 1.18 KB

Versions: 13

Compression:

Stored size: 1.18 KB

Contents

require 'spec_helper'

describe Refinery::Activity do
  before { module X; module Y; class Z; end; end; end }

  let(:activity) { Refinery::Activity.new(:class_name => 'X::Y::Z') }

  describe '#base_class_name' do
    it 'returns the base class name, less module nesting' do
      activity.base_class_name.should == 'Z'
    end
  end

  describe '#klass' do
    it 'returns class constant' do
      activity.klass.should == X::Y::Z
    end
  end

  describe '#url_prefix' do
    it 'returns edit_ by default' do
      activity.url_prefix.should == 'edit_'
    end

    it 'returns user specified prefix' do
      activity.url_prefix = 'testy'
      activity.url_prefix.should == 'testy_'
      activity.url_prefix = 'testy_'
      activity.url_prefix.should == 'testy_'
    end
  end

  describe '#url' do
    it 'returns the url' do
      activity.url.should == 'refinery.edit_x_y_admin_z_path'
    end
  end

  describe '#url with Refinery namespace' do
    before { module Refinery; module Y; class Z; end; end; end }
    let(:activity) { Refinery::Activity.new(:class_name => 'Refinery::Y::Z') }
    it 'returns the url' do
      activity.url.should == 'refinery.edit_y_admin_z_path'
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
refinerycms-core-2.1.5 spec/lib/refinery/activity_spec.rb
refinerycms-core-2.1.4 spec/lib/refinery/activity_spec.rb
refinerycms-core-2.1.3 spec/lib/refinery/activity_spec.rb
refinerycms-core-2.1.2 spec/lib/refinery/activity_spec.rb
refinerycms-core-2.1.1 spec/lib/refinery/activity_spec.rb
refinerycms-core-2.1.0 spec/lib/refinery/activity_spec.rb
refinerycms-core-2.0.10 spec/lib/refinery/activity_spec.rb
refinerycms-core-2.0.9 spec/lib/refinery/activity_spec.rb
refinerycms-core-2.0.8 spec/lib/refinery/activity_spec.rb
refinerycms-core-2.0.7 spec/lib/refinery/activity_spec.rb
refinerycms-core-2.0.6 spec/lib/refinery/activity_spec.rb
refinerycms-core-2.0.5 spec/lib/refinery/activity_spec.rb
refinerycms-core-2.0.4 spec/lib/refinery/activity_spec.rb