diff --git a/Gemfile b/Gemfile index ae7d281..3612653 100644 --- a/Gemfile +++ b/Gemfile @@ -36,6 +36,10 @@ gem 'friendly_id' # ------------------------------------------------ +# BIT FIELDS +gem 'flag_shih_tzu' + +# ------------------------------------------------ # SUPER ADMIN SECTION gem 'activeadmin', github: 'activeadmin' diff --git a/Gemfile.lock b/Gemfile.lock index 855f159..eb07170 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -138,6 +138,7 @@ faraday_middleware (~> 0.9) loofah (~> 2.0) sax-machine (~> 1.0) + flag_shih_tzu (0.3.15) formtastic (3.1.4) actionpack (>= 3.2.13) formtastic_i18n (0.6.0) @@ -368,6 +369,7 @@ devise_invitable dragonfly feedjira + flag_shih_tzu friendly_id htmltoword i18n-js (>= 3.0.0.rc11) diff --git a/app/models/project.rb b/app/models/project.rb index 06e51ec..81dff56 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -1,19 +1,23 @@ class Project < ActiveRecord::Base include GlobalHelpers - + include FlagShihTzu + extend FriendlyId #associations between tables belongs_to :dmptemplate belongs_to :organisation - - belongs_to :visibility has_many :plans has_many :project_groups, :dependent => :destroy has_and_belongs_to_many :guidance_groups, join_table: "project_guidance" friendly_id :title, use: [:slugged, :history, :finders] + + has_flags 1 => :organisational_visibility, + 2 => :public_visibility, + 3 => :private_visibility, + column: 'visibility' ## # returns the title of the project diff --git a/app/models/visibility.rb b/app/models/visibility.rb deleted file mode 100644 index 26f7270..0000000 --- a/app/models/visibility.rb +++ /dev/null @@ -1,5 +0,0 @@ -class Visibility < ActiveRecord::Base - has_many :projects - - validates :name, uniqueness: true, presence: true -end \ No newline at end of file diff --git a/db/migrate/20170105165111_create_visibilities.rb b/db/migrate/20170105165111_create_visibilities.rb deleted file mode 100644 index 5e72ee1..0000000 --- a/db/migrate/20170105165111_create_visibilities.rb +++ /dev/null @@ -1,11 +0,0 @@ -class CreateVisibilities < ActiveRecord::Migration - def change - create_table :visibilities do |t| - t.string :name - t.boolean :default, default: false - t.timestamps - end - - add_reference :projects, :visibility, foreign_key: true - end -end diff --git a/db/migrate/20170110092511_add_is_test_and_visibility_to_projects.rb b/db/migrate/20170110092511_add_is_test_and_visibility_to_projects.rb new file mode 100644 index 0000000..7621f8f --- /dev/null +++ b/db/migrate/20170110092511_add_is_test_and_visibility_to_projects.rb @@ -0,0 +1,6 @@ +class AddIsTestAndVisibilityToProjects < ActiveRecord::Migration + def change + add_column :projects, :is_test, :boolean, default: false + add_column :projects, :visibility, :integer, default: 0 + end +end diff --git a/db/schema.rb b/db/schema.rb index 218a45e..ee4bbff 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20170105165111) do +ActiveRecord::Schema.define(version: 20170110092511) do create_table "answers", force: :cascade do |t| t.text "text" @@ -251,7 +251,8 @@ t.string "principal_investigator_identifier" t.string "data_contact" t.string "funder_name" - t.integer "visibility_id" + t.boolean "is_test", default: false + t.integer "visibility", default: 0 end add_index "projects", ["slug"], name: "index_projects_on_slug", unique: true @@ -454,11 +455,4 @@ add_index "versions", ["phase_id"], name: "index_versions_on_phase_id" - create_table "visibilities", force: :cascade do |t| - t.string "name" - t.boolean "default", default: false - t.datetime "created_at" - t.datetime "updated_at" - end - end diff --git a/db/seeds.rb b/db/seeds.rb index d8d159f..6bbc31e 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -6,14 +6,6 @@ d1 = DateTime.new(2015, 6, 22) -visibilities = { - test: {name: 'test', default: false}, - private: {name: 'private', default: false}, - organisational: {name: 'organisational', default: true}, - public: {name: 'public', default: false} -} -visibilities.map{ |v| Visibility.create!(v) } - languages = { 'English(UK)' => { abbreviation: 'en-UK', @@ -112,8 +104,8 @@ if IdentifierScheme.where(name: details[:name]).empty? scheme = IdentifierScheme.new({ name: details[:name], - auth_uri: details[:auth_uri], - user_uri: details[:user_uri] + description: details[:description], + active: details[:active] }) scheme.save! end diff --git a/test/fixtures/projects.yml b/test/fixtures/projects.yml index 09b7f37..2f21031 100644 --- a/test/fixtures/projects.yml +++ b/test/fixtures/projects.yml @@ -5,4 +5,5 @@ title: <%= "#{lbl} Project" %> dmptemplate: <%= lbl %> organisation: complete + visibility: 1 <% end %> \ No newline at end of file diff --git a/test/fixtures/visibilities.yml b/test/fixtures/visibilities.yml deleted file mode 100644 index 55faa6e..0000000 --- a/test/fixtures/visibilities.yml +++ /dev/null @@ -1,15 +0,0 @@ -test: - name: 'test' - default: false - -private: - name: 'private' - default: false - -organisational: - name: 'organisational' - default: true - -public: - name: 'public' - default: false \ No newline at end of file diff --git a/test/functional/answers_controller_test.rb b/test/functional/answers_controller_test.rb deleted file mode 100644 index 9981abc..0000000 --- a/test/functional/answers_controller_test.rb +++ /dev/null @@ -1,51 +0,0 @@ -require 'test_helper' - -class AnswersControllerTest < ActionController::TestCase -=begin - setup do - @answer = answers(:one) - end - - test "should get index" do - get :index - assert_response :success - assert_not_nil assigns(:answers) - end - - test "should get new" do - get :new - assert_response :success - end - - test "should create answer" do - assert_difference('Answer.count') do - post :create, answer: { text: @answer.text, plan_id: @answer.plan_id, question_id: @answer.question_id, user_id: @answer.user_id } - end - - assert_redirected_to answer_path(assigns(:answer)) - end - - test "should show answer" do - get :show, id: @answer - assert_response :success - end - - test "should get edit" do - get :edit, id: @answer - assert_response :success - end - - test "should update answer" do - put :update, id: @answer, answer: { text: @answer.text, plan_id: @answer.plan_id, question_id: @answer.question_id, user_id: @answer.user_id } - assert_redirected_to answer_path(assigns(:answer)) - end - - test "should destroy answer" do - assert_difference('Answer.count', -1) do - delete :destroy, id: @answer - end - - assert_redirected_to answers_path - end -=end -end diff --git a/test/functional/dmptemplates_controller_test.rb b/test/functional/dmptemplates_controller_test.rb deleted file mode 100644 index a3a7521..0000000 --- a/test/functional/dmptemplates_controller_test.rb +++ /dev/null @@ -1,51 +0,0 @@ -require 'test_helper' - -class DmptemplatesControllerTest < ActionController::TestCase -=begin - setup do - @dmptemplate = dmptemplates(:one) - end - - test "should get index" do - get :index - assert_response :success - assert_not_nil assigns(:dmptemplates) - end - - test "should get new" do - get :new - assert_response :success - end - - test "should create dmptemplate" do - assert_difference('Dmptemplate.count') do - post :create, dmptemplate: { organisation_id: @dmptemplate.organisation_id, description: @dmptemplate.description, published: @dmptemplate.published, title: @dmptemplate.title, user_id: @dmptemplate.user_id } - end - - assert_redirected_to dmptemplate_path(assigns(:dmptemplate)) - end - - test "should show dmptemplate" do - get :show, id: @dmptemplate - assert_response :success - end - - test "should get edit" do - get :edit, id: @dmptemplate - assert_response :success - end - - test "should update dmptemplate" do - put :update, id: @dmptemplate, dmptemplate: { organisation_id: @dmptemplate.organisation_id, description: @dmptemplate.description, published: @dmptemplate.published, title: @dmptemplate.title, user_id: @dmptemplate.user_id } - assert_redirected_to dmptemplate_path(assigns(:dmptemplate)) - end - - test "should destroy dmptemplate" do - assert_difference('Dmptemplate.count', -1) do - delete :destroy, id: @dmptemplate - end - - assert_redirected_to dmptemplates_path - end -=end -end diff --git a/test/functional/file_types_controller_test.rb b/test/functional/file_types_controller_test.rb deleted file mode 100644 index 168c370..0000000 --- a/test/functional/file_types_controller_test.rb +++ /dev/null @@ -1,51 +0,0 @@ -require 'test_helper' - -class FileTypesControllerTest < ActionController::TestCase -=begin - setup do - @file_type = file_types(:one) - end - - test "should get index" do - get :index - assert_response :success - assert_not_nil assigns(:file_types) - end - - test "should get new" do - get :new - assert_response :success - end - - test "should create file_type" do - assert_difference('FileType.count') do - post :create, file_type: { name: @file_type.name, icon_location: @file_type.icon_location, icon_name: @file_type.icon_name, icon_size: @file_type.icon_size } - end - - assert_redirected_to file_type_path(assigns(:file_type)) - end - - test "should show file_type" do - get :show, id: @file_type - assert_response :success - end - - test "should get edit" do - get :edit, id: @file_type - assert_response :success - end - - test "should update file_type" do - put :update, id: @file_type, file_type: { name: @file_type.name, icon_location: @file_type.icon_location, icon_name: @file_type.icon_name, icon_size: @file_type.icon_size } - assert_redirected_to file_type_path(assigns(:file_type)) - end - - test "should destroy file_type" do - assert_difference('FileType.count', -1) do - delete :destroy, id: @file_type - end - - assert_redirected_to file_types_path - end -=end -end diff --git a/test/functional/file_uploads_controller_test.rb b/test/functional/file_uploads_controller_test.rb deleted file mode 100644 index 41a1a64..0000000 --- a/test/functional/file_uploads_controller_test.rb +++ /dev/null @@ -1,51 +0,0 @@ -require 'test_helper' - -class FileUploadsControllerTest < ActionController::TestCase -=begin - setup do - @file_upload = file_uploads(:one) - end - - test "should get index" do - get :index - assert_response :success - assert_not_nil assigns(:file_uploads) - end - - test "should get new" do - get :new - assert_response :success - end - - test "should create file_upload" do - assert_difference('FileUpload.count') do - post :create, file_upload: { file_type_id: @file_upload.file_type_id, description: @file_upload.description, location: @file_upload.location, name: @file_upload.name, published: @file_upload.published, size: @file_upload.size, title: @file_upload.title } - end - - assert_redirected_to file_upload_path(assigns(:file_upload)) - end - - test "should show file_upload" do - get :show, id: @file_upload - assert_response :success - end - - test "should get edit" do - get :edit, id: @file_upload - assert_response :success - end - - test "should update file_upload" do - put :update, id: @file_upload, file_upload: { file_type_id: @file_upload.file_type_id, description: @file_upload.description, location: @file_upload.location, name: @file_upload.name, published: @file_upload.published, size: @file_upload.size, title: @file_upload.title } - assert_redirected_to file_upload_path(assigns(:file_upload)) - end - - test "should destroy file_upload" do - assert_difference('FileUpload.count', -1) do - delete :destroy, id: @file_upload - end - - assert_redirected_to file_uploads_path - end -=end -end diff --git a/test/functional/guidances_controller_test.rb b/test/functional/guidances_controller_test.rb deleted file mode 100644 index 2dc60d1..0000000 --- a/test/functional/guidances_controller_test.rb +++ /dev/null @@ -1,51 +0,0 @@ -require 'test_helper' - -class GuidancesControllerTest < ActionController::TestCase -=begin - setup do - @guidance = guidances(:one) - end - - test "should get index" do - get :index - assert_response :success - assert_not_nil assigns(:guidances) - end - - test "should get new" do - get :new - assert_response :success - end - - test "should create guidance" do - assert_difference('Guidance.count') do - post :create, guidance: { file_id: @guidance.file_id, text: @guidance.text, organisation_id: @guidance.organisation_id, theme_id: @guidance.theme_id } - end - - assert_redirected_to guidance_path(assigns(:guidance)) - end - - test "should show guidance" do - get :show, id: @guidance - assert_response :success - end - - test "should get edit" do - get :edit, id: @guidance - assert_response :success - end - - test "should update guidance" do - put :update, id: @guidance, guidance: { file_id: @guidance.file_id, text: @guidance.text, organisation_id: @guidance.organisation_id, theme_id: @guidance.theme_id } - assert_redirected_to guidance_path(assigns(:guidance)) - end - - test "should destroy guidance" do - assert_difference('Guidance.count', -1) do - delete :destroy, id: @guidance - end - - assert_redirected_to guidances_path - end -=end -end diff --git a/test/functional/home_controller_test.rb b/test/functional/home_controller_test.rb deleted file mode 100644 index d088a29..0000000 --- a/test/functional/home_controller_test.rb +++ /dev/null @@ -1,10 +0,0 @@ -require 'test_helper' - -class HomeControllerTest < ActionController::TestCase -=begin - test "should get index" do - get :index - assert_response :success - end -=end -end diff --git a/test/functional/organisation_types_controller_test.rb b/test/functional/organisation_types_controller_test.rb deleted file mode 100644 index 380dd88..0000000 --- a/test/functional/organisation_types_controller_test.rb +++ /dev/null @@ -1,51 +0,0 @@ -require 'test_helper' - -class OrganisationTypesControllerTest < ActionController::TestCase -=begin - setup do - @organisation_type = organisation_types(:one) - end - - test "should get index" do - get :index - assert_response :success - assert_not_nil assigns(:organisation_types) - end - - test "should get new" do - get :new - assert_response :success - end - - test "should create organisation_type" do - assert_difference('OrganisationType.count') do - post :create, organisation_type: { description: @organisation_type.description, name: @organisation_type.name } - end - - assert_redirected_to organisation_type_path(assigns(:organisation_type)) - end - - test "should show organisation_type" do - get :show, id: @organisation_type - assert_response :success - end - - test "should get edit" do - get :edit, id: @organisation_type - assert_response :success - end - - test "should update organisation_type" do - put :update, id: @organisation_type, organisation_type: { description: @organisation_type.description, name: @organisation_type.name } - assert_redirected_to organisation_type_path(assigns(:organisation_type)) - end - - test "should destroy organisation_type" do - assert_difference('OrganisationType.count', -1) do - delete :destroy, id: @organisation_type - end - - assert_redirected_to organisation_types_path - end -=end -end diff --git a/test/functional/organisations_controller_test.rb b/test/functional/organisations_controller_test.rb deleted file mode 100644 index c43d4f4..0000000 --- a/test/functional/organisations_controller_test.rb +++ /dev/null @@ -1,51 +0,0 @@ -require 'test_helper' - -class OrganisationsControllerTest < ActionController::TestCase -=begin - setup do - @organisation = organisations(:one) - end - - test "should get index" do - get :index - assert_response :success - assert_not_nil assigns(:organisations) - end - - test "should get new" do - get :new - assert_response :success - end - - test "should create organisation" do - assert_difference('Organisation.count') do - post :create, organisation: { abbreviation: @organisation.abbreviation, banner_file_id: @organisation.banner_file_id, description: @organisation.description, domain: @organisation.domain, logo_file_id: @organisation.logo_file_id, name: @organisation.name, stylesheet_file_id: @organisation.stylesheet_file_id, target_url: @organisation.target_url, type_id: @organisation.type_id, wayfless_entite: @organisation.wayfless_entite } - end - - assert_redirected_to organisation_path(assigns(:organisation)) - end - - test "should show organisation" do - get :show, id: @organisation - assert_response :success - end - - test "should get edit" do - get :edit, id: @organisation - assert_response :success - end - - test "should update organisation" do - put :update, id: @organisation, organisation: { abbreviation: @organisation.abbreviation, banner_file_id: @organisation.banner_file_id, description: @organisation.description, domain: @organisation.domain, logo_file_id: @organisation.logo_file_id, name: @organisation.name, stylesheet_file_id: @organisation.stylesheet_file_id, target_url: @organisation.target_url, type_id: @organisation.type_id, wayfless_entite: @organisation.wayfless_entite } - assert_redirected_to organisation_path(assigns(:organisation)) - end - - test "should destroy organisation" do - assert_difference('Organisation.count', -1) do - delete :destroy, id: @organisation - end - - assert_redirected_to organisations_path - end -=end -end diff --git a/test/functional/pages_controller_test.rb b/test/functional/pages_controller_test.rb deleted file mode 100644 index b525098..0000000 --- a/test/functional/pages_controller_test.rb +++ /dev/null @@ -1,51 +0,0 @@ -require 'test_helper' - -class PagesControllerTest < ActionController::TestCase -=begin - setup do - @page = pages(:one) - end - - test "should get index" do - get :index - assert_response :success - assert_not_nil assigns(:pages) - end - - test "should get new" do - get :new - assert_response :success - end - - test "should create page" do - assert_difference('Page.count') do - post :create, page: { organisation_id: @page.organisation_id, body_text: @page.body_text, location: @page.location, menu: @page.menu, menu_position: @page.menu_position, public: @page.public, slug: @page.slug, target_url: @page.target_url, title: @page.title } - end - - assert_redirected_to page_path(assigns(:page)) - end - - test "should show page" do - get :show, id: @page - assert_response :success - end - - test "should get edit" do - get :edit, id: @page - assert_response :success - end - - test "should update page" do - put :update, id: @page, page: { organisation_id: @page.organisation_id, body_text: @page.body_text, location: @page.location, menu: @page.menu, menu_position: @page.menu_position, public: @page.public, slug: @page.slug, target_url: @page.target_url, title: @page.title } - assert_redirected_to page_path(assigns(:page)) - end - - test "should destroy page" do - assert_difference('Page.count', -1) do - delete :destroy, id: @page - end - - assert_redirected_to pages_path - end -=end -end diff --git a/test/functional/phases_controller_test.rb b/test/functional/phases_controller_test.rb deleted file mode 100644 index b392886..0000000 --- a/test/functional/phases_controller_test.rb +++ /dev/null @@ -1,51 +0,0 @@ -require 'test_helper' - -class PhasesControllerTest < ActionController::TestCase -=begin - setup do - @phase = phases(:one) - end - - test "should get index" do - get :index - assert_response :success - assert_not_nil assigns(:phases) - end - - test "should get new" do - get :new - assert_response :success - end - - test "should create phase" do - assert_difference('Phase.count') do - post :create, phase: { description: @phase.description, order: @phase.order, title: @phase.title } - end - - assert_redirected_to phase_path(assigns(:phase)) - end - - test "should show phase" do - get :show, id: @phase - assert_response :success - end - - test "should get edit" do - get :edit, id: @phase - assert_response :success - end - - test "should update phase" do - put :update, id: @phase, phase: { description: @phase.description, order: @phase.order, title: @phase.title } - assert_redirected_to phase_path(assigns(:phase)) - end - - test "should destroy phase" do - assert_difference('Phase.count', -1) do - delete :destroy, id: @phase - end - - assert_redirected_to phases_path - end -=end -end diff --git a/test/functional/plan_sections_controller_test.rb b/test/functional/plan_sections_controller_test.rb deleted file mode 100644 index 97bbe62..0000000 --- a/test/functional/plan_sections_controller_test.rb +++ /dev/null @@ -1,51 +0,0 @@ -require 'test_helper' - -class PlanSectionsControllerTest < ActionController::TestCase -=begin - setup do - @plan_section = plan_sections(:one) - end - - test "should get index" do - get :index - assert_response :success - assert_not_nil assigns(:plan_sections) - end - - test "should get new" do - get :new - assert_response :success - end - - test "should create plan_section" do - assert_difference('PlanSection.count') do - post :create, plan_section: { plan_id: @plan_section.plan_id, at: @plan_section.at, edit: @plan_section.edit, section_id: @plan_section.section_id, user_editing_id: @plan_section.user_editing_id } - end - - assert_redirected_to plan_section_path(assigns(:plan_section)) - end - - test "should show plan_section" do - get :show, id: @plan_section - assert_response :success - end - - test "should get edit" do - get :edit, id: @plan_section - assert_response :success - end - - test "should update plan_section" do - put :update, id: @plan_section, plan_section: { plan_id: @plan_section.plan_id, at: @plan_section.at, edit: @plan_section.edit, section_id: @plan_section.section_id, user_editing_id: @plan_section.user_editing_id } - assert_redirected_to plan_section_path(assigns(:plan_section)) - end - - test "should destroy plan_section" do - assert_difference('PlanSection.count', -1) do - delete :destroy, id: @plan_section - end - - assert_redirected_to plan_sections_path - end -=end -end diff --git a/test/functional/plans_controller_test.rb b/test/functional/plans_controller_test.rb deleted file mode 100644 index 58e763f..0000000 --- a/test/functional/plans_controller_test.rb +++ /dev/null @@ -1,47 +0,0 @@ -require 'test_helper' - -class PlansControllerTest < ActionController::TestCase -=begin - test "should get index" do - get :index - assert_response :success - assert_not_nil assigns(:plans) - end - - test "should get new" do - get :new - assert_response :success - end - - test "should create plan" do - assert_difference('Plan.count') do - post :create, plan: { locked: @plan.locked, project_id: @plan.project_id, version_id: @plan.version_id } - end - - assert_redirected_to plan_path(assigns(:plan)) - end - - test "should show plan" do - get :show, id: @plan - assert_response :success - end - - test "should get edit" do - get :edit, id: @plan - assert_response :success - end - - test "should update plan" do - put :update, id: @plan, plan: { locked: @plan.locked, project_id: @plan.project_id, version_id: @plan.version_id } - assert_redirected_to plan_path(assigns(:plan)) - end - - test "should destroy plan" do - assert_difference('Plan.count', -1) do - delete :destroy, id: @plan - end - - assert_redirected_to plans_path - end -=end -end diff --git a/test/functional/project_groups_controller_test.rb b/test/functional/project_groups_controller_test.rb deleted file mode 100644 index 0e129f1..0000000 --- a/test/functional/project_groups_controller_test.rb +++ /dev/null @@ -1,51 +0,0 @@ -require 'test_helper' - -class ProjectGroupsControllerTest < ActionController::TestCase -=begin - setup do - @project_group = project_groups(:one) - end - - test "should get index" do - get :index - assert_response :success - assert_not_nil assigns(:project_groups) - end - - test "should get new" do - get :new - assert_response :success - end - - test "should create project_group" do - assert_difference('ProjectGroup.count') do - post :create, project_group: { project_creator: @project_group.project_creator, project_editor: @project_group.project_editor, project_id: @project_group.project_id, user_id: @project_group.user_id } - end - - assert_redirected_to project_group_path(assigns(:project_group)) - end - - test "should show project_group" do - get :show, id: @project_group - assert_response :success - end - - test "should get edit" do - get :edit, id: @project_group - assert_response :success - end - - test "should update project_group" do - put :update, id: @project_group, project_group: { project_creator: @project_group.project_creator, project_editor: @project_group.project_editor, project_id: @project_group.project_id, user_id: @project_group.user_id } - assert_redirected_to project_group_path(assigns(:project_group)) - end - - test "should destroy project_group" do - assert_difference('ProjectGroup.count', -1) do - delete :destroy, id: @project_group - end - - assert_redirected_to project_groups_path - end -=end -end diff --git a/test/functional/project_partners_controller_test.rb b/test/functional/project_partners_controller_test.rb deleted file mode 100644 index c975fb2..0000000 --- a/test/functional/project_partners_controller_test.rb +++ /dev/null @@ -1,51 +0,0 @@ -require 'test_helper' - -class ProjectPartnersControllerTest < ActionController::TestCase -=begin - setup do - @project_partner = project_partners(:one) - end - - test "should get index" do - get :index - assert_response :success - assert_not_nil assigns(:project_partners) - end - - test "should get new" do - get :new - assert_response :success - end - - test "should create project_partner" do - assert_difference('ProjectPartner.count') do - post :create, project_partner: { leader_org: @project_partner.leader_org, organisation_id: @project_partner.organisation_id, project_id: @project_partner.project_id } - end - - assert_redirected_to project_partner_path(assigns(:project_partner)) - end - - test "should show project_partner" do - get :show, id: @project_partner - assert_response :success - end - - test "should get edit" do - get :edit, id: @project_partner - assert_response :success - end - - test "should update project_partner" do - put :update, id: @project_partner, project_partner: { leader_org: @project_partner.leader_org, organisation_id: @project_partner.organisation_id, project_id: @project_partner.project_id } - assert_redirected_to project_partner_path(assigns(:project_partner)) - end - - test "should destroy project_partner" do - assert_difference('ProjectPartner.count', -1) do - delete :destroy, id: @project_partner - end - - assert_redirected_to project_partners_path - end -=end -end diff --git a/test/functional/projects_controller_test.rb b/test/functional/projects_controller_test.rb deleted file mode 100644 index 260bdb7..0000000 --- a/test/functional/projects_controller_test.rb +++ /dev/null @@ -1,48 +0,0 @@ -require 'test_helper' - -class ProjectsControllerTest < ActionDispatch::IntegrationTest -=begin - - test "should get index" do - get :index - assert_response :success - assert_not_nil assigns(:projects) - end - - test "should get new" do - get :new - assert_response :success - end - - test "should create project" do - assert_difference('Project.count') do - post :create, project: { dmptemplate_id: @project.dmptemplate_id, locked: @project.locked, note: @project.note, title: @project.title } - end - - assert_redirected_to project_path(assigns(:project)) - end - - test "should show project" do - get :show, id: @project - assert_response :success - end - - test "should get edit" do - get :edit, id: @project - assert_response :success - end - - test "should update project" do - put :update, id: @project, project: { dmptemplate_id: @project.dmptemplate_id, locked: @project.locked, note: @project.note, title: @project.title } - assert_redirected_to project_path(assigns(:project)) - end - - test "should destroy project" do - assert_difference('Project.count', -1) do - delete :destroy, id: @project - end - - assert_redirected_to projects_path - end -=end -end diff --git a/test/functional/question_themes_controller_test.rb b/test/functional/question_themes_controller_test.rb deleted file mode 100644 index e4d015f..0000000 --- a/test/functional/question_themes_controller_test.rb +++ /dev/null @@ -1,51 +0,0 @@ -require 'test_helper' - -class QuestionThemesControllerTest < ActionController::TestCase -=begin - setup do - @question_theme = question_themes(:one) - end - - test "should get index" do - get :index - assert_response :success - assert_not_nil assigns(:question_themes) - end - - test "should get new" do - get :new - assert_response :success - end - - test "should create question_theme" do - assert_difference('QuestionTheme.count') do - post :create, question_theme: { question_id: @question_theme.question_id, theme_id: @question_theme.theme_id } - end - - assert_redirected_to question_theme_path(assigns(:question_theme)) - end - - test "should show question_theme" do - get :show, id: @question_theme - assert_response :success - end - - test "should get edit" do - get :edit, id: @question_theme - assert_response :success - end - - test "should update question_theme" do - put :update, id: @question_theme, question_theme: { question_id: @question_theme.question_id, theme_id: @question_theme.theme_id } - assert_redirected_to question_theme_path(assigns(:question_theme)) - end - - test "should destroy question_theme" do - assert_difference('QuestionTheme.count', -1) do - delete :destroy, id: @question_theme - end - - assert_redirected_to question_themes_path - end -=end -end diff --git a/test/functional/questions_controller_test.rb b/test/functional/questions_controller_test.rb deleted file mode 100644 index 6ecfde8..0000000 --- a/test/functional/questions_controller_test.rb +++ /dev/null @@ -1,51 +0,0 @@ -require 'test_helper' - -class QuestionsControllerTest < ActionController::TestCase -=begin - setup do - @question = questions(:one) - end - - test "should get index" do - get :index - assert_response :success - assert_not_nil assigns(:questions) - end - - test "should get new" do - get :new - assert_response :success - end - - test "should create question" do - assert_difference('Question.count') do - post :create, question: { default_value: @question.default_value, dependency_id: @question.dependency_id, dependency_text: @question.dependency_text, guidance: @question.guidance, order: @question.order, parent_id: @question.parent_id, suggested_answer: @question.suggested_answer, text: @question.text, type: @question.type, section_id: @question.section_id } - end - - assert_redirected_to question_path(assigns(:question)) - end - - test "should show question" do - get :show, id: @question - assert_response :success - end - - test "should get edit" do - get :edit, id: @question - assert_response :success - end - - test "should update question" do - put :update, id: @question, question: { default_value: @question.default_value, dependency_id: @question.dependency_id, dependency_text: @question.dependency_text, guidance: @question.guidance, order: @question.order, parent_id: @question.parent_id, suggested_answer: @question.suggested_answer, text: @question.text, type: @question.type, section_id: @question.section_id } - assert_redirected_to question_path(assigns(:question)) - end - - test "should destroy question" do - assert_difference('Question.count', -1) do - delete :destroy, id: @question - end - - assert_redirected_to questions_path - end -=end -end diff --git a/test/functional/sections_controller_test.rb b/test/functional/sections_controller_test.rb deleted file mode 100644 index a3847e3..0000000 --- a/test/functional/sections_controller_test.rb +++ /dev/null @@ -1,51 +0,0 @@ -require 'test_helper' - -class SectionsControllerTest < ActionController::TestCase -=begin - setup do - @section = sections(:one) - end - - test "should get index" do - get :index - assert_response :success - assert_not_nil assigns(:sections) - end - - test "should get new" do - get :new - assert_response :success - end - - test "should create section" do - assert_difference('Section.count') do - post :create, section: { organisation_id: @section.organisation_id, description: @section.description, order: @section.order, title: @section.title, version_id: @section.version_id } - end - - assert_redirected_to section_path(assigns(:section)) - end - - test "should show section" do - get :show, id: @section - assert_response :success - end - - test "should get edit" do - get :edit, id: @section - assert_response :success - end - - test "should update section" do - put :update, id: @section, section: { organisation_id: @section.organisation_id, description: @section.description, order: @section.order, title: @section.title, version_id: @section.version_id } - assert_redirected_to section_path(assigns(:section)) - end - - test "should destroy section" do - assert_difference('Section.count', -1) do - delete :destroy, id: @section - end - - assert_redirected_to sections_path - end -=end -end diff --git a/test/functional/themes_controller_test.rb b/test/functional/themes_controller_test.rb deleted file mode 100644 index 3bae2d6..0000000 --- a/test/functional/themes_controller_test.rb +++ /dev/null @@ -1,51 +0,0 @@ -require 'test_helper' - -class ThemesControllerTest < ActionController::TestCase -=begin - setup do - @theme = themes(:one) - end - - test "should get index" do - get :index - assert_response :success - assert_not_nil assigns(:themes) - end - - test "should get new" do - get :new - assert_response :success - end - - test "should create theme" do - assert_difference('Theme.count') do - post :create, theme: { description: @theme.description, title: @theme.title } - end - - assert_redirected_to theme_path(assigns(:theme)) - end - - test "should show theme" do - get :show, id: @theme - assert_response :success - end - - test "should get edit" do - get :edit, id: @theme - assert_response :success - end - - test "should update theme" do - put :update, id: @theme, theme: { description: @theme.description, title: @theme.title } - assert_redirected_to theme_path(assigns(:theme)) - end - - test "should destroy theme" do - assert_difference('Theme.count', -1) do - delete :destroy, id: @theme - end - - assert_redirected_to themes_path - end -=end -end diff --git a/test/functional/user_org_roles_controller_test.rb b/test/functional/user_org_roles_controller_test.rb deleted file mode 100644 index 8412e88..0000000 --- a/test/functional/user_org_roles_controller_test.rb +++ /dev/null @@ -1,51 +0,0 @@ -require 'test_helper' - -class UserOrgRolesControllerTest < ActionController::TestCase -=begin - setup do - @user_role = user_org_roles(:one) - end - - test "should get index" do - get :index - assert_response :success - assert_not_nil assigns(:user_org_roles) - end - - test "should get new" do - get :new - assert_response :success - end - - test "should create user_org_role" do - assert_difference('UserOrgRole.count') do - post :create, user_org_role: { organisation_id: @user_org_role.organisation_id, user_id: @user_org_role.user_id, user_role_type_id: @user_org_role.user_role_type_id } - end - - assert_redirected_to user_org_role_path(assigns(:user_org_role)) - end - - test "should show user_org_role" do - get :show, id: @user_org_role - assert_response :success - end - - test "should get edit" do - get :edit, id: @user_org_role - assert_response :success - end - - test "should update user_org_role" do - put :update, id: @user_org_role, user_org_role: { organisation_id: @user_org_role.organisation_id, user_id: @user_org_role.user_id, user_role_type_id: @user_org_role.user_role_type_id } - assert_redirected_to user_org_role_path(assigns(:user_org_role)) - end - - test "should destroy user_org_role" do - assert_difference('UserOrgRole.count', -1) do - delete :destroy, id: @user_org_role - end - - assert_redirected_to user_org_roles_path - end -=end -end diff --git a/test/functional/user_role_types_controller_test.rb b/test/functional/user_role_types_controller_test.rb deleted file mode 100644 index 5686f79..0000000 --- a/test/functional/user_role_types_controller_test.rb +++ /dev/null @@ -1,51 +0,0 @@ -require 'test_helper' - -class UserRoleTypesControllerTest < ActionController::TestCase -=begin - setup do - @user_role_type = user_role_types(:one) - end - - test "should get index" do - get :index - assert_response :success - assert_not_nil assigns(:user_role_types) - end - - test "should get new" do - get :new - assert_response :success - end - - test "should create user_role_type" do - assert_difference('UserRoleType.count') do - post :create, user_role_type: { description: @user_role_type.description, name: @user_role_type.name } - end - - assert_redirected_to user_role_type_path(assigns(:user_role_type)) - end - - test "should show user_role_type" do - get :show, id: @user_role_type - assert_response :success - end - - test "should get edit" do - get :edit, id: @user_role_type - assert_response :success - end - - test "should update user_role_type" do - put :update, id: @user_role_type, user_role_type: { description: @user_role_type.description, name: @user_role_type.name } - assert_redirected_to user_role_type_path(assigns(:user_role_type)) - end - - test "should destroy user_role_type" do - assert_difference('UserRoleType.count', -1) do - delete :destroy, id: @user_role_type - end - - assert_redirected_to user_role_types_path - end -=end -end diff --git a/test/functional/user_statuses_controller_test.rb b/test/functional/user_statuses_controller_test.rb deleted file mode 100644 index 7487419..0000000 --- a/test/functional/user_statuses_controller_test.rb +++ /dev/null @@ -1,51 +0,0 @@ -require 'test_helper' - -class UserStatusesControllerTest < ActionController::TestCase -=begin - setup do - @user_status = user_statuses(:one) - end - - test "should get index" do - get :index - assert_response :success - assert_not_nil assigns(:user_statuses) - end - - test "should get new" do - get :new - assert_response :success - end - - test "should create user_status" do - assert_difference('UserStatus.count') do - post :create, user_status: { description: @user_status.description, name: @user_status.name } - end - - assert_redirected_to user_status_path(assigns(:user_status)) - end - - test "should show user_status" do - get :show, id: @user_status - assert_response :success - end - - test "should get edit" do - get :edit, id: @user_status - assert_response :success - end - - test "should update user_status" do - put :update, id: @user_status, user_status: { description: @user_status.description, name: @user_status.name } - assert_redirected_to user_status_path(assigns(:user_status)) - end - - test "should destroy user_status" do - assert_difference('UserStatus.count', -1) do - delete :destroy, id: @user_status - end - - assert_redirected_to user_statuses_path - end -=end -end diff --git a/test/functional/user_types_controller_test.rb b/test/functional/user_types_controller_test.rb deleted file mode 100644 index 267ef27..0000000 --- a/test/functional/user_types_controller_test.rb +++ /dev/null @@ -1,51 +0,0 @@ -require 'test_helper' - -class UserTypesControllerTest < ActionController::TestCase -=begin - setup do - @user_type = user_types(:one) - end - - test "should get index" do - get :index - assert_response :success - assert_not_nil assigns(:user_types) - end - - test "should get new" do - get :new - assert_response :success - end - - test "should create user_type" do - assert_difference('UserType.count') do - post :create, user_type: { description: @user_type.description, name: @user_type.name } - end - - assert_redirected_to user_type_path(assigns(:user_type)) - end - - test "should show user_type" do - get :show, id: @user_type - assert_response :success - end - - test "should get edit" do - get :edit, id: @user_type - assert_response :success - end - - test "should update user_type" do - put :update, id: @user_type, user_type: { description: @user_type.description, name: @user_type.name } - assert_redirected_to user_type_path(assigns(:user_type)) - end - - test "should destroy user_type" do - assert_difference('UserType.count', -1) do - delete :destroy, id: @user_type - end - - assert_redirected_to user_types_path - end -=end -end diff --git a/test/functional/versions_controller_test.rb b/test/functional/versions_controller_test.rb deleted file mode 100644 index a3c4be7..0000000 --- a/test/functional/versions_controller_test.rb +++ /dev/null @@ -1,51 +0,0 @@ -require 'test_helper' - -class VersionsControllerTest < ActionController::TestCase -=begin - setup do - @version = versions(:one) - end - - test "should get index" do - get :index - assert_response :success - assert_not_nil assigns(:versions) - end - - test "should get new" do - get :new - assert_response :success - end - - test "should create version" do - assert_difference('Version.count') do - post :create, version: { description: @version.description, order: @version.order, published: @version.published, title: @version.title } - end - - assert_redirected_to version_path(assigns(:version)) - end - - test "should show version" do - get :show, id: @version - assert_response :success - end - - test "should get edit" do - get :edit, id: @version - assert_response :success - end - - test "should update version" do - put :update, id: @version, version: { description: @version.description, order: @version.order, published: @version.published, title: @version.title } - assert_redirected_to version_path(assigns(:version)) - end - - test "should destroy version" do - assert_difference('Version.count', -1) do - delete :destroy, id: @version - end - - assert_redirected_to versions_path - end -=end -end diff --git a/test/test_helper.rb b/test/test_helper.rb index 0adb64e..11bf531 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -60,12 +60,7 @@ number: 1 })] }) - -# template.phases << Phase.new({ -# title: 'Phase 1', -# number: 1 -# }) - + template.phases.first.versions << Version.new({ title: 'Version 1', number: 1, diff --git a/test/unit/admin_user_test.rb b/test/unit/admin_user_test.rb deleted file mode 100644 index 23a3cc8..0000000 --- a/test/unit/admin_user_test.rb +++ /dev/null @@ -1,7 +0,0 @@ -require 'test_helper' - -class AdminUserTest < ActiveSupport::TestCase - # test "the truth" do - # assert true - # end -end diff --git a/test/unit/comment_test.rb b/test/unit/comment_test.rb deleted file mode 100644 index 9575e6c..0000000 --- a/test/unit/comment_test.rb +++ /dev/null @@ -1,7 +0,0 @@ -require 'test_helper' - -class CommentTest < ActiveSupport::TestCase - # test "the truth" do - # assert true - # end -end diff --git a/test/unit/guidance_test.rb b/test/unit/guidance_test.rb deleted file mode 100644 index 9091309..0000000 --- a/test/unit/guidance_test.rb +++ /dev/null @@ -1,201 +0,0 @@ -require 'test_helper' - -class GuidanceTest < ActiveSupport::TestCase - - setup do - @user_one = User.first - @user_two = User.order(surname: :desc).first - @user_three = User.last - - @org_type = OrganisationType.first - - @organisations = Organisation.all - end - - # ---------- can_view? ---------- - # ensure that the can_view? function returns true all viewable guidances - # should return true for groups owned by funders - # should return true for groups owned by DCC - # should return true for groups owned by the user's organisation - # should not return true for an organisation outwith those above - test "DCC guidances should be viewable" do -=begin - guidance_groups(:dcc_guidance_group_1).guidances.each do |guidance| - assert Guidance.can_view?(@user_one, guidance.id) - end -=end - end - - test "Funder guidances should be viewable" do -=begin - assert Guidance.can_view?(@user_one, guidances(:ahrc_funder_guidance).id) - assert Guidance.can_view?(@user_one, guidances(:bbsrc_funder_guidance).id) -=end - end - - - test "User's organisation guidances should be viewable" do -=begin - assert Guidance.can_view?(@user_one, guidances(:aru_institution_guidance).id) , "user_one cannot view aru_institution_guidance" - - assert Guidance.can_view?(@user_two, guidances(:au_institution_guidance_1).id), "user_two cannot view au_..._1" - assert Guidance.can_view?(@user_two, guidances(:au_institution_guidance_2).id), "user_two cannot view au_..._2" - - assert Guidance.can_view?(@user_three, guidances(:bu_institution_guidance_1).id), "user_three cannot view bu_..._1" - assert Guidance.can_view?(@user_three, guidances(:bu_institution_guidance_2).id), "user_three cannot view bu_..._2" -=end - end - - test "No other organisations's guidances should be viewable" do -=begin - # TOOD: add more fixtures with new types of guidances(i.e. not institution) - # and add test cases - assert_not Guidance.can_view?(@user_one, guidances(:au_institution_guidance_1).id) - assert_not Guidance.can_view?(@user_one, guidances(:au_institution_guidance_2).id) - assert_not Guidance.can_view?(@user_one, guidances(:bu_institution_guidance_1).id) - assert_not Guidance.can_view?(@user_one, guidances(:bu_institution_guidance_2).id) - - assert_not Guidance.can_view?(@user_two, guidances(:aru_institution_guidance).id) - assert_not Guidance.can_view?(@user_two, guidances(:bu_institution_guidance_1).id) - assert_not Guidance.can_view?(@user_two, guidances(:bu_institution_guidance_2).id) - - assert_not Guidance.can_view?(@user_three, guidances(:aru_institution_guidance).id) - assert_not Guidance.can_view?(@user_three, guidances(:au_institution_guidance_1).id) - assert_not Guidance.can_view?(@user_three, guidances(:au_institution_guidance_2).id) -=end - end - -# ---------- all_viewable ---------- - # ensure that the all_viewable function returns all viewable guidances - # should return true for groups owned by funders - # should return true for groups owned by DCC - # should return true for groups owned by the user's organisation - # should not return true for an organisation outwith those above - test "all_viewable returns all DCC guidances" do -=begin - all_viewable_guidances = Guidance.all_viewable(@user_one) - @organisations.first.guidance_groups.each do |group| - group.guidances.each do |guidance| - assert_includes(all_viewable_guidances, guidance) - end - end -=end - end - - test "all_viewable returns all funder guidances" do -=begin - all_viewable_guidances = Guidance.all_viewable(@user_one) - guidance_groups(:funder_guidance_group_1).guidances.each do |guidance| - assert_includes(all_viewable_guidances, guidance) - end - guidance_groups(:funder_guidance_group_2).guidances.each do |guidance| - assert_includes(all_viewable_guidances, guidance) - end -=end - end - - test "all_viewable returns all of a user's organisations's guidances" do -=begin - all_viewable_guidances_one = Guidance.all_viewable(@user_one) - @organisations.first.guidance_groups.each do |group| - group.guidances.each do |guidance| - assert_includes(all_viewable_guidances_one, guidance) - end - end - - all_viewable_guidances_two = Guidance.all_viewable(@user_two) - @organisations[1].guidance_groups.each do |group| - group.guidances.each do |guidance| - assert_includes(all_viewable_guidances_two, guidance) - end - end - - all_viewable_guidances_three = Guidance.all_viewable(@user_three) - @organisations.last.guidance_groups.each do |group| - group.guidances.each do |guidance| - assert_includes(all_viewable_guidances_three, guidance) - end - end -=end - end - - - test "all_viewable does not return any other organisation's guidance" do -=begin - # TODO: Add in a suitable test. should we check for non-institutions? - all_viewable_guidances = Guidance.all_viewable(@user_one) - # remove all of the user's organisation - # remove all of each funder's organisations - # remove each of the dcc's organisations - # check if nill - all_viewable_guidances.delete_if do |guidance| - guidance.guidance_groups.each do |group| - if group.organisation.id == organisations(:dcc).id - true - elsif group.organisation.organisation_type.id == organisation_types(:funder).id - true - elsif group.organisation.id == @user_one.organisations.first.id - true - else - false - end - end - end - assert_empty(all_viewable_guidances, "there must not be any guidances which are not funders, DCC, or our own organisation") -=end - end - - # ---------- in_group_belonging_to? ---------- - test "in_group_belonging_to correctly identifies parent orgs" do -=begin - # test that the association works for all correct usages - Guidance.all.each do |guidance| - guidance.guidance_groups.each do |group| - assert(guidance.in_group_belonging_to?(group.organisation.id), "Guidance: #{guidance.text} should belong to organisation #{group.organisation.name}") - end - end -=end - end - - test "in_group_belonging_to rejects non-parent orgs" do -=begin - # test that in_group_belonging_to rejects a few interesting organisation-guidance pairs - assert_not(guidances(:related_policies).in_group_belonging_to?(organisations(:ahrc)), "Organisation ahrc does not own guidance: related policies") - assert_not(guidances(:ahrc_funder_guidance).in_group_belonging_to?(organisations(:dcc)), "Organisation dcc does not own guidance: ahrc_funder_guidance") -=end - end - - # ---------- by_organisation ---------- - test "by_organisation correctly returns all guidance belonging to a given org" do -=begin - Organisation.all.each do |org| - org_guidance = Guidance.by_organisation(org) - org.guidance_groups.each do |group| - group.guidances.each do |guidance| - assert_includes(org_guidance, guidance, "Guidance #{guidance.text} should belong to organisation: #{org.name}") - end - end - end -=end - end - - # ---------- get_guidance_group_templates ---------- - ## the main function is completely bugged, so ask to remove it - # test "get_guidance_group_templates retuns all templates belonging to a guidance group" do - # GuidanceGroup.all.each do |group| - # group_templates = guidances(:related_policies).get_guidance_group_templates?(group) - # group.dmptemplates.each do |template| - # assert_includes(group_templates, template, "group #{group.name} should include template #{template.title}") - # end - # end - # end - -end - - - - - - - - diff --git a/test/unit/page_test.rb b/test/unit/page_test.rb deleted file mode 100644 index ff943a7..0000000 --- a/test/unit/page_test.rb +++ /dev/null @@ -1,7 +0,0 @@ -require 'test_helper' - -class PageTest < ActiveSupport::TestCase - # test "the truth" do - # assert true - # end -end diff --git a/test/unit/phase_test.rb b/test/unit/phase_test.rb deleted file mode 100644 index 65ecf3d..0000000 --- a/test/unit/phase_test.rb +++ /dev/null @@ -1,7 +0,0 @@ -require 'test_helper' - -class PhaseTest < ActiveSupport::TestCase - # test "the truth" do - # assert true - # end -end diff --git a/test/unit/plan_section_test.rb b/test/unit/plan_section_test.rb deleted file mode 100644 index 68788db..0000000 --- a/test/unit/plan_section_test.rb +++ /dev/null @@ -1,7 +0,0 @@ -require 'test_helper' - -class PlanSectionTest < ActiveSupport::TestCase - # test "the truth" do - # assert true - # end -end diff --git a/test/unit/plan_test.rb b/test/unit/plan_test.rb deleted file mode 100644 index 2cbd092..0000000 --- a/test/unit/plan_test.rb +++ /dev/null @@ -1,87 +0,0 @@ -require 'test_helper' - -class PlanTest < ActiveSupport::TestCase -=begin - def setup - @plan = Plan.new.tap do |p| - p.project = Project.new - end - end - - def settings(extras = {}) - { - margin: (@margin || { top: 10, bottom: 10, left: 10, right: 10 }), - font_face: (@font_face || Settings::Dmptemplate::VALID_FONT_FACES.first), - font_size: (@font_size || 11) - }.merge(extras) - end - - # settings - - test "no explicit settings should be Settings::Dmptemplate::DEFAULT_SETTINGS" do - assert(!@plan.settings(:export).value?) - assert_equal(Settings::Dmptemplate::DEFAULT_SETTINGS[:formatting], @plan.settings(:export).formatting) - end - - test "no explicit settings with template settings should use template settings" do - template = dmptemplates(:ahrc_template) - template.settings(:export).update_attributes(formatting: settings) - - @plan.project.dmptemplate = template - - assert(!@plan.super_settings(:export).value?) - assert(template.settings(:export).value?) - - assert_equal(settings, template.settings(:export).formatting) - assert_equal(settings, @plan.settings(:export).formatting) - end - - test "explicit settings with template settings should use plan settings" do - template_settings = settings - plan_settings = settings(font_size: 14) - - template = dmptemplates(:ahrc_template) - template.settings(:export).update_attributes(formatting: template_settings) - - @plan.project.dmptemplate = template - @plan.super_settings(:export).formatting = plan_settings - @plan.save! - @plan.reload - - assert(@plan.super_settings(:export).value?) - assert(@plan.settings(:export).value?) - assert(template.settings(:export).value?) - - assert_not_equal(plan_settings, template_settings) - assert_equal(template_settings, template.settings(:export).formatting) - assert_equal(plan_settings, @plan.settings(:export).formatting) - end - - test "explicit settings should not affect other plans with same template" do - template_settings = settings - plan_settings = settings(font_size: 14) - - template = dmptemplates(:ahrc_template) - template.settings(:export).update_attributes(formatting: template_settings) - - @plan.project.dmptemplate = template - @plan.super_settings(:export).formatting = plan_settings - @plan.save! - @plan.reload - - other_plan = Plan.new.tap do |plan| - plan.project = Project.new.tap {|p| p.dmptemplate = template } - end - - other_plan.save! - other_plan.reload - - assert(@plan.super_settings(:export).value?) - assert(@plan.settings(:export).value?) - assert(template.settings(:export).value?) - - assert_not_equal(plan_settings, other_plan.settings(:export).formatting) - assert_equal(template_settings, other_plan.settings(:export).formatting) - end -=end -end diff --git a/test/unit/project_group_test.rb b/test/unit/project_group_test.rb deleted file mode 100644 index 891b697..0000000 --- a/test/unit/project_group_test.rb +++ /dev/null @@ -1,7 +0,0 @@ -require 'test_helper' - -class ProjectGroupTest < ActiveSupport::TestCase - # test "the truth" do - # assert true - # end -end diff --git a/test/unit/project_partner_test.rb b/test/unit/project_partner_test.rb deleted file mode 100644 index 7324b6c..0000000 --- a/test/unit/project_partner_test.rb +++ /dev/null @@ -1,7 +0,0 @@ -require 'test_helper' - -class ProjectPartnerTest < ActiveSupport::TestCase - # test "the truth" do - # assert true - # end -end diff --git a/test/unit/project_test.rb b/test/unit/project_test.rb deleted file mode 100644 index 72cbb5c..0000000 --- a/test/unit/project_test.rb +++ /dev/null @@ -1,21 +0,0 @@ -require 'test_helper' - -class ProjectTest < ActiveSupport::TestCase - # test "the truth" do - # assert true - # end - - setup do - @project = Project.new({ - title: 'My Test Project', - dmptemplate: Dmptemplate.first, - organisation: Organisation.first - }) - end - - # --------------------------------------------------- - test "can manage belongs_to relationship with Visibility" do - verify_belongs_to_relationship(@project, Visibility.first) - end - -end diff --git a/test/unit/question_test.rb b/test/unit/question_test.rb deleted file mode 100644 index f54eeaa..0000000 --- a/test/unit/question_test.rb +++ /dev/null @@ -1,7 +0,0 @@ -require 'test_helper' - -class QuestionTest < ActiveSupport::TestCase - # test "the truth" do - # assert true - # end -end diff --git a/test/unit/section_test.rb b/test/unit/section_test.rb deleted file mode 100644 index f21fdcf..0000000 --- a/test/unit/section_test.rb +++ /dev/null @@ -1,7 +0,0 @@ -require 'test_helper' - -class SectionTest < ActiveSupport::TestCase - # test "the truth" do - # assert true - # end -end diff --git a/test/unit/theme_test.rb b/test/unit/theme_test.rb deleted file mode 100644 index c61fe99..0000000 --- a/test/unit/theme_test.rb +++ /dev/null @@ -1,7 +0,0 @@ -require 'test_helper' - -class ThemeTest < ActiveSupport::TestCase - # test "the truth" do - # assert true - # end -end diff --git a/test/unit/user_role_type_test.rb b/test/unit/user_role_type_test.rb deleted file mode 100644 index eca639c..0000000 --- a/test/unit/user_role_type_test.rb +++ /dev/null @@ -1,7 +0,0 @@ -require 'test_helper' - -class UserRoleTypeTest < ActiveSupport::TestCase - # test "the truth" do - # assert true - # end -end diff --git a/test/unit/version_test.rb b/test/unit/version_test.rb deleted file mode 100644 index a1a033c..0000000 --- a/test/unit/version_test.rb +++ /dev/null @@ -1,7 +0,0 @@ -require 'test_helper' - -class VersionTest < ActiveSupport::TestCase - # test "the truth" do - # assert true - # end -end