Sha256: 208bc8972c3fd0a3339bf91dced3abcdd6b52dcd910848beb713f414b751a64c

Contents?: true

Size: 1.1 KB

Versions: 59

Compression:

Stored size: 1.1 KB

Contents

require 'spec_helper'

describe ActiveAdmin::ViewHelpers::DownloadFormatLinksHelper do

  describe "class methods" do
    before :each do

      begin
        # The mime type to be used in respond_to |format| style web-services in rails
        Mime::Type.register "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", :xlsx
      rescue NameError
        puts "Mime module not defined. Skipping registration of xlsx"
      end

      class Foo
        include ActiveAdmin::ViewHelpers::DownloadFormatLinksHelper
      end
    end

    it "extends the class to add a formats class method that returns the default formats." do
      Foo.formats.should == [:csv, :xml, :json]
    end

    it "does not let you alter the formats array directly" do
      Foo.formats << :xlsx
      Foo.formats.should == [:csv, :xml, :json]
    end

    it "allows us to add new formats" do
      Foo.add_format :xlsx
      Foo.formats.should == [:csv, :xml, :json, :xlsx]
    end

    it "raises an exception if you provide an unregisterd mime type extension" do
      expect{ Foo.add_format :hoge }.to raise_error
    end

  end
end

Version data entries

59 entries across 59 versions & 4 rubygems

Version Path
activeadmin-0.6.6 spec/unit/view_helpers/download_format_links_helper_spec.rb
activeadmin-0.6.5 spec/unit/view_helpers/download_format_links_helper_spec.rb
activeadmin-0.6.4 spec/unit/view_helpers/download_format_links_helper_spec.rb
yousty-activeadmin-1.0.4.pre spec/unit/view_helpers/download_format_links_helper_spec.rb
yousty-activeadmin-1.0.3.pre spec/unit/view_helpers/download_format_links_helper_spec.rb
yousty-activeadmin-1.0.2.pre spec/unit/view_helpers/download_format_links_helper_spec.rb
activeadmin-0.6.3 spec/unit/view_helpers/download_format_links_helper_spec.rb
yousty-activeadmin-1.0.1.pre spec/unit/view_helpers/download_format_links_helper_spec.rb
yousty-activeadmin-1.0.0.pre spec/unit/view_helpers/download_format_links_helper_spec.rb
activeadmin-0.6.2 spec/unit/view_helpers/download_format_links_helper_spec.rb
activeadmin-0.6.1 spec/unit/view_helpers/download_format_links_helper_spec.rb
aa-rails4-0.6.0 spec/unit/view_helpers/download_format_links_helper_spec.rb
lalala-4.0.0.dev.141 vendor/deps/active_admin/spec/unit/view_helpers/download_format_links_helper_spec.rb
lalala-4.0.0.dev.136 vendor/deps/active_admin/spec/unit/view_helpers/download_format_links_helper_spec.rb
lalala-4.0.0.dev.135 vendor/deps/active_admin/spec/unit/view_helpers/download_format_links_helper_spec.rb
lalala-4.0.0.dev.134 vendor/deps/active_admin/spec/unit/view_helpers/download_format_links_helper_spec.rb
lalala-4.0.0.dev.133 vendor/deps/active_admin/spec/unit/view_helpers/download_format_links_helper_spec.rb
lalala-4.0.0.dev.132 vendor/deps/active_admin/spec/unit/view_helpers/download_format_links_helper_spec.rb
lalala-4.0.0.dev.131 vendor/deps/active_admin/spec/unit/view_helpers/download_format_links_helper_spec.rb
lalala-4.0.0.dev.129 vendor/deps/active_admin/spec/unit/view_helpers/download_format_links_helper_spec.rb