refinerycms-jobs 3.0.0 → 3.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +8 -28
  3. data/.teatro.yml +15 -0
  4. data/.travis.yml +15 -0
  5. data/Gemfile +49 -2
  6. data/Rakefile +5 -5
  7. data/app/controllers/refinery/jobs/admin/job_applications_controller.rb +30 -0
  8. data/app/controllers/refinery/jobs/admin/jobs_controller.rb +13 -33
  9. data/app/controllers/refinery/jobs/admin/settings_controller.rb +4 -4
  10. data/app/controllers/refinery/jobs/job_applications_controller.rb +22 -22
  11. data/app/controllers/refinery/jobs/jobs_controller.rb +9 -6
  12. data/app/helpers/refinery/jobs/controller_helper.rb +7 -3
  13. data/app/models/refinery/jobs/job.rb +19 -5
  14. data/app/models/refinery/jobs/job_application.rb +3 -7
  15. data/app/views/refinery/jobs/admin/{jobs → job_applications}/_job_application.html.erb +13 -1
  16. data/app/views/refinery/jobs/admin/{jobs/job_applications.html.erb → job_applications/index.html.erb} +0 -0
  17. data/app/views/refinery/jobs/admin/jobs/_job.html.erb +33 -23
  18. data/app/views/refinery/jobs/job_applications/_form.html.erb +28 -16
  19. data/bin/rails +5 -0
  20. data/bin/rake +21 -0
  21. data/bin/rspec +22 -0
  22. data/bin/spring +18 -0
  23. data/config/locales/de.yml +105 -0
  24. data/config/locales/en.yml +12 -6
  25. data/config/locales/fr.yml +12 -6
  26. data/config/routes.rb +8 -9
  27. data/db/migrate/20141001192020_add_fields_to_jobs.rb +14 -17
  28. data/db/migrate/20150629201609_add_spam_to_job_applications.rb +5 -0
  29. data/db/seeds.rb +5 -6
  30. data/lib/generators/refinery/jobs/templates/config/initializers/refinery/jobs.rb.erb +2 -0
  31. data/lib/refinery/jobs/configuration.rb +2 -1
  32. data/lib/refinery/jobs/dragonfly.rb +0 -2
  33. data/lib/refinery/jobs/engine.rb +3 -3
  34. data/readme.md +5 -3
  35. data/refinerycms-jobs.gemspec +9 -6
  36. data/spec/factories/helper/factory_sequence.rb +17 -0
  37. data/spec/factories/job.rb +9 -0
  38. data/spec/factories/job_application.rb +11 -0
  39. data/spec/models/refinery/jobs/job_application_spec.rb +42 -0
  40. data/spec/models/refinery/jobs/job_spec.rb +60 -0
  41. data/spec/models/refinery/jobs/settings_spec.rb +43 -0
  42. data/spec/spec_helper.rb +49 -0
  43. data/spec/support/fixtures/refinerycms_is_awesome.txt +1 -0
  44. data/spec/support/helper/generator_helper.rb +11 -0
  45. data/tasks/rspec.rake +6 -0
  46. data/tasks/testing.rake +8 -0
  47. metadata +85 -11
  48. data/app/helpers/refinery/jobs/jobs_helper.rb +0 -7
  49. data/app/views/refinery/jobs/admin/job_applications/_job.html.erb +0 -13
  50. data/app/views/refinery/jobs/admin/job_applications/_sortable_list.html.erb +0 -2
data/bin/rake ADDED
@@ -0,0 +1,21 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # This file was generated by Bundler.
4
+ #
5
+ # The application 'rake' is installed as part of a gem, and
6
+ # this file is here to facilitate running it.
7
+ #
8
+ begin
9
+ if Dir.exist?(File.expand_path('../../spec/dummy', __FILE__))
10
+ load File.expand_path("../spring", __FILE__)
11
+ end
12
+ rescue LoadError
13
+ end
14
+ require 'pathname'
15
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
16
+ Pathname.new(__FILE__).realpath)
17
+
18
+ require 'rubygems'
19
+ require 'bundler/setup'
20
+
21
+ load Gem.bin_path('rake', 'rake')
data/bin/rspec ADDED
@@ -0,0 +1,22 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # This file was generated by Bundler.
4
+ #
5
+ # The application 'rspec' is installed as part of a gem, and
6
+ # this file is here to facilitate running it.
7
+ #
8
+
9
+ begin
10
+ if Dir.exist?(File.expand_path('../../spec/dummy', __FILE__))
11
+ load File.expand_path("../spring", __FILE__)
12
+ end
13
+ rescue LoadError
14
+ end
15
+ require 'pathname'
16
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
17
+ Pathname.new(__FILE__).realpath)
18
+
19
+ require 'rubygems'
20
+ require 'bundler/setup'
21
+
22
+ load Gem.bin_path('rspec-core', 'rspec')
data/bin/spring ADDED
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # This file loads spring without using Bundler, in order to be fast
4
+ # It gets overwritten when you run the `spring binstub` command
5
+
6
+ unless defined?(Spring)
7
+ require "rubygems"
8
+ require "bundler"
9
+
10
+ if match = Bundler.default_lockfile.read.match(/^GEM$.*?^ (?: )*spring \((.*?)\)$.*?^$/m)
11
+ ENV["GEM_PATH"] = ([Bundler.bundle_path.to_s] + Gem.path).join(File::PATH_SEPARATOR)
12
+ ENV["GEM_HOME"] = ""
13
+ Gem.paths = ENV
14
+
15
+ gem "spring", match[1]
16
+ require "spring/binstub"
17
+ end
18
+ end
@@ -0,0 +1,105 @@
1
+ de:
2
+ refinery:
3
+ plugins:
4
+ refinery_jobs:
5
+ title: Jobs
6
+ jobs:
7
+ config:
8
+ from_name: "%{name} [%{site_name}]"
9
+ admin:
10
+ jobs:
11
+ actions:
12
+ create_new: Erstelle einen neuen Job
13
+ reorder: Jobs anordnen
14
+ reorder_done: Anordnen der Jobs erledigt
15
+ records:
16
+ title: Jobs
17
+ sorry_no_results: Entschuldigung! Es wurden keine Ergebnisse gefunden"
18
+ no_items_yet: Es gibt bisher noch keine Jobs.
19
+ job:
20
+ job_applications_count:
21
+ zero: Keine Bewerbung
22
+ one: "%{count} Bewerbung"
23
+ other: "%{count} Bewerbungen"
24
+ view_live_html: Zeige den Job an <br/><em>(öffnet sich in einem neuen Fenster)</em>
25
+ view_applications_for_this_job: Zeige Bewerbungen für diesen Job
26
+ edit: Bearbeite diesen Job
27
+ delete: Lösche diesen Job
28
+ draft: Entwurf
29
+ job_applications:
30
+ index:
31
+ job_applications_for_position: 'Bewerbungen für die Stelle als "%{job_title}"'
32
+ back_to_jobs: Zurück zu den Jobs
33
+ job_application:
34
+ created_at: Erstellt am
35
+ name: Name
36
+ email: E-Mail
37
+ phone: Telefon
38
+ cover_letter: Anschreiben
39
+ download_resume: "Lebenslauf von %{name} herunterladen"
40
+ jobs:
41
+ show:
42
+ fill: Anzahl der freien Stellen
43
+ ref: Referenznummer
44
+ description: Beschreibung
45
+ requirements_and_work_conditions: Anforderungen und Arbeitsbedingungen
46
+ education: Ausbildung
47
+ experience: Benötigte Arbeitserfahrung in diesem Bereich in Jahren
48
+ skills: Fähigkeiten
49
+ languages: Gefragte Sprachen
50
+ salary: Lohn
51
+ hours: Anzahl der Wochenstunden
52
+ employment_terms: Anstellungsverhältnis
53
+ length: Länge der Anstellung
54
+ employment_date: Einstellungsdatum
55
+ contact: Name der Kontaktperson
56
+ back_to_list: Zurück zur Jobsliste
57
+ index:
58
+ no_open_positions: Es gibt zur Zeit keine offenen Stellen
59
+ current_open_positions: Derzeit offene Stellen
60
+ job_applications:
61
+ form:
62
+ job_application_for_position: Bewerbe dich online als %{job_title}
63
+ apply: Bewerben
64
+ mandatory_fields: <sup>*</sup> Felder sind verpflichtend.
65
+ show:
66
+ job_application_successfully_submitted: 'Deine Bewerbung für die Stelle als <strong>"%{job_title}"</strong> ist erfolgreich bei uns eingegangen. <br>Sie werden eine E-Mail zur Bestätigung erhalten.<br><br>Vielen Dank.'
67
+ back_to_list: Zurück zur Jobsliste
68
+ job_mailer:
69
+ notification:
70
+ greeting: Hallo
71
+ you_recieved_new_job_application: Du hast eine neue Bewerbung über deine Website bekommen.
72
+ job_application_starts: --- Anfang der Bewerbung ---
73
+ job_application_ends: --- Ende der Bewerbung ---
74
+ from: Von
75
+ email: E-Mail
76
+ phone: Telefon
77
+ cover_letter: Anschreiben
78
+ resume: Lebenslauf
79
+ closing_line: Viele Grüße
80
+ ps: PS Alle Bewerbungen sind online in dem Bereich 'Jobs' hinterlegt und können dort später betrachtet werden.
81
+ activerecord:
82
+ attributes:
83
+ 'refinery/jobs/job':
84
+ title: Titel
85
+ fill: Anzahl der freien Stellen
86
+ ref: Referenznummer
87
+ description: Beschreibung
88
+ education: Ausbildung
89
+ experience: Benötigte Arbeitserfahrung in diesem Bereich in Jahren
90
+ skills: Fähigkeiten
91
+ languages: Gefragte Sprachen
92
+ salary: Lohn
93
+ hours: Anzahl der Wochenstunden
94
+ employment_terms: Employment terms
95
+ length: Länge der Anstellung
96
+ employment_date: Einstellungsdatum
97
+ contact: Name der Kontaktperson
98
+ published_at: Veröffentlicht am
99
+ draft: Als Entwurf speicher
100
+ 'refinery/jobs/job_application':
101
+ name: Name
102
+ email: E-Mail
103
+ phone: Telefon
104
+ cover_letter: Anschreiben
105
+ resume: Lebenslauf
@@ -17,11 +17,19 @@ en:
17
17
  sorry_no_results: "Sorry, no results found."
18
18
  no_items_yet: There are no jobs yet.
19
19
  job:
20
+ job_applications_count:
21
+ zero: No job application
22
+ one: "%{count} job application"
23
+ other: "%{count} job applications"
20
24
  view_live_html: View this job <br/><em>(opens in a new window)</em>
21
25
  view_applications_for_this_job: View applications for this job
22
26
  edit: Edit this job
23
27
  delete: Delete this job
24
28
  draft: draft
29
+ job_applications:
30
+ index:
31
+ job_applications_for_position: 'Job applications for position "%{job_title}"'
32
+ back_to_jobs: Back to jobs
25
33
  job_application:
26
34
  created_at: Created at
27
35
  name: Name
@@ -29,12 +37,9 @@ en:
29
37
  phone: Phone
30
38
  cover_letter: Cover letter
31
39
  download_resume: "Download %{name}'s resume"
32
- job_applications:
33
- job_applications_for_position: 'Job applications for position "%{job_title}"'
34
- back_to_jobs: Back to jobs
35
40
  jobs:
36
41
  show:
37
- fill: Number of vacancies
42
+ fill: Number of positions to fill
38
43
  ref: Reference number
39
44
  description: Description
40
45
  requirements_and_work_conditions: Requirements and work conditions
@@ -54,8 +59,9 @@ en:
54
59
  current_open_positions: Current open positions
55
60
  job_applications:
56
61
  form:
57
- job_application_for_position: Apply Online
62
+ job_application_for_position: Apply Online as %{job_title}
58
63
  apply: Apply
64
+ mandatory_fields: <sup>*</sup> fields are required.
59
65
  show:
60
66
  job_application_successfully_submitted: 'Your job application for the <strong>"%{job_title}"</strong> position was successfully submitted. <br>You will receive a confirmation email.<br><br>Thank you.'
61
67
  back_to_list: Back to jobs list
@@ -96,4 +102,4 @@ en:
96
102
  email: Email
97
103
  phone: Phone
98
104
  cover_letter: Cover letter
99
- resume: Resume
105
+ resume: Resume
@@ -17,11 +17,19 @@ fr:
17
17
  sorry_no_results: "Désolé ! Aucun résultat."
18
18
  no_items_yet: Il n'y a actuellement aucune offre d'emploi. Cliquer sur "Créer une nouvelle offre d'emploi" pour créer votre première offre d'emploi.
19
19
  job:
20
+ job_applications_count:
21
+ zero: Aucune demande d'emploi
22
+ one: "%{count} demande d'emploi"
23
+ other: "%{count} demandes d'emploi"
20
24
  view_live_html: Voir cette offre d'emploi <br/><em>(Ouvre une nouvelle fenêtre)</em>
21
25
  view_applications_for_this_job: Voir les candidatures pour cette offre d'emploi
22
26
  edit: Modifier cette offre d'emploi
23
27
  delete: Supprimer définitivement cette offre d'emploi
24
28
  draft: brouillon
29
+ job_applications:
30
+ index:
31
+ job_applications_for_position: 'Candidatures pour le poste de "%{job_title}"'
32
+ back_to_jobs: Revenir à la liste des offres d'emploi
25
33
  job_application:
26
34
  created_at: Créée le
27
35
  name: Nom
@@ -29,9 +37,6 @@ fr:
29
37
  phone: Téléphone
30
38
  cover_letter: Lettre de présentation
31
39
  download_resume: "Téléchargez le Curriculum Vitae de %{name}"
32
- job_applications:
33
- job_applications_for_position: 'Candidatures pour le poste de "%{job_title}"'
34
- back_to_jobs: Revenir à la liste des offres d'emploi
35
40
  jobs:
36
41
  show:
37
42
  fill: Nombre de postes à combler
@@ -50,12 +55,13 @@ fr:
50
55
  contact: Nom de la personne à contacter
51
56
  back_to_list: Revenir à la liste des offres d'emploi
52
57
  index:
53
- no_open_positions: Il n'y a pas de postes ouverts pour le moment.
58
+ no_open_positions: Il n'y a pas de poste ouvert pour le moment.
54
59
  current_open_positions: Postes ouverts
55
60
  job_applications:
56
61
  form:
57
- job_application_for_position: Postulez en ligne
62
+ job_application_for_position: Postulez en ligne en tant que %{job_title}
58
63
  apply: Postuler
64
+ mandatory_fields: <sup>*</sup> champs obligatoires.
59
65
  show:
60
66
  job_application_successfully_submitted: 'Votre candidature pour le poste de <strong>"%{job_title}"</strong> a été soumise avec succès. <br>Vous allez recevoir un courriel de confirmation.<br><br>Merci.'
61
67
  back_to_list: Revenir à la liste des offres d'emploi
@@ -97,4 +103,4 @@ fr:
97
103
  email: Courriel
98
104
  phone: Téléphone
99
105
  cover_letter: Lettre de présentation
100
- resume: Curriculum Vitae
106
+ resume: Curriculum Vitae
data/config/routes.rb CHANGED
@@ -1,20 +1,19 @@
1
1
  Refinery::Core::Engine.routes.draw do
2
+ namespace :jobs, path: Refinery::Jobs.page_url do
3
+ root to: "jobs#index"
2
4
 
3
- namespace :jobs, :path => '' do
4
- resources :jobs, :only => [:show, :index] do
5
- resources :job_applications
5
+ resources :jobs, path: '', only: [:index, :show] do
6
+ resources :job_applications, only: [:new, :create, :show]
6
7
  end
7
8
  end
8
9
 
9
- namespace :jobs, :path => '' do
10
- namespace :admin, :path => Refinery::Core.backend_route do
11
- resources :jobs, :except => :show do
10
+ namespace :jobs, path: '' do
11
+ namespace :admin, path: Refinery::Core.backend_route do
12
+ resources :jobs, except: :show do
12
13
  collection do
13
14
  post :update_positions
14
15
  end
15
- member do
16
- get :job_applications
17
- end
16
+ resources :job_applications
18
17
  end
19
18
  end
20
19
  end
@@ -1,15 +1,8 @@
1
1
  class AddFieldsToJobs < ActiveRecord::Migration
2
2
  def up
3
- add_column Refinery::Jobs::Job.table_name, :fill, :integer, default: 1
4
- add_column Refinery::Jobs::Job.table_name, :ref, :string
5
- add_column Refinery::Jobs::Job.table_name, :education, :string
6
- add_column Refinery::Jobs::Job.table_name, :experience, :string
7
- add_column Refinery::Jobs::Job.table_name, :skills, :string
8
- add_column Refinery::Jobs::Job.table_name, :languages, :string
9
- add_column Refinery::Jobs::Job.table_name, :salary, :string
10
- add_column Refinery::Jobs::Job.table_name, :length, :string
11
- add_column Refinery::Jobs::Job.table_name, :employment_date, :date
12
- add_column Refinery::Jobs::Job.table_name, :contact, :string
3
+ add_column :refinery_jobs, :fill, :integer, default: 1
4
+ add_column :refinery_jobs, :ref, :string
5
+ add_column :refinery_jobs, :employment_date, :date
13
6
 
14
7
  Refinery::Jobs::Job.add_translation_fields! education: :string
15
8
  Refinery::Jobs::Job.add_translation_fields! experience: :string
@@ -21,12 +14,16 @@ class AddFieldsToJobs < ActiveRecord::Migration
21
14
  end
22
15
 
23
16
  def down
24
- remove_column :job_translations, :education
25
- remove_column :job_translations, :experience
26
- remove_column :job_translations, :skills
27
- remove_column :job_translations, :languages
28
- remove_column :job_translations, :salary
29
- remove_column :job_translations, :length
30
- remove_column :job_translations, :contact
17
+ remove_column :refinery_jobs, :fill
18
+ remove_column :refinery_jobs, :ref
19
+ remove_column :refinery_jobs, :employment_date
20
+
21
+ remove_column :refinery_job_translations, :education
22
+ remove_column :refinery_job_translations, :experience
23
+ remove_column :refinery_job_translations, :skills
24
+ remove_column :refinery_job_translations, :languages
25
+ remove_column :refinery_job_translations, :salary
26
+ remove_column :refinery_job_translations, :length
27
+ remove_column :refinery_job_translations, :contact
31
28
  end
32
29
  end
@@ -0,0 +1,5 @@
1
+ class AddSpamToJobApplications < ActiveRecord::Migration
2
+ def change
3
+ add_column :refinery_job_applications, :spam, :boolean
4
+ end
5
+ end
data/db/seeds.rb CHANGED
@@ -1,14 +1,13 @@
1
1
  if defined?(Refinery::User)
2
2
  Refinery::User.all.each do |user|
3
- if user.plugins.where(:name => 'refinerycms_jobs').blank?
4
- user.plugins.create(:name => "refinerycms_jobs",
3
+ if user.plugins.where(:name => 'refinery_jobs').blank?
4
+ user.plugins.create(:name => "refinery_jobs",
5
5
  :position => (user.plugins.maximum(:position) || -1) +1)
6
6
  end
7
7
  end
8
8
  end
9
9
 
10
- url = '/jobs'
11
- if defined?(Refinery::Page) and !Refinery::Page.exists?(:link_url => url)
10
+ if defined?(Refinery::Page) and !Refinery::Page.exists?(:link_url => (url = Refinery::Jobs.page_url))
12
11
  page = Refinery::Page.create(
13
12
  :title => "Jobs",
14
13
  :link_url => url,
@@ -17,10 +16,10 @@ if defined?(Refinery::Page) and !Refinery::Page.exists?(:link_url => url)
17
16
  )
18
17
 
19
18
  Refinery::Pages.default_parts.each_with_index do |default_page_part, index|
20
- page.parts.create(:title => default_page_part, :body => nil, :position => index)
19
+ page.parts.create(title: default_page_part[:title], slug: default_page_part[:slug], body: nil, position: index)
21
20
  end
22
21
  end
23
22
 
24
23
  (Refinery::Jobs::Setting.methods.sort - Refinery::Setting.methods).each do |setting|
25
24
  Refinery::Jobs::Setting.send(setting) if setting.to_s !~ /=\z/
26
- end
25
+ end
@@ -4,4 +4,6 @@ Refinery::Jobs.configure do |config|
4
4
 
5
5
  # Configure name in 'from' email address
6
6
  # config.from_name = <%= Refinery::Jobs.from_name.inspect %>
7
+
8
+ # config.page_url = <%= Refinery::Jobs.page_url.inspect %>
7
9
  end
@@ -3,9 +3,10 @@ module Refinery
3
3
  include ActiveSupport::Configurable
4
4
 
5
5
  config_accessor :send_notifications_for_job_applications_marked_as_spam
6
- config_accessor :from_name
6
+ config_accessor :from_name, :page_url
7
7
 
8
8
  self.send_notifications_for_job_applications_marked_as_spam = false
9
9
  self.from_name = "no-reply"
10
+ self.page_url = "/jobs"
10
11
  end
11
12
  end
@@ -1,5 +1,3 @@
1
- require 'dragonfly'
2
-
3
1
  module Refinery
4
2
  module Jobs
5
3
  module Dragonfly
@@ -13,17 +13,17 @@ module Refinery
13
13
  ::Refinery::Jobs::Dragonfly.attach!(app)
14
14
  end
15
15
 
16
- initializer "register refinery_jobs plugin" do
16
+ before_inclusion do
17
17
  Refinery::Plugin.register do |plugin|
18
18
  plugin.pathname = root
19
19
  plugin.name = 'refinery_jobs'
20
- plugin.menu_match = /(admin|refinery)\/(jobs|vacancies)\/jobs$/
20
+ plugin.menu_match = %r{refinery/jobs(/jobs(/.*)?)?(/job_applications(/.*)?)?$}
21
21
  plugin.url = proc { Refinery::Core::Engine.routes.url_helpers.jobs_admin_jobs_path }
22
22
  end
23
23
  end
24
24
 
25
25
  config.after_initialize do
26
- Refinery.register_extension(Refinery::Resources)
26
+ Refinery.register_extension(Refinery::Jobs)
27
27
  end
28
28
  end
29
29
  end
data/readme.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # Refinery CMS Jobs
2
2
 
3
+ [![Build Status](https://travis-ci.org/refinerycms-contrib/refinerycms-jobs.svg?branch=master)](https://travis-ci.org/refinerycms-contrib/refinerycms-jobs) [![Code Climate](https://codeclimate.com/github/refinerycms-contrib/refinerycms-jobs/badges/gpa.svg)](https://codeclimate.com/github/refinerycms-contrib/refinerycms-jobs) [![Test Coverage](https://codeclimate.com/github/refinerycms-contrib/refinerycms-jobs/badges/coverage.svg)](https://codeclimate.com/github/refinerycms-contrib/refinerycms-jobs/coverage)
4
+
3
5
  Jobs engine for [Refinery CMS](http://refinerycms.com) allows you to post vacancies to the jobs section of your website.
4
6
 
5
7
  ### In summary you can:
@@ -12,8 +14,8 @@ When job applications come in, you and the candidate are generally notified. As
12
14
 
13
15
  ## Requirements
14
16
 
15
- This version of `refinerycms-jobs` supports Refinery 3.x and Rails 4.1.x.
16
- To use Rails 3.x / Refinery 2.0.x use the [refinerycms-jobs "Refinery CMS 2-0 stable branch"](http://github.com/bisscomm/refinerycms-jobs/tree/2-0-stable).
17
+ This version of `refinerycms-jobs` supports Refinery 3.x and Rails 4.1+.
18
+ To use Rails 3.x / Refinery 2.0.x use the [refinerycms-jobs "Refinery CMS 2-0 stable branch"](http://github.com/refinerycms-contrib/refinerycms-jobs/tree/2-0-stable).
17
19
 
18
20
  * [Refinery CMS](http://refinerycms.com) version 3.0.0 or above.
19
21
  * Paperclip has been removed in favor of using Refinery Resources dragonfly app
@@ -25,7 +27,7 @@ To use Rails 3.x / Refinery 2.0.x use the [refinerycms-jobs "Refinery CMS 2-0 st
25
27
  Open up your ``Gemfile`` and add at the bottom this line:
26
28
 
27
29
  ```ruby
28
- gem 'refinerycms-jobs', git: 'https://github.com/bisscomm/refinerycms-jobs', branch: 'master'
30
+ gem 'refinerycms-jobs', git: 'https://github.com/refinerycms-contrib/refinerycms-jobs', branch: 'master'
29
31
  ```
30
32
 
31
33
  Now, run ``bundle install``
@@ -4,12 +4,12 @@ $:.push File.expand_path('../lib', __FILE__)
4
4
  Gem::Specification.new do |s|
5
5
  s.platform = Gem::Platform::RUBY
6
6
  s.name = %q{refinerycms-jobs}
7
- s.version = '3.0.0'
7
+ s.version = '3.0.1'
8
8
  s.summary = %q{Ruby on Rails jobs engine for Refinery CMS.}
9
9
  s.description = %q{Open source Ruby on Rails jobs engine designed for integration with Refinery CMS.}
10
10
  s.email = %q{}
11
- s.homepage = %q{https://github.com/bisscomm/refinerycms-jobs}
12
- s.authors = ['Flatterline', 'Brice Sanchez']
11
+ s.homepage = %q{https://github.com/refinerycms-contrib/refinerycms-jobs}
12
+ s.authors = ['Brice Sanchez', 'Flatterline']
13
13
  s.license = %q{MIT}
14
14
  s.require_paths = %w(lib)
15
15
 
@@ -17,8 +17,11 @@ Gem::Specification.new do |s|
17
17
  s.test_files = `git ls-files -- spec/*`.split("\n")
18
18
 
19
19
  # Runtime dependencies
20
- s.add_dependency 'refinerycms-core', '~> 3.0.0'
20
+ s.add_dependency 'refinerycms-core', '~> 3.0.0'
21
21
  s.add_dependency 'refinerycms-settings', '~> 3.0.0'
22
- s.add_dependency 'dragonfly', '~> 1.0.7'
23
- s.add_dependency 'filters_spam', '~> 0.2'
22
+ s.add_dependency 'globalize', ['>= 4.0.0', '< 5.2']
23
+ s.add_dependency 'friendly_id-globalize'
24
+ s.add_dependency 'dragonfly', '~> 1.0.7'
25
+ s.add_dependency 'filters_spam', '~> 0.2'
26
+ s.add_dependency 'acts_as_indexed', '~> 0.8.0'
24
27
  end
@@ -0,0 +1,17 @@
1
+ FactoryGirl.define do
2
+ sequence :email do |n|
3
+ "person#{n}@refinerycms.com"
4
+ end
5
+ end
6
+
7
+ FactoryGirl.define do
8
+ sequence :title, aliases: [:name, :cover_letter, :description] do |n|
9
+ "Test #{n}"
10
+ end
11
+ end
12
+
13
+ FactoryGirl.define do
14
+ sequence :date, aliases: [:created_at] do |n|
15
+ DateTime.now + n.days
16
+ end
17
+ end
@@ -0,0 +1,9 @@
1
+ require "factory_girl"
2
+
3
+ FactoryGirl.define do
4
+ factory :job, class: "Refinery::Jobs::Job" do
5
+ title
6
+ description
7
+ created_at
8
+ end
9
+ end
@@ -0,0 +1,11 @@
1
+ require "factory_girl"
2
+
3
+ FactoryGirl.define do
4
+ factory :job_application, class: "Refinery::Jobs::JobApplication" do
5
+ name
6
+ phone '321-123-1234'
7
+ email
8
+ cover_letter
9
+ resume '/refinerycms-jobs/spec/support/fixtures/refinery_is_awesome.txt'
10
+ end
11
+ end
@@ -0,0 +1,42 @@
1
+ require 'spec_helper'
2
+ require 'support/helper/generator_helper'
3
+
4
+ module Refinery
5
+ module Jobs
6
+ describe JobApplication, type: :model do
7
+ before :each do
8
+ @job_application = FactoryGirl.create :job_application
9
+ @job = FactoryGirl.create :job
10
+ end
11
+
12
+ context 'validations' do
13
+ it 'should be functional' do
14
+ # Negative tests
15
+ expect(FactoryGirl.build(:job_application, name: nil)).not_to be_valid
16
+ expect(FactoryGirl.build(:job_application, phone: nil)).not_to be_valid
17
+ expect(FactoryGirl.build(:job_application, email: nil)).not_to be_valid
18
+ expect(FactoryGirl.build(:job_application, email: generate_string)).not_to be_valid
19
+ expect(FactoryGirl.build(:job_application, email: "#{generate_string}@")).not_to be_valid
20
+ expect(FactoryGirl.build(:job_application, email: "#{generate_string}@{generate_string}.")).not_to be_valid
21
+ expect(FactoryGirl.build(:job_application, cover_letter: nil)).not_to be_valid
22
+ expect(FactoryGirl.build(:job_application, resume: nil)).not_to be_valid
23
+
24
+ # Positive test
25
+ expect(FactoryGirl.build(:job_application, phone: '123-124-1234')).to be_valid
26
+ end
27
+ end
28
+
29
+ context 'destroy' do
30
+ it 'should be functional' do
31
+ job_app_id = @job_application.id
32
+ @job_application.update_attributes(job: @job)
33
+ @job_application.destroy
34
+
35
+ expect(Refinery::Jobs::JobApplication.find_by_id(job_app_id)).to be_nil
36
+ expect(Refinery::Jobs::Job.find_by_id(@job.id)).not_to be_nil
37
+ end
38
+ end
39
+
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,60 @@
1
+ require 'spec_helper'
2
+ require 'support/helper/generator_helper'
3
+
4
+ module Refinery
5
+ module Jobs
6
+ describe Job, type: :model do
7
+ before :each do
8
+ @job_application = FactoryGirl.create :job_application
9
+ @job = FactoryGirl.create :job
10
+ end
11
+
12
+ context 'validations' do
13
+ it 'requires title and description' do
14
+ #Negative tests
15
+ expect(FactoryGirl.build(:job, description: nil)).not_to be_valid
16
+ expect(FactoryGirl.build(:job, title: nil)).not_to be_valid
17
+ expect(FactoryGirl.build(:job, title: '')).not_to be_valid
18
+ expect(FactoryGirl.build(:job, description: '')).not_to be_valid
19
+
20
+ #Positive tests
21
+ expect(FactoryGirl.build(:job, description: 1, title: 1)).to be_valid
22
+ end
23
+ end
24
+
25
+ context 'update' do
26
+ it 'should be functional' do
27
+ gen_title = generate_string
28
+ gen_description = generate_string
29
+
30
+ @job.update_attributes(title: gen_title, description: gen_description)
31
+
32
+ expect(@job.title).to eq gen_title
33
+ expect(@job.description).to eq gen_description
34
+ end
35
+ end
36
+
37
+ context 'destroy' do
38
+ it 'should be functional' do
39
+ job_id = @job.id
40
+ job_app_id = @job_application.id
41
+ @job_application.update_attributes(job: @job)
42
+ @job.destroy
43
+
44
+ expect(Refinery::Jobs::JobApplication.find_by_id(job_app_id)).to be_nil
45
+ expect(Refinery::Jobs::Job.find_by_id(job_id)).to be_nil
46
+ end
47
+ end
48
+
49
+ context 'latest' do
50
+ it 'should return the 5 latest job' do
51
+ jobs = FactoryGirl.create_list(:job, 5)
52
+
53
+ jobs.reverse!
54
+
55
+ expect(Refinery::Jobs::Job.latest).to eq jobs
56
+ end
57
+ end
58
+ end
59
+ end
60
+ end