Reload the cache in specs

pull/6827/head
Tim Felgentreff 14 years ago
parent f9207d43d7
commit d715b13710
  1. 31
      spec/models/cost_query/filter_spec.rb
  2. 15
      spec/models/cost_query/group_by_spec.rb

@ -237,6 +237,11 @@ describe CostQuery do
CostQuery::Filter.all.merge CostQuery::Filter::CustomFieldEntries.all
end
def check_cache
CostReportsController.new.check_cache
CostQuery::Filter::CustomFieldEntries.all
end
def create_issue_custom_field(name)
IssueCustomField.create(:name => name,
:min_length => 1,
@ -249,7 +254,19 @@ describe CostQuery do
:searchable => true,
:default_value => "Default string",
:editable => true)
CostReportsController.new.check_cache
check_cache
end
def delete_issue_custom_field(name)
IssueCustomField.find_by_name(name).destroy
check_cache
end
def update_issue_custom_field(name, options)
fld = IssueCustomField.find_by_name(name)
options.each_pair {|k, v| fld.send(:"#{k}=", v) }
fld.save!
check_cache
end
it "should create classes for custom fields" do
@ -266,8 +283,7 @@ describe CostQuery do
it "should remove the custom field classes after it is deleted" do
create_issue_custom_field("AFreshCustomField")
IssueCustomField.find_by_name("AFreshCustomField").destroy
CostReportsController.new.check_cache
delete_issue_custom_field("AFreshCustomField")
lambda { CostQuery::Filter::CustomFieldAfreshcustomfield }.
should raise_error(NameError)
end
@ -278,15 +294,10 @@ describe CostQuery do
end
it "should update the available values on change" do
fld = IssueCustomField.find_by_name("Database")
fld.field_format = "string"
fld.save!
CostReportsController.new.check_cache
update_issue_custom_field("Database", :field_format => "string")
CostQuery::Filter::CustomFieldDatabase.available_operators.
should include CostQuery::Operator.string_operators
fld.field_format = "list"
fld.save!
CostReportsController.new.check_cache
update_issue_custom_field("Database", :field_format => "list")
CostQuery::Filter::CustomFieldDatabase.available_operators.
should include CostQuery::Operator.null_operators
end

@ -208,6 +208,11 @@ describe CostQuery do
CostQuery::GroupBy.all.merge CostQuery::GroupBy::CustomFieldEntries.all
end
def check_cache
CostReportsController.new.check_cache
CostQuery::GroupBy::CustomFieldEntries.all
end
def create_issue_custom_field(name)
IssueCustomField.create(:name => name,
:min_length => 1,
@ -220,7 +225,12 @@ describe CostQuery do
:searchable => true,
:default_value => "Default string",
:editable => true)
CostReportsController.new.check_cache
check_cache
end
def delete_issue_custom_field(name)
IssueCustomField.find_by_name(name).destroy
check_cache
end
it "should create classes for custom fields" do
@ -237,8 +247,7 @@ describe CostQuery do
it "should remove the custom field classes after it is deleted" do
create_issue_custom_field("AFreshCustomField")
IssueCustomField.find_by_name("AFreshCustomField").destroy
CostReportsController.new.check_cache
delete_issue_custom_field("AFreshCustomField")
lambda { CostQuery::GroupBy::CustomFieldAfreshcustomfield }.
should raise_error(NameError)
end

Loading…
Cancel
Save