From 2fe6cac3dbc5fcf529dab4a95db5e183de0f0bf5 Mon Sep 17 00:00:00 2001 From: Sebastian Schuster Date: Fri, 14 Jun 2013 15:46:14 +0200 Subject: [PATCH] Rewrote spec to really create custom field filter classes before each example instead of 2 cukes implicitely relying on not running first --- spec/models/cost_query/filter_spec.rb | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/spec/models/cost_query/filter_spec.rb b/spec/models/cost_query/filter_spec.rb index d3deff5a80..576b3bce8b 100644 --- a/spec/models/cost_query/filter_spec.rb +++ b/spec/models/cost_query/filter_spec.rb @@ -249,14 +249,14 @@ describe CostQuery, :reporting_query_helper => true do end describe CostQuery::Filter::CustomFieldEntries do - let!(:custom_field) { FactoryGirl.create(:issue_custom_field, - :name => 'My custom field') } - - before do - CostQuery::Filter.all.merge CostQuery::Filter::CustomFieldEntries.all + let!(:custom_field) do + cf = FactoryGirl.create(:issue_custom_field, + :name => 'My custom field') + clear_cache + cf end - after do + after(:all) do clear_cache end @@ -279,16 +279,12 @@ describe CostQuery, :reporting_query_helper => true do it "should create classes for custom fields that get added after starting the server" do clear_cache - # Would raise a name error if class wasn't created - CostQuery::Filter::CustomFieldMyCustomField + expect { CostQuery::Filter::CustomFieldMyCustomField }.to_not raise_error end it "should remove the custom field classes after it is deleted" do - FactoryGirl.create(:issue_custom_field, :name => "AFreshCustomField") - clear_cache - CostQuery::Filter.all.should include CostQuery::Filter::CustomFieldAfreshcustomfield - delete_issue_custom_field("AFreshCustomField") - CostQuery::Filter.all.should_not include CostQuery::Filter::CustomFieldAfreshcustomfield + delete_issue_custom_field("My custom field") + CostQuery::Filter.all.should_not include CostQuery::Filter::CustomFieldMyCustomField end it "should provide the correct available values" do