|
|
@ -277,14 +277,20 @@ describe CostQuery, :reporting_query_helper => true do |
|
|
|
clear_cache |
|
|
|
clear_cache |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def class_name_for(name) |
|
|
|
|
|
|
|
"CostQuery::Filter::CustomField#{IssueCustomField.find_by_name(name).id}" |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
it "should create classes for custom fields that get added after starting the server" do |
|
|
|
it "should create classes for custom fields that get added after starting the server" do |
|
|
|
clear_cache |
|
|
|
custom_field |
|
|
|
expect { CostQuery::Filter::CustomFieldMyCustomField }.to_not raise_error |
|
|
|
expect { class_name_for('My custom field').constantize }.to_not raise_error |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
it "should remove the custom field classes after it is deleted" do |
|
|
|
it "should remove the custom field classes after it is deleted" do |
|
|
|
|
|
|
|
custom_field |
|
|
|
|
|
|
|
class_name = class_name_for('My custom field') |
|
|
|
delete_issue_custom_field("My custom field") |
|
|
|
delete_issue_custom_field("My custom field") |
|
|
|
CostQuery::Filter.all.should_not include CostQuery::Filter::CustomFieldMyCustomField |
|
|
|
CostQuery::Filter.all.should_not include class_name.constantize |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
it "should provide the correct available values" do |
|
|
|
it "should provide the correct available values" do |
|
|
@ -292,7 +298,7 @@ describe CostQuery, :reporting_query_helper => true do |
|
|
|
:field_format => "list", |
|
|
|
:field_format => "list", |
|
|
|
:possible_values => ['value']) |
|
|
|
:possible_values => ['value']) |
|
|
|
clear_cache |
|
|
|
clear_cache |
|
|
|
ao = CostQuery::Filter::CustomFieldDatabase.available_operators.map(&:name) |
|
|
|
ao = class_name_for('Database').constantize.available_operators.map(&:name) |
|
|
|
CostQuery::Operator.null_operators.each do |o| |
|
|
|
CostQuery::Operator.null_operators.each do |o| |
|
|
|
ao.should include o.name |
|
|
|
ao.should include o.name |
|
|
|
end |
|
|
|
end |
|
|
@ -303,25 +309,27 @@ describe CostQuery, :reporting_query_helper => true do |
|
|
|
:field_format => "list", |
|
|
|
:field_format => "list", |
|
|
|
:possible_values => ['value']) |
|
|
|
:possible_values => ['value']) |
|
|
|
update_issue_custom_field("Database", :field_format => "string") |
|
|
|
update_issue_custom_field("Database", :field_format => "string") |
|
|
|
ao = CostQuery::Filter::CustomFieldDatabase.available_operators.map(&:name) |
|
|
|
ao = class_name_for('Database').constantize.available_operators.map(&:name) |
|
|
|
CostQuery::Operator.string_operators.each do |o| |
|
|
|
CostQuery::Operator.string_operators.each do |o| |
|
|
|
ao.should include o.name |
|
|
|
ao.should include o.name |
|
|
|
end |
|
|
|
end |
|
|
|
update_issue_custom_field("Database", :field_format => "int") |
|
|
|
update_issue_custom_field("Database", :field_format => "int") |
|
|
|
ao = CostQuery::Filter::CustomFieldDatabase.available_operators.map(&:name) |
|
|
|
ao = class_name_for('Database').constantize.available_operators.map(&:name) |
|
|
|
CostQuery::Operator.integer_operators.each do |o| |
|
|
|
CostQuery::Operator.integer_operators.each do |o| |
|
|
|
ao.should include o.name |
|
|
|
ao.should include o.name |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
it "includes custom fields classes in CustomFieldEntries.all" do |
|
|
|
it "includes custom fields classes in CustomFieldEntries.all" do |
|
|
|
|
|
|
|
custom_field |
|
|
|
CostQuery::Filter::CustomFieldEntries.all. |
|
|
|
CostQuery::Filter::CustomFieldEntries.all. |
|
|
|
should include(CostQuery::Filter::CustomFieldMyCustomField) |
|
|
|
should include(class_name_for('My custom field').constantize) |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
it "includes custom fields classes in Filter.all" do |
|
|
|
it "includes custom fields classes in Filter.all" do |
|
|
|
|
|
|
|
custom_field |
|
|
|
CostQuery::Filter.all. |
|
|
|
CostQuery::Filter.all. |
|
|
|
should include(CostQuery::Filter::CustomFieldMyCustomField) |
|
|
|
should include(class_name_for('My custom field').constantize) |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
def create_searchable_fields_and_values |
|
|
|
def create_searchable_fields_and_values |
|
|
@ -344,13 +352,15 @@ describe CostQuery, :reporting_query_helper => true do |
|
|
|
|
|
|
|
|
|
|
|
it "is usable as filter" do |
|
|
|
it "is usable as filter" do |
|
|
|
create_searchable_fields_and_values |
|
|
|
create_searchable_fields_and_values |
|
|
|
@query.filter :custom_field_searchable_field, :operator => '=', :value => "125" |
|
|
|
id = IssueCustomField.find_by_name("Searchable Field").id |
|
|
|
|
|
|
|
@query.filter "custom_field_#{id}".to_sym, :operator => '=', :value => "125" |
|
|
|
@query.result.count.should == 2 |
|
|
|
@query.result.count.should == 2 |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
it "is usable as filter #2" do |
|
|
|
it "is usable as filter #2" do |
|
|
|
create_searchable_fields_and_values |
|
|
|
create_searchable_fields_and_values |
|
|
|
@query.filter :custom_field_searchable_field, :operator => '=', :value => "finnlabs" |
|
|
|
id = IssueCustomField.find_by_name("Searchable Field").id |
|
|
|
|
|
|
|
@query.filter "custom_field_#{id}".to_sym, :operator => '=', :value => "finnlabs" |
|
|
|
@query.result.count.should == 0 |
|
|
|
@query.result.count.should == 0 |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|