Sha256: 60da18929b2be4346ad87d5ea6239a76b7fc58c06beddb9ec6580c04f0cd88f5
Contents?: true
Size: 1.76 KB
Versions: 1
Compression:
Stored size: 1.76 KB
Contents
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') describe Report do describe "requires at least one column" do subject = Report.new subject.used_columns = nil subject.save.should == false subject.errors[:used_columns][0].should =~ /blank/ end describe "query" do it 'returns an arel query' do end end describe "#available_columns" do it "returns all columns and whether they are used or not" do ::ReportUi.reportable_models = [Person] subject.used_columns = ['Person#last_name', "Person#first_name"] subject.available_columns.should == {Person => {:last_name => true, :first_name => true, :id => false, :date_of_birth => false, :amount => false}} end end describe "#humanized_column_names" do it 'returns pretty names of the intended columns' do subject.used_columns = ["Person#name", "SomeClass#date_at"] subject.humanized_column_names.should == ['Name', 'Date at'] end end describe "#column_names" do it 'returns just the names of the intended columns' do subject.used_columns = ["Person#name", "SomeClass#date_at"] subject.column_names.should == ['name', 'date_at'] end end describe "#data" do it "returns an executed query" do Person.create(:last_name => 'smith') Person.create(:last_name => 'roberts') subject.code = "Person.select('last_name').where('last_name = \"smith\"')" subject.data.map(&:last_name).should include 'smith' subject.data.map(&:last_name).should_not include 'roberts' end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
report_ui-0.0.1.alpha | spec/models/report_spec.rb |