Sha256: 2d80302651a1f45d0c638cdfc2e73c4ee561fdc2aa4a6b8ff8c7eaf5af6088a2

Contents?: true

Size: 1.15 KB

Versions: 15

Compression:

Stored size: 1.15 KB

Contents

require 'spec_helper'
require "datagrid/rspec"


describe SimpleReport do
  
  it_should_behave_like 'Datagrid'
  
  let(:group) { Group.create!(:name => "Pop") }
  
  subject do
    SimpleReport.new(
      :group_id => group.id,
      :name => "Star",
      :category => "first",
      :disabled => false,
      :confirmed => false
    )
  end

  let!(:entry) {  Entry.create!(
    :group => group, :name => "Star", :disabled => false, :confirmed => false, :category => "first"
  ) }

  its(:assets) { should include(entry) }

  describe ".attributes" do
    it "should return report attributes" do
      (subject.filters.map(&:name) + [:order, :descending]).each do |attribute|
        subject.attributes.should have_key(attribute)
      end
    end

  end

  describe ".scope" do
    it "should return defined scope of objects" do
      subject.scope.should respond_to(:each)
    end
      

    context "when not defined on class level" do
      subject do
        test_report {}
      end

      it "should raise ConfigurationError" do
        lambda {
          subject.scope
        }.should raise_error(Datagrid::ConfigurationError)

      end
    end
  end



end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
datagrid-1.0.1 spec/datagrid_spec.rb
datagrid-1.0.0 spec/datagrid_spec.rb
datagrid-0.9.3 spec/datagrid_spec.rb
datagrid-0.9.2 spec/datagrid_spec.rb
datagrid-0.9.0 spec/datagrid_spec.rb
datagrid-0.8.4 spec/datagrid_spec.rb
datagrid-0.8.3 spec/datagrid_spec.rb
datagrid-0.8.2 spec/datagrid_spec.rb
datagrid-0.8.1 spec/datagrid_spec.rb
datagrid-0.8.0 spec/datagrid_spec.rb
datagrid-0.7.1 spec/datagrid_spec.rb
datagrid-0.7.0 spec/datagrid_spec.rb
datagrid-0.6.4 spec/datagrid_spec.rb
datagrid-0.6.3 spec/datagrid_spec.rb
datagrid-0.6.2 spec/datagrid_spec.rb