Avoid defining same constants in multiple specs

pull/3606/head
Mohamed Wael Khobalatte 9 years ago
parent 8015984218
commit 03cce5e25d
  1. 4
      spec/lib/custom_field_form_builder_spec.rb
  2. 4
      spec/lib/journal_formatter/attachment_spec.rb
  3. 4
      spec/lib/journal_formatter/custom_field_spec.rb
  4. 4
      spec/lib/journal_formatter/diff_spec.rb
  5. 4
      spec/lib/tabular_form_builder_spec.rb
  6. 6
      spec/requests/api/v3/authentication_spec.rb

@ -29,12 +29,10 @@
require 'spec_helper'
require 'ostruct'
TestViewHelper = Class.new(ActionView::Base)
describe CustomFieldFormBuilder do
include Capybara::RSpecMatchers
let(:helper) { TestViewHelper.new }
let(:helper) { ActionView::Base.new }
let(:resource) {
FactoryGirl.build(:user,
firstname: 'JJ',

@ -40,13 +40,11 @@ describe OpenProject::JournalFormatter::Attachment do
{ only_path: true }
end
Struct.new('TestJournal', :id)
let(:klass) { OpenProject::JournalFormatter::Attachment }
let(:instance) { klass.new(journal) }
let(:id) { 1 }
let(:journal) do
Struct::TestJournal.new(id)
OpenStruct.new(id: id)
end
let(:user) { FactoryGirl.create(:user) }
let(:attachment) {

@ -32,13 +32,11 @@ describe OpenProject::JournalFormatter::CustomField do
include CustomFieldsHelper
include ActionView::Helpers::TagHelper
Struct.new('TestJournal', :id)
let(:klass) { OpenProject::JournalFormatter::CustomField }
let(:instance) { klass.new(journal) }
let(:id) { 1 }
let(:journal) do
Struct::TestJournal.new(id)
OpenStruct.new(id: id)
end
let(:user) { FactoryGirl.create(:user) }
let(:custom_field) { FactoryGirl.create(:issue_custom_field) }

@ -38,12 +38,10 @@ describe OpenProject::JournalFormatter::Diff do
Rails.application.routes.url_helpers
end
Struct.new('TestJournal', :id, :journable)
let(:klass) { OpenProject::JournalFormatter::Diff }
let(:id) { 1 }
let(:journal) do
Struct::TestJournal.new(id, WorkPackage.new)
OpenStruct.new(id: id, journable: WorkPackage.new)
end
let(:instance) { klass.new(journal) }
let(:key) { 'description' }

@ -29,12 +29,10 @@
require 'spec_helper'
require 'ostruct'
TestViewHelper = Class.new(ActionView::Base)
describe TabularFormBuilder do
include Capybara::RSpecMatchers
let(:helper) { TestViewHelper.new }
let(:helper) { ActionView::Base.new }
let(:resource) {
FactoryGirl.build(:user,
firstname: 'JJ',

@ -44,7 +44,7 @@ describe API::V3, type: :request do
let(:expected_message) { 'You need to be authenticated to access this resource.' }
Strategies = OpenProject::Authentication::Strategies::Warden
strategies = OpenProject::Authentication::Strategies::Warden
def basic_auth(user, password)
credentials = ActionController::HttpAuthentication::Basic.encode_credentials user, password
@ -148,7 +148,7 @@ describe API::V3, type: :request do
let(:password) { 'toor' }
before do
Strategies::GlobalBasicAuth.configure! user: 'root', password: 'toor'
strategies::GlobalBasicAuth.configure! user: 'root', password: 'toor'
end
it_behaves_like 'it is basic auth protected'
@ -190,7 +190,7 @@ describe API::V3, type: :request do
before do
config = { user: 'global_account', password: 'global_password' }
Strategies::GlobalBasicAuth.configure! config
strategies::GlobalBasicAuth.configure! config
end
context 'without credentials' do

Loading…
Cancel
Save