Sha256: 93f0119b8f2f65fe7a783461e218a5aba9ecf5b2a1d97af4027135a564eb9d92

Contents?: true

Size: 981 Bytes

Versions: 6

Compression:

Stored size: 981 Bytes

Contents

require 'spec_helper'

describe ActiveAdmin::Scope do

  describe "creating a scope" do
    subject{ scope }

    context "when just a scope method" do
      let(:scope)        { ActiveAdmin::Scope.new :published }
      its(:name)         { should == "Published"}
      its(:id)           { should == "published"}
      its(:scope_method) { should == :published }
    end

    context "when a name and scope method" do
      let(:scope)        { ActiveAdmin::Scope.new "My Scope", :scope_method }
      its(:name)         { should == "My Scope"}
      its(:id)           { should == "my_scope"}
      its(:scope_method) { should == :scope_method }
    end

    context "when a name and scope block" do
      let(:scope)        { ActiveAdmin::Scope.new("My Scope"){|s| s } }
      its(:name)         { should == "My Scope"}
      its(:id)           { should == "my_scope"}
      its(:scope_method) { should == nil }
      its(:scope_block)  { should be_a(Proc)}
    end
  end

end

Version data entries

6 entries across 6 versions & 3 rubygems

Version Path
nsm-activeadmin-0.2.2 spec/unit/scope_spec.rb
saulolso-activeadmin-0.2.2.1 spec/unit/scope_spec.rb
saulolso-activeadmin-0.2.2 spec/unit/scope_spec.rb
activeadmin-0.2.2 spec/unit/scope_spec.rb
activeadmin-0.2.1 spec/unit/scope_spec.rb
activeadmin-0.2.0 spec/unit/scope_spec.rb