Sha256: a895e61425d10fb147dd91c3f8f8a418b21cfcff2d367fc6f74d7ea084586327

Contents?: true

Size: 1.06 KB

Versions: 2

Compression:

Stored size: 1.06 KB

Contents

require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') 

describe_with_render ActiveAdmin::ActionItems do

  # Store the config and set it back after each spec so that we
  # dont mess with other specs
  before do
    @config_before = Admin::PostsController.action_items
    Admin::PostsController.clear_action_items!
  end

  after(:each) do
    Admin::PostsController.action_items = @config_before
  end

  # Helpers method to define an action item
  def action_item(*args, &block)
    Admin::PostsController.class_eval do
      action_item *args, &block
    end
  end

  context "when setting with a block" do
    before do
      action_item do
        link_to "All Posts", collection_path
      end
      get :index
    end
    it "should add a new action item" do
      Admin::PostsController.action_items.size.should == 1
    end
    it "should render the content in the context of the view" do
      response.should have_tag('a', 'All Posts')
    end
  end

  # action_item 'New', new_post_path
  context "when setting with as a link with text and a path"

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
activeadmin-0.1.1 spec/unit/action_items_spec.rb
activeadmin-0.1.0 spec/unit/action_items_spec.rb