Permalink
Browse files

Merge branch 'master' of git://github.com/bakedweb/jobberrails

  • Loading branch information...
2 parents de4100d + 12d6bce commit 8fe6ea9272769b6cba106296a62654751c969d8e @jcnetdev jcnetdev committed Aug 8, 2008
View
1 app/controllers/sessions_controller.rb
@@ -14,6 +14,7 @@ def create
flash[:notice] = "You are logged as #{admin.login}"
redirect_to admin_url
else
+ session[:admin] = admin
flash[:error] = "Invalid login or password!"
redirect_to login_url
end
View
13 db/schema.rb
@@ -27,18 +27,19 @@
end
create_table "job_applicants", :force => true do |t|
- t.integer "job_id", :limit => 11
+ t.integer "job_id", :limit => 11
t.string "name"
t.string "email"
t.string "message"
t.string "ip"
+ t.string "content_type"
+ t.string "filename"
+ t.string "thumbnail"
+ t.integer "size", :limit => 11
+ t.integer "width", :limit => 11
+ t.integer "height", :limit => 11
t.datetime "created_at"
t.datetime "updated_at"
- t.string "integer"
- t.string "resume_file_name"
- t.string "resume_file_size"
- t.string "resume_content_type"
- t.string "string"
end
create_table "job_hunters", :force => true do |t|
View
2 test/fixtures/notifier/job_posted
@@ -1 +1 @@
-JOB POSTED EMAIL
+FIXTURESSSSSSSS
View
12 test/fixtures/notifier/somebody_applied
@@ -1 +1,11 @@
-SOMEBODY APPLIED EMAIL
+Hello there,
+
+Somebody just applied to your job opening.
+
+------------------------------------------
+
+Name: <%= @name %>
+
+Message: <%= @message %>
+
+------------------------------------------
View
2 test/functional/jobs_controller_test.rb
@@ -1,4 +1,4 @@
-require 'test_helper'
+require 'test/test_helper'
class JobsControllerTest < ActionController::TestCase
def test_should_get_index
View
2 test/functional/sessions_controller_test.rb
@@ -1,4 +1,4 @@
-require 'test_helper'
+require 'test/test_helper'
class SessionsControllerTest < ActionController::TestCase
View
2 test/integration/administrative_panel_test.rb
@@ -1,4 +1,4 @@
-require 'test_helper'
+require 'test/test_helper'
class AdministrativePanelTest < ActionController::IntegrationTest
View
66 test/unit/notifier_test.rb
@@ -1,27 +1,47 @@
-require 'test_helper'
+require 'test/test_helper'
+require 'notifier'
-class NotifierTest < ActionMailer::TestCase
- tests Notifier
-
- def test_assert_truth
- assert true
+class NotifierTest < Test::Unit::TestCase
+
+ def setup
+ ActionMailer::Base.delivery_method = :test
+ ActionMailer::Base.perform_deliveries = true
+ ActionMailer::Base.deliveries = []
+
+ end
+
+ def test_job_posted
+
+ recipient = "#{AppConfig.from_email}"
+ company = 'jobberRails'
+ response = Notifier.deliver_job_posted(recipient,company)
+
+ assert_equal "#{AppConfig.site_name} - Thanks for Posting", response.subject
+ assert_match "Hello jobberRails!,\n\nThank you for posting a new job opening. \n\nWe'll be in touch when somebody applies.", response.body
+ assert_equal "jobberrails@gmail.com", response.to[0]
end
-
- # TODO: fix these tests
- # def test_job_posted
- # @expected.subject = "#{AppConfig.site_name} - Thanks for Posting"
- # @expected.body = read_fixture('job_posted')
- # @expected.date = Time.now
- #
- # assert_equal @expected.encoded, Notifier.create_job_posted(@expected.date).encoded
- # end
- #
- # def test_somebody_applied
- # @expected.subject = "#{AppConfig.site_name} - New Job Applicant"
- # @expected.body = read_fixture('somebody_applied')
- # @expected.date = Time.now
- #
- # assert_equal @expected.encoded, Notifier.create_somebody_applied(@expected.date).encoded
- # end
+ def test_somebody_applied
+
+ recipient = "#{AppConfig.from_email}"
+ company = 'jobberRails'
+ message = "New Job Applicant"
+ filename = "filename"
+ id = "3"
+ sent_at = Time.now
+ response = Notifier.deliver_somebody_applied(recipient,name,message,filename,id,sent_at)
+
+ assert_equal "#{AppConfig.site_name} - New Job Applicant", response.subject
+ assert_equal "jobberrails@gmail.com", response.to[0]
+ assert response.body =~ /New Job Applicant/
+
+ end
+
+ private
+ def read_fixture(action)
+ IO.readlines("#{action}")
+ end
+
+
end
+

0 comments on commit 8fe6ea9

Please sign in to comment.