Skip to content

Commit

Permalink
Merge commit '164bc8c88bc97f0a23a8b8542f08ee9d353f5c1d' into HEAD
Browse files Browse the repository at this point in the history
  • Loading branch information
Jenkins committed Sep 12, 2012
2 parents 9199075 + 164bc8c commit c77db16
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 32 deletions.
3 changes: 2 additions & 1 deletion Rakefile
@@ -1,8 +1,9 @@
require "rubygems"


task :default => "spec"

desc "Runs all tests"
task "spec" do
ruby "spec/*spec.rb"
end
end
13 changes: 0 additions & 13 deletions lib/app.rb
Expand Up @@ -19,19 +19,6 @@ class App < Sinatra::Base
end

# Content routing
get '/new' do
on_get("New Need", "content/new_need_message", "content/new")
end

post '/new' do
@header = "New Need"
@header_message = :"content/new_need_message"
@template = "content/new"

@errors = Guard.validationsForNewNeed(params)
on_post(params, "new")
end

get '/amend-content' do
on_get("Content Change", "content/content_amend_message", "content/amend")
end
Expand Down
8 changes: 0 additions & 8 deletions lib/validations.rb
Expand Up @@ -5,14 +5,6 @@ class Guard
MAX_UPLOAD_FILE_SIZE_IN_BYTE = 20971520 #20MB

#Content validations
def self.validationsForNewNeed(form_data)
@@errors = {}
required = ["name", "email", "job", "department"]
validate(form_data, required, {"phone" => form_data["phone"]}, {"email" => form_data["email"]})

@@errors
end

def self.validationsForAmendContent(form_data)
@@errors = {}
required = ["name", "email", "job", "department"]
Expand Down
9 changes: 3 additions & 6 deletions lib/zendesk_ticket.rb
Expand Up @@ -4,8 +4,7 @@
class ZendeskTicket

attr_reader :name, :email, :department, :job, :phone, :comment, :subject, :tag, :need_by_date, :not_before_date, :file_token
@@in_comments = {"new" => [:additional],
"amend-content" => [:url1, :url2, :url3],
@@in_comments = {"amend-content" => [:url1, :url2, :url3],
"create-user" => [:user_name, :user_email, :additional],
"remove-user" => [:user_name, :user_email, :additional],
"reset-password" => [:user_name, :user_email, :additional],
Expand All @@ -14,8 +13,7 @@ class ZendeskTicket
"publish-tool" => [:username, :url, :user_agent, :additional]
}

@@in_subject = {"new" => "New Need",
"amend-content" => "Content change request",
@@in_subject = {"amend-content" => "Content change request",
"create-user" => "Create new user",
"remove-user" => "Remove user",
"reset-password" => "Reset Password",
Expand All @@ -24,8 +22,7 @@ class ZendeskTicket
"publish-tool" => "Publishing Tool"
}

@@in_tag = {"new" => "new_need",
"amend-content" => "content_amend",
@@in_tag = {"amend-content" => "content_amend",
"create-user" => "new_user",
"remove-user" => "remove_user",
"reset-password" => "password_reset",
Expand Down
2 changes: 1 addition & 1 deletion spec/content_form_spec.rb
Expand Up @@ -48,7 +48,7 @@ def test_zendesk_create_ticket_triggered_by_post_request
ZendeskClient.expects(:raise_zendesk_request).returns("fake ticket")

#When
post '/new', form_parameters
post '/create-user', form_parameters
follow_redirect!

#Then
Expand Down
4 changes: 1 addition & 3 deletions spec/page_helper.rb
@@ -1,9 +1,7 @@
class PageHelper
def self.fill_content_form
{:url => '/temp',
:old_content => 'test content to add',
:new_content => 'new test content',
:place_to_remove => 'http://testurl.com',
:add_content => 'test content to add',
:additional => 'additional message',
:need_by_day => '30',
:need_by_month => '12',
Expand Down

0 comments on commit c77db16

Please sign in to comment.