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
let(:custom_field) { FactoryGirl.build(:custom_field) }
let(:available_languages) { ["de", "en"] }
before do
allow(@controller).to receive(:authorize)
@ -39,7 +40,7 @@ describe CustomFieldsController do
describe "POST edit" 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)
end
@ -77,7 +78,7 @@ describe CustomFieldsController do
describe "POST new" do
before do
Setting.available_languages = ["de", "en"]
allow(Setting).to receive(:available_languages).and_return(available_languages)
end
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
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]
project.update_attribute :is_public, true
expect {

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

Loading…
Cancel
Save