refinerycms-inquiries 2.0.3 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +4 -1
- data/.travis.yml +14 -6
- data/Gemfile +26 -53
- data/Rakefile +2 -0
- data/app/controllers/refinery/inquiries/admin/inquiries_controller.rb +1 -1
- data/app/controllers/refinery/inquiries/inquiries_controller.rb +1 -1
- data/app/helpers/refinery/inquiries/inquiries_helper.rb +2 -2
- data/app/mailers/refinery/inquiries/inquiry_mailer.rb +11 -4
- data/app/models/refinery/inquiries/inquiry.rb +5 -4
- data/app/views/refinery/inquiries/admin/inquiries/_inquiry.html.erb +4 -2
- data/app/views/refinery/inquiries/admin/inquiries/_submenu.html.erb +1 -1
- data/app/views/refinery/inquiries/admin/inquiries/index.html.erb +2 -2
- data/app/views/refinery/inquiries/admin/inquiries/show.html.erb +3 -1
- data/app/views/refinery/inquiries/admin/settings/_confirmation_email_form.html.erb +1 -1
- data/app/views/refinery/inquiries/admin/settings/edit.html.erb +2 -2
- data/app/views/refinery/inquiries/inquiries/new.html.erb +19 -9
- data/app/views/refinery/inquiries/inquiries/thank_you.html.erb +1 -1
- data/app/views/refinery/inquiries/inquiry_mailer/confirmation.text.erb +1 -1
- data/app/views/refinery/inquiries/inquiry_mailer/notification.text.erb +2 -2
- data/config/locales/bg.yml +2 -0
- data/config/locales/cs.yml +2 -0
- data/config/locales/da.yml +2 -1
- data/config/locales/de.yml +2 -0
- data/config/locales/en-GB.yml +2 -0
- data/config/locales/en.yml +2 -0
- data/config/locales/es.yml +2 -0
- data/config/locales/fr.yml +2 -0
- data/config/locales/it.yml +3 -1
- data/config/locales/lt.yml +2 -0
- data/config/locales/lv.yml +2 -1
- data/config/locales/nb.yml +2 -0
- data/config/locales/nl.yml +2 -0
- data/config/locales/pl.yml +2 -0
- data/config/locales/pt-BR.yml +2 -0
- data/config/locales/ru.yml +2 -0
- data/config/locales/sk.yml +2 -0
- data/config/locales/sl.yml +2 -0
- data/config/locales/sv.yml +8 -6
- data/config/locales/zh-CN.yml +2 -0
- data/config/routes.rb +1 -1
- data/db/seeds.rb +3 -1
- data/lib/generators/refinery/inquiries/templates/config/initializers/refinery/inquiries.rb.erb +12 -0
- data/lib/refinery/inquiries.rb +0 -1
- data/lib/refinery/inquiries/configuration.rb +8 -0
- data/license.md +5 -5
- data/readme.md +5 -1
- data/refinerycms-inquiries.gemspec +5 -5
- data/spec/{requests → features}/refinery/inquiries/admin/inquiries_spec.rb +13 -12
- data/spec/features/refinery/inquiries/inquiries_spec.rb +145 -0
- data/spec/features/refinery/inquiries/mailer_spec.rb +41 -0
- data/spec/models/refinery/inquiries/inquiry_spec.rb +9 -9
- data/spec/spec_helper.rb +18 -44
- metadata +21 -28
- data/Guardfile +0 -20
- data/config/locales/lolcat.yml +0 -78
- data/spec/requests/refinery/inquiries/inquiries_spec.rb +0 -81
@@ -0,0 +1,41 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
require "capybara/email/rspec"
|
3
|
+
|
4
|
+
module Refinery
|
5
|
+
module Inquiries
|
6
|
+
describe "mailer" do
|
7
|
+
before do
|
8
|
+
FactoryGirl.create(:page, :link_url => "/contact")
|
9
|
+
|
10
|
+
Refinery::Inquiries::Setting.stub(:notification_recipients).and_return("rspec@refinerycms.com")
|
11
|
+
|
12
|
+
clear_emails
|
13
|
+
|
14
|
+
visit refinery.inquiries_new_inquiry_path
|
15
|
+
|
16
|
+
fill_in "Name", :with => "Ugis Ozols"
|
17
|
+
fill_in "Email", :with => "ugis.ozols@refinerycms.com"
|
18
|
+
fill_in "Message", :with => "Hey, I'm testing!"
|
19
|
+
click_button "Send message"
|
20
|
+
end
|
21
|
+
|
22
|
+
it "sends confirmation email" do
|
23
|
+
open_email("ugis.ozols@refinerycms.com")
|
24
|
+
|
25
|
+
current_email.from.should eq("Ugis Ozols [#{Refinery::Core.site_name}] <#{Refinery::Inquiries.from_name}@example.com>")
|
26
|
+
current_email.to.should eq(["ugis.ozols@refinerycms.com"])
|
27
|
+
current_email.subject.should eq("Thank you for your inquiry")
|
28
|
+
current_email.body.should eq("Thank you for your inquiry Ugis Ozols,\n\nThis email is a receipt to confirm we have received your inquiry and we'll be in touch shortly.\n\nThanks.")
|
29
|
+
end
|
30
|
+
|
31
|
+
it "sends notification email" do
|
32
|
+
open_email("rspec@refinerycms.com")
|
33
|
+
|
34
|
+
current_email.from.should eq("Ugis Ozols [#{Refinery::Core.site_name}] <#{Refinery::Inquiries.from_name}@example.com>")
|
35
|
+
current_email.to.should eq(["rspec@refinerycms.com"])
|
36
|
+
current_email.subject.should eq("New inquiry from your website")
|
37
|
+
current_email.body.should eq("Hi there,\n\nYou just received a new inquiry on your website.\n\n--- inquiry starts ---\n\nFrom: Ugis Ozols\nEmail: ugis.ozols@refinerycms.com\nPhone: \nMessage:\nHey, I'm testing!\n\n--- inquiry ends ---\n\nKind Regards,\nCompany Name\n\nP.S. All your inquiries are stored in the \"Inquiries\" section of Refinery should you ever want to view it later there.")
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -5,10 +5,10 @@ module Refinery
|
|
5
5
|
describe Inquiry do
|
6
6
|
describe "validations" do
|
7
7
|
subject do
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
8
|
+
FactoryGirl.build(:inquiry,
|
9
|
+
:name => "Ugis Ozols",
|
10
|
+
:email => "ugis.ozols@refinerycms.com",
|
11
|
+
:message => "Hey, I'm testing!")
|
12
12
|
end
|
13
13
|
|
14
14
|
it { should be_valid }
|
@@ -20,8 +20,8 @@ module Refinery
|
|
20
20
|
|
21
21
|
describe "default scope" do
|
22
22
|
it "orders by created_at in desc" do
|
23
|
-
inquiry1 =
|
24
|
-
inquiry2 =
|
23
|
+
inquiry1 = FactoryGirl.create(:inquiry, :created_at => 1.hour.ago)
|
24
|
+
inquiry2 = FactoryGirl.create(:inquiry, :created_at => 2.hours.ago)
|
25
25
|
inquiries = Refinery::Inquiries::Inquiry.all
|
26
26
|
inquiries.first.should == inquiry1
|
27
27
|
inquiries.second.should == inquiry2
|
@@ -30,19 +30,19 @@ module Refinery
|
|
30
30
|
|
31
31
|
describe ".latest" do
|
32
32
|
it "returns latest 7 non-spam inquiries by default" do
|
33
|
-
8.times {
|
33
|
+
8.times { FactoryGirl.create(:inquiry) }
|
34
34
|
Refinery::Inquiries::Inquiry.last.toggle!(:spam)
|
35
35
|
Refinery::Inquiries::Inquiry.latest.length.should == 7
|
36
36
|
end
|
37
37
|
|
38
38
|
it "returns latest 7 inquiries including spam ones" do
|
39
|
-
7.times {
|
39
|
+
7.times { FactoryGirl.create(:inquiry) }
|
40
40
|
Refinery::Inquiries::Inquiry.all[0..2].each { |inquiry| inquiry.toggle!(:spam) }
|
41
41
|
Refinery::Inquiries::Inquiry.latest(7, true).length.should == 7
|
42
42
|
end
|
43
43
|
|
44
44
|
it "returns latest n inquiries" do
|
45
|
-
4.times {
|
45
|
+
4.times { FactoryGirl.create(:inquiry) }
|
46
46
|
Refinery::Inquiries::Inquiry.latest(3).length.should == 3
|
47
47
|
end
|
48
48
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,53 +1,27 @@
|
|
1
1
|
require 'rubygems'
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
ENV["RAILS_ENV"] ||= 'test'
|
3
|
+
# Configure Rails Environment
|
4
|
+
ENV["RAILS_ENV"] ||= 'test'
|
6
5
|
|
7
|
-
|
6
|
+
require File.expand_path("../dummy/config/environment", __FILE__)
|
8
7
|
|
9
|
-
|
10
|
-
|
11
|
-
|
8
|
+
require 'rspec/rails'
|
9
|
+
require 'capybara/rspec'
|
10
|
+
require 'factory_girl_rails'
|
12
11
|
|
13
|
-
|
12
|
+
Rails.backtrace_cleaner.remove_silencers!
|
14
13
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
end
|
14
|
+
RSpec.configure do |config|
|
15
|
+
config.mock_with :rspec
|
16
|
+
config.treat_symbols_as_metadata_keys_with_true_values = true
|
17
|
+
config.filter_run :focus => true
|
18
|
+
config.run_all_when_everything_filtered = true
|
21
19
|
end
|
22
20
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
# in ./support/ and its subdirectories including factories.
|
30
|
-
([Rails.root.to_s] | ::Refinery::Plugins.registered.pathnames).map{|p|
|
31
|
-
Dir[File.join(p, 'spec', 'support', '**', '*.rb').to_s]
|
32
|
-
}.flatten.sort.each do |support_file|
|
33
|
-
require support_file
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
# If spork is available in the Gemfile it'll be used but we don't force it.
|
38
|
-
unless (begin; require 'spork'; rescue LoadError; nil end).nil?
|
39
|
-
Spork.prefork do
|
40
|
-
# Loading more in this block will cause your tests to run faster. However,
|
41
|
-
# if you change any configuration or code from libraries loaded here, you'll
|
42
|
-
# need to restart spork for it take effect.
|
43
|
-
setup_environment
|
44
|
-
end
|
45
|
-
|
46
|
-
Spork.each_run do
|
47
|
-
# This code will be run each time you run your specs.
|
48
|
-
each_run
|
49
|
-
end
|
50
|
-
else
|
51
|
-
setup_environment
|
52
|
-
each_run
|
21
|
+
# Requires supporting files with custom matchers and macros, etc,
|
22
|
+
# in ./support/ and its subdirectories including factories.
|
23
|
+
([Rails.root.to_s] | ::Refinery::Plugins.registered.pathnames).map{|p|
|
24
|
+
Dir[File.join(p, 'spec', 'support', '**', '*.rb').to_s]
|
25
|
+
}.flatten.sort.each do |support_file|
|
26
|
+
require support_file
|
53
27
|
end
|
metadata
CHANGED
@@ -1,54 +1,48 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: refinerycms-inquiries
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0
|
5
|
-
prerelease:
|
4
|
+
version: 2.1.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
|
-
- Philip Arndt
|
9
7
|
- Uģis Ozols
|
10
|
-
-
|
8
|
+
- Philip Arndt
|
9
|
+
- Rob Yurkowski
|
11
10
|
autorequire:
|
12
11
|
bindir: bin
|
13
12
|
cert_chain: []
|
14
|
-
date:
|
13
|
+
date: 2013-12-11 00:00:00.000000000 Z
|
15
14
|
dependencies:
|
16
15
|
- !ruby/object:Gem::Dependency
|
17
16
|
name: refinerycms-core
|
18
17
|
requirement: !ruby/object:Gem::Requirement
|
19
|
-
none: false
|
20
18
|
requirements:
|
21
19
|
- - ~>
|
22
20
|
- !ruby/object:Gem::Version
|
23
|
-
version: 2.0
|
21
|
+
version: 2.1.0
|
24
22
|
type: :runtime
|
25
23
|
prerelease: false
|
26
24
|
version_requirements: !ruby/object:Gem::Requirement
|
27
|
-
none: false
|
28
25
|
requirements:
|
29
26
|
- - ~>
|
30
27
|
- !ruby/object:Gem::Version
|
31
|
-
version: 2.0
|
28
|
+
version: 2.1.0
|
32
29
|
- !ruby/object:Gem::Dependency
|
33
30
|
name: refinerycms-settings
|
34
31
|
requirement: !ruby/object:Gem::Requirement
|
35
|
-
none: false
|
36
32
|
requirements:
|
37
33
|
- - ~>
|
38
34
|
- !ruby/object:Gem::Version
|
39
|
-
version: 2.0
|
35
|
+
version: 2.1.0
|
40
36
|
type: :runtime
|
41
37
|
prerelease: false
|
42
38
|
version_requirements: !ruby/object:Gem::Requirement
|
43
|
-
none: false
|
44
39
|
requirements:
|
45
40
|
- - ~>
|
46
41
|
- !ruby/object:Gem::Version
|
47
|
-
version: 2.0
|
42
|
+
version: 2.1.0
|
48
43
|
- !ruby/object:Gem::Dependency
|
49
44
|
name: filters_spam
|
50
45
|
requirement: !ruby/object:Gem::Requirement
|
51
|
-
none: false
|
52
46
|
requirements:
|
53
47
|
- - ~>
|
54
48
|
- !ruby/object:Gem::Version
|
@@ -56,7 +50,6 @@ dependencies:
|
|
56
50
|
type: :runtime
|
57
51
|
prerelease: false
|
58
52
|
version_requirements: !ruby/object:Gem::Requirement
|
59
|
-
none: false
|
60
53
|
requirements:
|
61
54
|
- - ~>
|
62
55
|
- !ruby/object:Gem::Version
|
@@ -71,7 +64,6 @@ files:
|
|
71
64
|
- .gitignore
|
72
65
|
- .travis.yml
|
73
66
|
- Gemfile
|
74
|
-
- Guardfile
|
75
67
|
- Rakefile
|
76
68
|
- app/assets/stylesheets/refinery/inquiries/inquiries.css.scss
|
77
69
|
- app/controllers/refinery/inquiries/admin/inquiries_controller.rb
|
@@ -101,7 +93,6 @@ files:
|
|
101
93
|
- config/locales/es.yml
|
102
94
|
- config/locales/fr.yml
|
103
95
|
- config/locales/it.yml
|
104
|
-
- config/locales/lolcat.yml
|
105
96
|
- config/locales/lt.yml
|
106
97
|
- config/locales/lv.yml
|
107
98
|
- config/locales/nb.yml
|
@@ -126,39 +117,41 @@ files:
|
|
126
117
|
- readme.md
|
127
118
|
- refinerycms-inquiries.gemspec
|
128
119
|
- spec/factories/inquiry.rb
|
120
|
+
- spec/features/refinery/inquiries/admin/inquiries_spec.rb
|
121
|
+
- spec/features/refinery/inquiries/inquiries_spec.rb
|
122
|
+
- spec/features/refinery/inquiries/mailer_spec.rb
|
129
123
|
- spec/models/refinery/inquiries/inquiry_spec.rb
|
130
|
-
- spec/requests/refinery/inquiries/admin/inquiries_spec.rb
|
131
|
-
- spec/requests/refinery/inquiries/inquiries_spec.rb
|
132
124
|
- spec/spec_helper.rb
|
133
125
|
- tasks/rspec.rake
|
134
126
|
homepage: http://refinerycms.com
|
135
|
-
licenses:
|
127
|
+
licenses:
|
128
|
+
- MIT
|
129
|
+
metadata: {}
|
136
130
|
post_install_message:
|
137
131
|
rdoc_options: []
|
138
132
|
require_paths:
|
139
133
|
- lib
|
140
134
|
required_ruby_version: !ruby/object:Gem::Requirement
|
141
|
-
none: false
|
142
135
|
requirements:
|
143
|
-
- -
|
136
|
+
- - '>='
|
144
137
|
- !ruby/object:Gem::Version
|
145
138
|
version: '0'
|
146
139
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
147
|
-
none: false
|
148
140
|
requirements:
|
149
|
-
- -
|
141
|
+
- - '>='
|
150
142
|
- !ruby/object:Gem::Version
|
151
143
|
version: '0'
|
152
144
|
requirements: []
|
153
145
|
rubyforge_project:
|
154
|
-
rubygems_version: 1.
|
146
|
+
rubygems_version: 2.1.0
|
155
147
|
signing_key:
|
156
|
-
specification_version:
|
148
|
+
specification_version: 4
|
157
149
|
summary: Inquiry handling functionality for the Refinery CMS project.
|
158
150
|
test_files:
|
159
151
|
- spec/factories/inquiry.rb
|
152
|
+
- spec/features/refinery/inquiries/admin/inquiries_spec.rb
|
153
|
+
- spec/features/refinery/inquiries/inquiries_spec.rb
|
154
|
+
- spec/features/refinery/inquiries/mailer_spec.rb
|
160
155
|
- spec/models/refinery/inquiries/inquiry_spec.rb
|
161
|
-
- spec/requests/refinery/inquiries/admin/inquiries_spec.rb
|
162
|
-
- spec/requests/refinery/inquiries/inquiries_spec.rb
|
163
156
|
- spec/spec_helper.rb
|
164
157
|
has_rdoc:
|
data/Guardfile
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
guard 'rspec', :version => 2, :cli => "--color" do
|
2
|
-
watch(%r{^spec/.+_spec\.rb$})
|
3
|
-
watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
|
4
|
-
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
|
5
|
-
watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/controllers/#{m[1]}_#{m[2]}_spec.rb", "spec/requests/#{m[1]}_spec.rb"] }
|
6
|
-
watch(%r{^spec/support/(.+)\.rb$}) { "spec" }
|
7
|
-
watch('spec/spec_helper.rb') { "spec" }
|
8
|
-
watch('config/routes.rb') { "spec/routing" }
|
9
|
-
watch('app/controllers/application_controller.rb') { "spec/controllers" }
|
10
|
-
# Capybara request specs
|
11
|
-
watch(%r{^app/views/(.+)/.*\.(erb|haml)$}) { |m| "spec/requests/#{m[1]}_spec.rb" }
|
12
|
-
end
|
13
|
-
|
14
|
-
guard 'spork', :wait => 60, :cucumber => false, :rspec_env => { 'RAILS_ENV' => 'test' } do
|
15
|
-
watch('config/application.rb')
|
16
|
-
watch('config/environment.rb')
|
17
|
-
watch(%r{^config/environments/.+\.rb$})
|
18
|
-
watch(%r{^config/initializers/.+\.rb$})
|
19
|
-
watch('spec/spec_helper.rb')
|
20
|
-
end
|
data/config/locales/lolcat.yml
DELETED
@@ -1,78 +0,0 @@
|
|
1
|
-
lolcat:
|
2
|
-
refinery:
|
3
|
-
plugins:
|
4
|
-
refinerycms_inquiries:
|
5
|
-
title: INQUIRIEZ
|
6
|
-
description: PROVIDEZ CONTACT FORM AN STOREZ INQUIRIEZ
|
7
|
-
inquiries:
|
8
|
-
inquiries:
|
9
|
-
new:
|
10
|
-
send: SEND MESAGE
|
11
|
-
privacy_policy: WE VALUE UR PRIVACY
|
12
|
-
admin:
|
13
|
-
inquiries:
|
14
|
-
delete: REMOOV DIS INQUIRY FOREVR
|
15
|
-
inquiry:
|
16
|
-
read_inquiry: READ TEH INQUIRY
|
17
|
-
said: SED
|
18
|
-
mark_as_spam: MARK AS SPAM
|
19
|
-
mark_as_ham: MOOV 2 INBOX
|
20
|
-
submenu:
|
21
|
-
inbox: INBOX
|
22
|
-
spam: SPAM
|
23
|
-
update_notified: UPDATE HOO GETS NOTIFID
|
24
|
-
edit_confirmation_email: EDIT CONFIRMASHUN EMAIL
|
25
|
-
index:
|
26
|
-
no_inquiries: U HAS NOT RECEIVD ANY INQUIRIEZ YET.
|
27
|
-
no_spam: HOORAH! U DOAN HAS ANY SPAM.
|
28
|
-
show:
|
29
|
-
details: DETAILS
|
30
|
-
age: AGE
|
31
|
-
actions: ACSHUNS
|
32
|
-
back_to_all_inquiries: BAK 2 ALL INQUIRIEZ
|
33
|
-
spam: SPAM
|
34
|
-
spam_yes: YEZ
|
35
|
-
inquiry: INQUIRY
|
36
|
-
to: 2
|
37
|
-
from: FRUM
|
38
|
-
click_to_email: CLICK 2 EMAIL DIS ADDRES
|
39
|
-
phone: FONE
|
40
|
-
date: DATE
|
41
|
-
message: MESAGE
|
42
|
-
settings:
|
43
|
-
notification_recipients_form:
|
44
|
-
inquiry_settings_value_name: SEND NOTIFICASHUNS 2
|
45
|
-
explanation: EVRY TIEM SOMEONE CONTACTS U ON UR WEBSIET, REFINERY SENDZ OUT AN EMAIL 2 SAY THAR IZ NEW INQUIRY.
|
46
|
-
hint: WHEN NEW INQUIRY IZ SUBMITTD, REFINERY WILL SEND AN EMAIL NOTIFICASHUN 2 U.
|
47
|
-
example: "ENTR UR EMAIL ADDRES(EZ) LIEK: JACK@WERK.COM, JILL@OFFICE.COM"
|
48
|
-
confirmation_email_form:
|
49
|
-
to: 2
|
50
|
-
from: FRUM
|
51
|
-
subject: SUBJECT
|
52
|
-
click_to_edit_subject: CLICK HER 2 EDIT TEH SUBJECT
|
53
|
-
explanation: EVRY TIEM SOMEONE CONTACTS U ON UR WEBSIET, REFINERY SENDZ OUT AN EMAIL 2 CONFIRM TEH INQUIRY WIF TEH PERSON HOO MADE IT.
|
54
|
-
below_edit_email_sent: BELOW U CAN EDIT TEH EMAIL DAT IZ SENT OUT.
|
55
|
-
the_customer_making_inquiry: TEH CUSTOMR MAKIN TEH INQUIRY
|
56
|
-
message: MESAGE
|
57
|
-
note: "Note: PLACE TEH TEXT %NAYM% WER UD LIEK TEH CUSTOMERS NAYM 2 APPEAR IN DA EMAIL"
|
58
|
-
inquiry_mailer:
|
59
|
-
notification:
|
60
|
-
greeting: OH HAI THAR
|
61
|
-
you_recieved_new_inquiry: U JUS RECEIVD NEW INQUIRY ON UR WEBSIET.
|
62
|
-
inquiry_starts: --- INQUIRY STARTS ---
|
63
|
-
inquiry_ends: --- INQUIRY ENDZ ---
|
64
|
-
from: FRUM
|
65
|
-
email: EMAIL
|
66
|
-
phone: FONE
|
67
|
-
message: MESAGE
|
68
|
-
closing_line: KIND REGARDZ
|
69
|
-
ps: P.S. ALL UR INQUIRIEZ R STORD IN DA "INQUIRIEZ" SECSHUN OV REFINERY SHUD U EVR WANTS 2 VIEW IT LATR THAR.
|
70
|
-
activerecord:
|
71
|
-
models:
|
72
|
-
refinery/inquiries/inquiry: INQUIRY
|
73
|
-
attributes:
|
74
|
-
refinery/inquiries/inquiry:
|
75
|
-
name: NAYM
|
76
|
-
email: EMAIL
|
77
|
-
phone: FONE
|
78
|
-
message: MESAGE
|
@@ -1,81 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
module Refinery
|
4
|
-
module Inquiries
|
5
|
-
describe "inquiries" do
|
6
|
-
before(:each) do
|
7
|
-
Factory(:refinery_user)
|
8
|
-
|
9
|
-
# load in seeds we use in migration
|
10
|
-
Refinery::Inquiries::Engine.load_seed
|
11
|
-
end
|
12
|
-
|
13
|
-
context "when valid data" do
|
14
|
-
it "is successful" do
|
15
|
-
visit refinery.inquiries_new_inquiry_path
|
16
|
-
|
17
|
-
fill_in "Name", :with => "Ugis Ozols"
|
18
|
-
fill_in "Email", :with => "ugis.ozols@refinerycms.com"
|
19
|
-
fill_in "Message", :with => "Hey, I'm testing!"
|
20
|
-
click_button "Send message"
|
21
|
-
|
22
|
-
page.current_path.should == refinery.thank_you_inquiries_inquiries_path
|
23
|
-
page.should have_content("Thank You")
|
24
|
-
|
25
|
-
within "#body_content" do
|
26
|
-
page.should have_content("We've received your inquiry and will get back to you with a response shortly.")
|
27
|
-
page.should have_content("Return to the home page")
|
28
|
-
page.should have_selector("a[href='/']")
|
29
|
-
end
|
30
|
-
|
31
|
-
Refinery::Inquiries::Inquiry.count.should == 1
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
context "when invalid data" do
|
36
|
-
it "is not successful" do
|
37
|
-
visit refinery.inquiries_new_inquiry_path
|
38
|
-
|
39
|
-
click_button "Send message"
|
40
|
-
|
41
|
-
page.current_path.should == refinery.inquiries_new_inquiry_path
|
42
|
-
page.should have_content("There were problems with the following fields")
|
43
|
-
page.should have_content("Name can't be blank")
|
44
|
-
page.should have_content("Email is invalid")
|
45
|
-
page.should have_content("Message can't be blank")
|
46
|
-
page.should have_no_content("Phone can't be blank")
|
47
|
-
|
48
|
-
Refinery::Inquiries::Inquiry.count.should == 0
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
describe "privacy" do
|
53
|
-
context "when show contact privacy link setting set to false" do
|
54
|
-
before(:each) do
|
55
|
-
Refinery::Inquiries.stub(:show_contact_privacy_link).and_return(false)
|
56
|
-
end
|
57
|
-
|
58
|
-
it "won't show link" do
|
59
|
-
visit refinery.inquiries_new_inquiry_path
|
60
|
-
|
61
|
-
page.should have_no_content("We value your privacy")
|
62
|
-
page.should have_no_selector("a[href='/pages/privacy-policy']")
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
context "when show contact privacy link setting set to true" do
|
67
|
-
before(:each) do
|
68
|
-
Refinery::Inquiries.config.stub(:show_contact_privacy_link).and_return(true)
|
69
|
-
end
|
70
|
-
|
71
|
-
it "shows the link" do
|
72
|
-
visit refinery.inquiries_new_inquiry_path
|
73
|
-
|
74
|
-
page.should have_content("We value your privacy")
|
75
|
-
page.should have_selector("a[href='/pages/privacy-policy']")
|
76
|
-
end
|
77
|
-
end
|
78
|
-
end
|
79
|
-
end
|
80
|
-
end
|
81
|
-
end
|