refinerycms-inquiries 2.0.3 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +4 -1
  3. data/.travis.yml +14 -6
  4. data/Gemfile +26 -53
  5. data/Rakefile +2 -0
  6. data/app/controllers/refinery/inquiries/admin/inquiries_controller.rb +1 -1
  7. data/app/controllers/refinery/inquiries/inquiries_controller.rb +1 -1
  8. data/app/helpers/refinery/inquiries/inquiries_helper.rb +2 -2
  9. data/app/mailers/refinery/inquiries/inquiry_mailer.rb +11 -4
  10. data/app/models/refinery/inquiries/inquiry.rb +5 -4
  11. data/app/views/refinery/inquiries/admin/inquiries/_inquiry.html.erb +4 -2
  12. data/app/views/refinery/inquiries/admin/inquiries/_submenu.html.erb +1 -1
  13. data/app/views/refinery/inquiries/admin/inquiries/index.html.erb +2 -2
  14. data/app/views/refinery/inquiries/admin/inquiries/show.html.erb +3 -1
  15. data/app/views/refinery/inquiries/admin/settings/_confirmation_email_form.html.erb +1 -1
  16. data/app/views/refinery/inquiries/admin/settings/edit.html.erb +2 -2
  17. data/app/views/refinery/inquiries/inquiries/new.html.erb +19 -9
  18. data/app/views/refinery/inquiries/inquiries/thank_you.html.erb +1 -1
  19. data/app/views/refinery/inquiries/inquiry_mailer/confirmation.text.erb +1 -1
  20. data/app/views/refinery/inquiries/inquiry_mailer/notification.text.erb +2 -2
  21. data/config/locales/bg.yml +2 -0
  22. data/config/locales/cs.yml +2 -0
  23. data/config/locales/da.yml +2 -1
  24. data/config/locales/de.yml +2 -0
  25. data/config/locales/en-GB.yml +2 -0
  26. data/config/locales/en.yml +2 -0
  27. data/config/locales/es.yml +2 -0
  28. data/config/locales/fr.yml +2 -0
  29. data/config/locales/it.yml +3 -1
  30. data/config/locales/lt.yml +2 -0
  31. data/config/locales/lv.yml +2 -1
  32. data/config/locales/nb.yml +2 -0
  33. data/config/locales/nl.yml +2 -0
  34. data/config/locales/pl.yml +2 -0
  35. data/config/locales/pt-BR.yml +2 -0
  36. data/config/locales/ru.yml +2 -0
  37. data/config/locales/sk.yml +2 -0
  38. data/config/locales/sl.yml +2 -0
  39. data/config/locales/sv.yml +8 -6
  40. data/config/locales/zh-CN.yml +2 -0
  41. data/config/routes.rb +1 -1
  42. data/db/seeds.rb +3 -1
  43. data/lib/generators/refinery/inquiries/templates/config/initializers/refinery/inquiries.rb.erb +12 -0
  44. data/lib/refinery/inquiries.rb +0 -1
  45. data/lib/refinery/inquiries/configuration.rb +8 -0
  46. data/license.md +5 -5
  47. data/readme.md +5 -1
  48. data/refinerycms-inquiries.gemspec +5 -5
  49. data/spec/{requests → features}/refinery/inquiries/admin/inquiries_spec.rb +13 -12
  50. data/spec/features/refinery/inquiries/inquiries_spec.rb +145 -0
  51. data/spec/features/refinery/inquiries/mailer_spec.rb +41 -0
  52. data/spec/models/refinery/inquiries/inquiry_spec.rb +9 -9
  53. data/spec/spec_helper.rb +18 -44
  54. metadata +21 -28
  55. data/Guardfile +0 -20
  56. data/config/locales/lolcat.yml +0 -78
  57. data/spec/requests/refinery/inquiries/inquiries_spec.rb +0 -81
@@ -4,6 +4,8 @@ es:
4
4
  refinerycms_inquiries:
5
5
  title: Consultas
6
6
  inquiries:
7
+ config:
8
+ from_name: "%{name} [%{site_name}]"
7
9
  inquiries:
8
10
  new:
9
11
  send: Enviar mensaje
@@ -5,6 +5,8 @@ fr:
5
5
  title: Requêtes
6
6
  description: Fournit un formulaire de contact et gère les demandes de contacts.
7
7
  inquiries:
8
+ config:
9
+ from_name: "%{name} [%{site_name}]"
8
10
  inquiries:
9
11
  new:
10
12
  send: Envoyer un message
@@ -5,6 +5,8 @@ it:
5
5
  title: Richieste
6
6
  description: Fornisce un modulo di contatto e memorizza le richieste
7
7
  inquiries:
8
+ config:
9
+ from_name: "%{name} [%{site_name}]"
8
10
  inquiries:
9
11
  new:
10
12
  header_message: si è verificato un problema
@@ -67,7 +69,7 @@ it:
67
69
  phone: Telefono
68
70
  message: Messaggio
69
71
  closing_line: Saluti
70
- ps: P.S. Tutte le richiesta ricevute sono salvate nella sezione "Richieste" di Refinery così da poter esser viste in un secondo momento.
72
+ ps: P.S. Tutte le richiesta ricevute sono salvate nella sezione "Richieste" di Refinery così da poter esser viste in un secondo momento.
71
73
  activerecord:
72
74
  models:
73
75
  refinery/inquiries/inquiry: inquiry
@@ -5,6 +5,8 @@ lt:
5
5
  title: Užklausos
6
6
  description: Suteikia kontaktų formą ir saugo užklausas
7
7
  inquiries:
8
+ config:
9
+ from_name: "%{name} [%{site_name}]"
8
10
  inquiries:
9
11
  new:
10
12
  send: Siųsti žinutę
@@ -5,6 +5,8 @@ lv:
5
5
  title: Pieprasījumi
6
6
  description: Nodrošina kontaktformu un glabā pieprasījumus
7
7
  inquiries:
8
+ config:
9
+ from_name: "%{name} [%{site_name}]"
8
10
  inquiries:
9
11
  new:
10
12
  send: Sūtīt ziņu
@@ -42,7 +44,6 @@ lv:
42
44
  settings:
43
45
  notification_recipients_form:
44
46
  inquiry_settings_value_name: Sūtīt paziņojumu uz
45
- explanation: Katru reizi, kad kāds ar tevi sazinās izmantojot kontaktformu, Refinery nosūta epastu par to, ka ir jauns pieprasījums.
46
47
  hint: Kad tiek iesniegts jauns pieprasījums, tad Refinery nosūtīs paziņojumu uz šo epastu.
47
48
  example: "Ievadi savu epasta(-u) adresi(-es) šādā formātā: janis.ozols@test.lv, juris@test.lv"
48
49
  confirmation_email_form:
@@ -5,6 +5,8 @@ nb:
5
5
  title: Forespørsler
6
6
  description: Legger til et kontaktskjema og lagrer forespørsler
7
7
  inquiries:
8
+ config:
9
+ from_name: "%{name} [%{site_name}]"
8
10
  inquiries:
9
11
  new:
10
12
  send: Send melding
@@ -5,6 +5,8 @@ nl:
5
5
  title: Contactaanvragen
6
6
  description: Contactformulier en beheer van vragen
7
7
  inquiries:
8
+ config:
9
+ from_name: "%{name} [%{site_name}]"
8
10
  inquiries:
9
11
  new:
10
12
  send: Verstuur uw vraag
@@ -6,6 +6,8 @@ pl:
6
6
  description: Zapewnia formularz kontaktowy i przechowuje zapytania
7
7
  article: neutral
8
8
  inquiries:
9
+ config:
10
+ from_name: "%{name} [%{site_name}]"
9
11
  inquiries:
10
12
  new:
11
13
  send: Wyślij wiadomość
@@ -5,6 +5,8 @@ pt-BR:
5
5
  title: Contatos
6
6
  description: Gerenciar contatos
7
7
  inquiries:
8
+ config:
9
+ from_name: "%{name} [%{site_name}]"
8
10
  inquiries:
9
11
  new:
10
12
  send: Enviar mensagem
@@ -5,6 +5,8 @@ ru:
5
5
  title: Запросы
6
6
  description: Предоставляет форму обратной связи и хранит запросы
7
7
  inquiries:
8
+ config:
9
+ from_name: "%{name} [%{site_name}]"
8
10
  inquiries:
9
11
  new:
10
12
  send: Отправить сообщение
@@ -5,6 +5,8 @@ sk:
5
5
  title: Otázky
6
6
  description: Zabezpečuje kontaktný formulár a uchováva zaslané otázky.
7
7
  inquiries:
8
+ config:
9
+ from_name: "%{name} [%{site_name}]"
8
10
  inquiries:
9
11
  new:
10
12
  send: Odoslať správu
@@ -5,6 +5,8 @@ sl:
5
5
  title: Povpraševanja
6
6
  description: Priskrbi kontaktni obrazec in shrani povpraševanja
7
7
  inquiries:
8
+ config:
9
+ from_name: "%{name} [%{site_name}]"
8
10
  inquiries:
9
11
  new:
10
12
  send: Pošlji sporočilo
@@ -5,15 +5,17 @@ sv:
5
5
  title: Förfrågningar
6
6
  description: Tillhandahåller ett formulär och sparar förfrågningar
7
7
  inquiries:
8
+ config:
9
+ from_name: "%{name} [%{site_name}]"
8
10
  inquiries:
9
11
  new:
10
12
  send: Skicka meddelande
11
- privacy_policy: Vi värderar ditt privatliv
13
+ privacy_policy: Vi respekterar ditt privatliv
12
14
  admin:
13
15
  inquiries:
14
- delete: Ta bort den här förfrågningen för alltid
16
+ delete: Ta bort den här förfrågan för alltid
15
17
  inquiry:
16
- read_inquiry: Läs förfrågningen
18
+ read_inquiry: Läs förfrågan
17
19
  said: said
18
20
  mark_as_spam: Märk som skräppost
19
21
  mark_as_ham: Flytta till inkorg
@@ -29,10 +31,10 @@ sv:
29
31
  details: Detaljer
30
32
  age: Ålder
31
33
  actions: Handlingar
32
- back_to_all_inquiries: Tillbaka till alla Förfrågningar
34
+ back_to_all_inquiries: Tillbaka till alla förfrågningar
33
35
  spam: Skräppost
34
36
  spam_yes: 'ja'
35
- inquiry: Förfrågning
37
+ inquiry: Förfrågan
36
38
  to: Till
37
39
  from: Från
38
40
  click_to_email: Klicka för att skicka e-post till den här adressen
@@ -65,7 +67,7 @@ sv:
65
67
  phone: Telefon
66
68
  message: Meddelande
67
69
  closing_line: Vänliga hälsningar
68
- ps: P.S. Alla dina förfrågningar sparas i "Förfrågningar"-sektionen av Refinery. Där kan du visa dem senare.
70
+ ps: P.S. Alla dina förfrågningar sparas i sektionen "Förfrågningar" av Refinery. Där kan du visa dem senare.
69
71
  activerecord:
70
72
  models:
71
73
  refinery/inquiries/inquiry: förfrågning
@@ -5,6 +5,8 @@ zh-CN:
5
5
  title: 咨询
6
6
  description: 提供一个联系表单与保存咨询
7
7
  inquiries:
8
+ config:
9
+ from_name: "%{name} [%{site_name}]"
8
10
  inquiries:
9
11
  new:
10
12
  send: 发送消息
data/config/routes.rb CHANGED
@@ -9,7 +9,7 @@ Refinery::Core::Engine.routes.draw do
9
9
  get :thank_you, :on => :collection
10
10
  end
11
11
 
12
- namespace :admin, :path => 'refinery' do
12
+ namespace :admin, :path => Refinery::Core.backend_route do
13
13
  resources :inquiries, :only => [:index, :show, :destroy] do
14
14
  get :spam, :on => :collection
15
15
  get :toggle_spam, :on => :member
data/db/seeds.rb CHANGED
@@ -5,7 +5,9 @@
5
5
  end if defined?(::Refinery::User)
6
6
 
7
7
  if defined?(::Refinery::Page)
8
- unless Refinery::Page.where(:link_url => '/contact').any?
8
+ contact_us_page = Refinery::Page.where(:link_url => '/contact').first
9
+
10
+ unless contact_us_page
9
11
  contact_us_page = ::Refinery::Page.create({
10
12
  :title => "Contact",
11
13
  :link_url => "/contact",
@@ -1,4 +1,16 @@
1
1
  Refinery::Inquiries.configure do |config|
2
2
  # Configure whether to show privacy link
3
3
  # config.show_contact_privacy_link = <%= Refinery::Inquiries.show_contact_privacy_link.inspect %>
4
+
5
+ # Configure whether to show phone number field
6
+ # config.show_phone_number_field = <%= Refinery::Inquiries.show_phone_number_field.inspect %>
7
+
8
+ # Configure whether to show form field placeholders
9
+ # config.show_placeholders = <%= Refinery::Inquiries.show_placeholders.inspect %>
10
+
11
+ # Configure whether inquiries marked as spam should also send a notification mail
12
+ # config.send_notifications_for_inquiries_marked_as_spam = <%= Refinery::Inquiries.send_notifications_for_inquiries_marked_as_spam.inspect %>
13
+
14
+ # Configure name in 'from' email address
15
+ # config.from_name = <%= Refinery::Inquiries.from_name.inspect %>
4
16
  end
@@ -1,6 +1,5 @@
1
1
  require 'refinerycms-core'
2
2
  require 'refinerycms-settings'
3
- require 'filters_spam'
4
3
 
5
4
  module Refinery
6
5
  autoload :InquiriesGenerator, 'generators/refinery/inquiries/inquiries_generator'
@@ -3,7 +3,15 @@ module Refinery
3
3
  include ActiveSupport::Configurable
4
4
 
5
5
  config_accessor :show_contact_privacy_link
6
+ config_accessor :show_phone_number_field
7
+ config_accessor :show_placeholders
8
+ config_accessor :send_notifications_for_inquiries_marked_as_spam
9
+ config_accessor :from_name
6
10
 
7
11
  self.show_contact_privacy_link = true
12
+ self.show_phone_number_field = true
13
+ self.show_placeholders = true
14
+ self.send_notifications_for_inquiries_marked_as_spam = false
15
+ self.from_name = "no-reply"
8
16
  end
9
17
  end
data/license.md CHANGED
@@ -1,17 +1,17 @@
1
1
  # MIT License
2
-
3
- Copyright (c) 2005-2010 [Resolve Digital Ltd.](http://www.resolvedigital.co.nz)
4
-
2
+
3
+ Copyright 2012 Uģis Ozols, Philip Arndt, and Rob Yurkowski
4
+
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
7
7
  in the Software without restriction, including without limitation the rights
8
8
  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
9
  copies of the Software, and to permit persons to whom the Software is
10
10
  furnished to do so, subject to the following conditions:
11
-
11
+
12
12
  The above copyright notice and this permission notice shall be included in all
13
13
  copies or substantial portions of the Software.
14
-
14
+
15
15
  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
16
  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
17
  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
data/readme.md CHANGED
@@ -18,7 +18,7 @@ To install the migrations, run:
18
18
 
19
19
  rails generate refinery:inquiries
20
20
  rake db:migrate
21
-
21
+
22
22
  Add pages to the database and you're done:
23
23
 
24
24
  rake db:seed
@@ -35,6 +35,10 @@ In summary you can:
35
35
 
36
36
  When inquiries come in, you and the customer are generally notified. As we implemented spam filtering through the [filters_spam plugin](https://github.com/resolve/filters_spam#readme) you will not get notified if an inquiry is marked as 'spam'.
37
37
 
38
+ ## How do I setup email to be sent from GMail, SendGrid or other service?
39
+
40
+ Inquiries uses `actionmailer` under the hood so you can refer to [Rails Action Mailer guide](http://guides.rubyonrails.org/action_mailer_basics.html). For example to use GMail see [Action Mailer Configuration for GMail](http://guides.rubyonrails.org/action_mailer_basics.html#action-mailer-configuration-for-gmail) guide.
41
+
38
42
  ## How do I get Notified?
39
43
 
40
44
  Go into your 'Inquiries' tab in the Refinery admin area and click on "Update who gets notified"
@@ -2,19 +2,19 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{refinerycms-inquiries}
5
- s.version = %q{2.0.3}
6
- s.date = "#{Date.today.strftime("%Y-%m-%d")}"
5
+ s.version = %q{2.1.0}
7
6
  s.summary = %q{Inquiry handling functionality for the Refinery CMS project.}
8
7
  s.description = %q{Inquiry handling functionality extracted from Refinery CMS to allow you to have a contact form and manage inquiries in the Refinery backend.}
9
8
  s.homepage = %q{http://refinerycms.com}
10
9
  s.email = %q{info@refinerycms.com}
11
- s.authors = ['Philip Arndt', 'Uģis Ozols', 'David Jones']
10
+ s.authors = ['Uģis Ozols', 'Philip Arndt', 'Rob Yurkowski']
12
11
  s.require_paths = %w(lib)
12
+ s.license = %q{MIT}
13
13
 
14
14
  s.files = `git ls-files`.split("\n")
15
15
  s.test_files = `git ls-files -- spec/*`.split("\n")
16
16
 
17
- s.add_dependency 'refinerycms-core', '~> 2.0.1'
18
- s.add_dependency 'refinerycms-settings', '~> 2.0.1'
17
+ s.add_dependency 'refinerycms-core', '~> 2.1.0'
18
+ s.add_dependency 'refinerycms-settings', '~> 2.1.0'
19
19
  s.add_dependency 'filters_spam', '~> 0.2'
20
20
  end
@@ -4,12 +4,13 @@ module Refinery
4
4
  module Inquiries
5
5
  module Admin
6
6
  describe Inquiry do
7
- login_refinery_user
7
+ refinery_login_with :refinery_user
8
8
 
9
9
  let!(:inquiry) do
10
- Factory(:inquiry, :name => "David Jones",
11
- :email => "dave@refinerycms.com",
12
- :message => "Hello, I really like your website. Was it hard to build and maintain or could anyone do it?")
10
+ FactoryGirl.create(:inquiry,
11
+ :name => "David Jones",
12
+ :email => "dave@refinerycms.com",
13
+ :message => "Hello, I really like your website. Was it hard to build and maintain or could anyone do it?")
13
14
  end
14
15
 
15
16
  context "when no" do
@@ -38,13 +39,13 @@ module Refinery
38
39
  specify "in the side pane" do
39
40
  within "#actions" do
40
41
  page.should have_content("Inbox")
41
- page.should have_selector("a[href='/refinery/inquiries']")
42
+ page.should have_selector("a[href='/#{Refinery::Core.backend_route}/inquiries']")
42
43
  page.should have_content("Spam")
43
- page.should have_selector("a[href='/refinery/inquiries/spam']")
44
+ page.should have_selector("a[href='/#{Refinery::Core.backend_route}/inquiries/spam']")
44
45
  page.should have_content("Update who gets notified")
45
- page.should have_selector("a[href*='/refinery/inquiries/settings/inquiry_notification_recipients/edit']")
46
+ page.should have_selector("a[href*='/#{Refinery::Core.backend_route}/inquiries/settings/inquiry_notification_recipients/edit']")
46
47
  page.should have_content("Edit confirmation email")
47
- page.should have_selector("a[href*='/refinery/inquiries/settings/inquiry_confirmation_body/edit']")
48
+ page.should have_selector("a[href*='/#{Refinery::Core.backend_route}/inquiries/settings/inquiry_confirmation_body/edit']")
48
49
  end
49
50
  end
50
51
  end
@@ -53,7 +54,7 @@ module Refinery
53
54
  it "shows inquiry list" do
54
55
  visit refinery.inquiries_admin_inquiries_path
55
56
 
56
- page.should have_content("David Jones said Hello, I really like your website. Was it hard to build ...")
57
+ page.should have_content("David Jones said Hello, I really like your website. Was it hard to build a...")
57
58
  end
58
59
  end
59
60
 
@@ -68,9 +69,9 @@ module Refinery
68
69
  within "#actions" do
69
70
  page.should have_content("Age")
70
71
  page.should have_content("Back to all Inquiries")
71
- page.should have_selector("a[href='/refinery/inquiries']")
72
+ page.should have_selector("a[href='/#{Refinery::Core.backend_route}/inquiries']")
72
73
  page.should have_content("Remove this inquiry forever")
73
- page.should have_selector("a[href='/refinery/inquiries/#{inquiry.id}']")
74
+ page.should have_selector("a[href='/#{Refinery::Core.backend_route}/inquiries/#{inquiry.id}']")
74
75
  end
75
76
  end
76
77
  end
@@ -97,7 +98,7 @@ module Refinery
97
98
  click_link "Spam (1)"
98
99
  end
99
100
 
100
- page.should have_content("David Jones said Hello, I really like your website. Was it hard to build ...")
101
+ page.should have_content("David Jones said Hello, I really like your website. Was it hard to build a...")
101
102
  end
102
103
  end
103
104
 
@@ -0,0 +1,145 @@
1
+ require "spec_helper"
2
+
3
+ module Refinery
4
+ module Inquiries
5
+ describe "inquiries" do
6
+ before(:each) do
7
+ # load in seeds we use in migration
8
+ Refinery::Inquiries::Engine.load_seed
9
+ end
10
+
11
+ context "when valid data" do
12
+ it "is successful" do
13
+ visit refinery.inquiries_new_inquiry_path
14
+
15
+ fill_in "Name", :with => "Ugis Ozols"
16
+ fill_in "Email", :with => "ugis.ozols@refinerycms.com"
17
+ fill_in "Message", :with => "Hey, I'm testing!"
18
+ click_button "Send message"
19
+
20
+ page.current_path.should == refinery.thank_you_inquiries_inquiries_path
21
+ page.should have_content("Thank You")
22
+
23
+ within "#body_content" do
24
+ page.should have_content("We've received your inquiry and will get back to you with a response shortly.")
25
+ page.should have_content("Return to the home page")
26
+ page.should have_selector("a[href='/']")
27
+ end
28
+
29
+ Refinery::Inquiries::Inquiry.count.should == 1
30
+ end
31
+ end
32
+
33
+ context "when invalid data" do
34
+ let(:name_error_message) { "Name can't be blank" }
35
+ let(:email_error_message) { "Email is invalid" }
36
+ let(:message_error_message) { "Message can't be blank" }
37
+
38
+ it "is not successful" do
39
+ visit refinery.inquiries_new_inquiry_path
40
+
41
+ click_button "Send message"
42
+
43
+ page.current_path.should == refinery.inquiries_new_inquiry_path
44
+ page.should have_content("There were problems with the following fields")
45
+ page.should have_content(name_error_message)
46
+ page.should have_content(email_error_message)
47
+ page.should have_content(message_error_message)
48
+ page.should have_no_content("Phone can't be blank")
49
+
50
+ Refinery::Inquiries::Inquiry.count.should == 0
51
+ end
52
+
53
+ it "displays the error messages in the same order as the fields" do
54
+ visit refinery.inquiries_new_inquiry_path
55
+
56
+ click_button "Send message"
57
+
58
+ page.should have_content(/#{name_error_message}.+#{email_error_message}.+#{message_error_message}/m)
59
+ end
60
+ end
61
+
62
+ describe "privacy" do
63
+ context "when show contact privacy link setting set to false" do
64
+ before(:each) do
65
+ Refinery::Inquiries.config.stub(:show_contact_privacy_link).and_return(false)
66
+ end
67
+
68
+ it "won't show link" do
69
+ visit refinery.inquiries_new_inquiry_path
70
+
71
+ page.should have_no_content("We value your privacy")
72
+ page.should have_no_selector("a[href='/pages/privacy-policy']")
73
+ end
74
+ end
75
+
76
+ context "when show contact privacy link setting set to true" do
77
+ before(:each) do
78
+ Refinery::Inquiries.config.stub(:show_contact_privacy_link).and_return(true)
79
+ end
80
+
81
+ it "shows the link" do
82
+ visit refinery.inquiries_new_inquiry_path
83
+
84
+ page.should have_content("We value your privacy")
85
+ page.should have_selector("a[href='/pages/privacy-policy']")
86
+ end
87
+ end
88
+ end
89
+
90
+ describe "palceholders" do
91
+ context "when show placeholders setting set to false" do
92
+ before(:each) do
93
+ Refinery::Inquiries.config.stub(:show_placeholders).and_return(false)
94
+ end
95
+
96
+ it "won't show placeholders" do
97
+ visit refinery.inquiries_new_inquiry_path
98
+
99
+ page.should have_no_selector("input[placeholder]")
100
+ end
101
+ end
102
+
103
+ context "when show placeholders setting set to true" do
104
+ before(:each) do
105
+ Refinery::Inquiries.config.stub(:show_placeholders).and_return(true)
106
+ end
107
+
108
+ it "shows the placeholders" do
109
+ visit refinery.inquiries_new_inquiry_path
110
+
111
+ page.should have_selector("input[placeholder]")
112
+ end
113
+ end
114
+ end
115
+
116
+ describe "phone number" do
117
+ context "when show phone numbers setting set to false" do
118
+ before(:each) do
119
+ Refinery::Inquiries.config.stub(:show_phone_number_field).and_return(false)
120
+ end
121
+
122
+ it "won't show phone number" do
123
+ visit refinery.inquiries_new_inquiry_path
124
+
125
+ page.should have_no_selector("label", :text => 'Phone')
126
+ page.should have_no_selector("#inquiry_phone")
127
+ end
128
+ end
129
+
130
+ context "when show phone numbers setting set to true" do
131
+ before(:each) do
132
+ Refinery::Inquiries.config.stub(:show_phone_number_field).and_return(true)
133
+ end
134
+
135
+ it "shows the phone number" do
136
+ visit refinery.inquiries_new_inquiry_path
137
+
138
+ page.should have_selector("label", :text => 'Phone')
139
+ page.should have_selector("#inquiry_phone")
140
+ end
141
+ end
142
+ end
143
+ end
144
+ end
145
+ end