avoids actually settings settings in specs by stubbing

Setting specs might influence other specs where that setting will also apply
pull/1454/head
Jens Ulferts 11 years ago
parent 656196ed1e
commit 185547f4f2
  1. 5
      spec/controllers/custom_fields_controller_spec.rb
  2. 2
      spec/models/mail_handler_spec.rb
  3. 4
      spec/models/project_type_spec.rb

@ -30,6 +30,7 @@ require 'spec_helper'
describe CustomFieldsController do describe CustomFieldsController do
let(:custom_field) { FactoryGirl.build(:custom_field) } let(:custom_field) { FactoryGirl.build(:custom_field) }
let(:available_languages) { ["de", "en"] }
before do before do
allow(@controller).to receive(:authorize) allow(@controller).to receive(:authorize)
@ -39,7 +40,7 @@ describe CustomFieldsController do
describe "POST edit" do describe "POST edit" do
before do before do
Setting.available_languages = ["de", "en"] allow(Setting).to receive(:available_languages).and_return(available_languages)
allow(CustomField).to receive(:find).and_return(custom_field) allow(CustomField).to receive(:find).and_return(custom_field)
end end
@ -77,7 +78,7 @@ describe CustomFieldsController do
describe "POST new" do describe "POST new" do
before do before do
Setting.available_languages = ["de", "en"] allow(Setting).to receive(:available_languages).and_return(available_languages)
end end
describe "WITH empty name param" do describe "WITH empty name param" do

@ -280,7 +280,7 @@ describe MailHandler do
it "should add a work_package by create user on public project" do it "should add a work_package by create user on public project" do
ActionMailer::Base.deliveries.clear ActionMailer::Base.deliveries.clear
Setting.default_language = 'en' allow(Setting).to receive(:default_language).and_return('en')
Role.non_member.update_attribute :permissions, [:add_work_packages] Role.non_member.update_attribute :permissions, [:add_work_packages]
project.update_attribute :is_public, true project.update_attribute :is_public, true
expect { expect {

@ -76,10 +76,6 @@ describe ProjectType do
end end
describe '- Validations ' do describe '- Validations ' do
before do
ApplicationHelper.set_language_if_valid 'en'
end
let(:attributes) { let(:attributes) {
{:name => 'Project Type No. 1', {:name => 'Project Type No. 1',
:allows_association => true} :allows_association => true}

Loading…
Cancel
Save