contact_us 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ba36fc9da764d196d589ccd4fb72823e5ec51cba
4
- data.tar.gz: 6431ccbdf97fc5753f0d066c308d6968fdb93482
3
+ metadata.gz: 25ce3fc3f61176e4316093a69ae09512d69e4a99
4
+ data.tar.gz: d0928b97ea89efb8689f0701b0e36cb7e95a6749
5
5
  SHA512:
6
- metadata.gz: ccdec238e8ac1e598643d3762e77f0340e8afa01e1991747d1f32a7e08ec395525dd5cad424c08af20e46788a99d946d68a68fba76b1f1fc7dc3dd71b97a0ba7
7
- data.tar.gz: 074cf4a5486906b27c5cdfdb327b44ca66254db49175c475401204b6620b2dc072d9f14f4e9d6ff3b5812503eefd07929883bd59ddeeb6f6a072b0c036a95cbc
6
+ metadata.gz: a7bcd8411ea722451e81c8358ef20ab0d32599747a3b2ea9c606286b32b4863faef3ec5728f24feb719017137039f3805965b1c3165e6faf0beef59efae38db2
7
+ data.tar.gz: 8cb4ef14ed3f465becd3271acdb2da7c3a0d19f44fd49996ef45be716476ace326d872cdecac5cf6d1edf1bec319744e51752e8c6f9873124b5059288460d072
data/.rspec CHANGED
@@ -1,5 +1,5 @@
1
1
  --color
2
- --format=nested
2
+ --format=documentation
3
3
  --backtrace
4
4
  --profile
5
5
  --order random
data/.travis.yml CHANGED
@@ -1,8 +1,8 @@
1
1
  script: "bundle exec rspec spec"
2
2
  rvm:
3
- - 1.9.3
4
- - 2.0.0
5
- - 2.1.2
3
+ - 2.0
4
+ - 2.1
5
+ - 2.2
6
6
  - ruby-head
7
7
  language: ruby
8
8
  matrix:
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## ContactUs 1.0.1 (April 6th 2015)
2
+
3
+ * Add Traditional Chinese zh-TW translations. [yuchunc]
4
+
1
5
  ## ContactUs 1.0.0 (Jan 15th 2015)
2
6
 
3
7
  * Fix Rails 4.2 deliver_later deprecation.
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Contact Us [![Build Status](https://secure.travis-ci.org/jdutil/contact_us.png)](http://travis-ci.org/jdutil/contact_us) [![Dependency Status](https://gemnasium.com/jdutil/contact_us.png?travis)](https://gemnasium.com/jdutil/contact_us) [![Click here to lend your support to: ContactUs and make a donation at www.pledgie.com !](http://www.pledgie.com/campaigns/16807.png?skin_name=chrome)][pledgie]
1
+ # Contact Us [![Build Status](https://secure.travis-ci.org/JDutil/contact_us.png)](http://travis-ci.org/JDutil/contact_us) [![Dependency Status](https://gemnasium.com/jdutil/contact_us.png?travis)](https://gemnasium.com/jdutil/contact_us) [![Click here to lend your support to: ContactUs and make a donation at www.pledgie.com !](http://www.pledgie.com/campaigns/16807.png?skin_name=chrome)][pledgie]
2
2
  A Rails 3+ Engine providing a basic contact form.
3
3
 
4
4
  [travis]: http://travis-ci.org/jdutil/contact_us
@@ -7,7 +7,7 @@ A Rails 3+ Engine providing a basic contact form.
7
7
 
8
8
  There is also a demo application showing how the ContactUs form works:
9
9
 
10
- * [View Demo Form In Action](http://contact-us-demo.heroku.com)
10
+ * [View Demo Form In Action](http://contact-us-demo.herokuapp.com)
11
11
  * [View Demo Applications Source Code](http://github.com/jdutil/contact_us_demo)
12
12
 
13
13
  ## REQUIREMENTS
@@ -24,7 +24,7 @@ It is also recommended to use Formtastic or SimpleForm (see configuration) in or
24
24
  In your `Gemfile`, add the following dependencies:
25
25
 
26
26
  ```ruby
27
- gem 'contact_us', '~> 0.5.1'
27
+ gem 'contact_us', '~> 1.0.1'
28
28
  ```
29
29
 
30
30
  From `Rails.root` in your Terminal run:
@@ -127,7 +127,7 @@ Visit your website and navigate to `/contact-us` to see the form in action.
127
127
 
128
128
  Contact Us has 100% test coverage, and provides simple integration specs you can drop directly into your apps test suite if you use RSpec & Capybara.
129
129
 
130
- Simply copy the `spec/integration/contact_us_lint_spec.rb` file, and add it to your integration specs.
130
+ Simply copy the `spec/integration/contact_us_lint_spec.rb` file, and add it to your integration specs.
131
131
 
132
132
  ## ISSUES
133
133
 
@@ -0,0 +1,22 @@
1
+ zh:
2
+ contact_us:
3
+ contact_mailer:
4
+ contact_email:
5
+ sent_by_contact_form: "由【聯絡我們】頁發送 %{email}"
6
+ sent_by_name: "由 %{name} 寄出 從 %{email}"
7
+ subject: "由 %{email} 寄出的訊息"
8
+ contacts:
9
+ new: &new
10
+ contact_us: "聯絡我們"
11
+ email: "電子郵件"
12
+ message: "訊息"
13
+ name: "姓名"
14
+ subject: "主題"
15
+ submit: "發送"
16
+ new_formtastic:
17
+ <<: *new
18
+ new_simple_form:
19
+ <<: *new
20
+ notices:
21
+ error: "請檢查是否正確填寫所有欄位。"
22
+ success: "訊息已成功送出。"
data/contact_us.gemspec CHANGED
@@ -20,7 +20,7 @@ Gem::Specification.new do |s|
20
20
  s.require_paths = ["lib"]
21
21
 
22
22
  s.add_development_dependency "capybara", "~> 2.0"
23
- s.add_development_dependency "rspec-rails", "~> 2.99"
23
+ s.add_development_dependency "rspec-rails", "~> 3.1"
24
24
  s.add_development_dependency "shoulda-matchers", ">= 1.5.4"
25
25
  s.add_development_dependency "simplecov", "~> 0.7"
26
26
  s.add_development_dependency "sqlite3", "~> 1.3.5"
@@ -1,3 +1,3 @@
1
1
  module ContactUs
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  end
@@ -11,25 +11,25 @@ describe ContactUs::ContactsController do
11
11
  it 'should redirect with success message if valid contact' do
12
12
  ContactUs.success_redirect = nil
13
13
  post :create, :contact_us_contact => { :email => 'test@test.com', :message => 'test' }
14
- assigns(:contact).valid?.should eql(true)
15
- flash[:notice].should eql('Contact email was successfully sent.')
16
- response.should redirect_to('/')
14
+ expect(assigns(:contact).valid?).to eql(true)
15
+ expect(flash[:notice]).to eql('Contact email was successfully sent.')
16
+ expect(response).to redirect_to('/')
17
17
  end
18
18
 
19
19
  it 'should redirect to custom URL with success message if valid contact' do
20
20
  ContactUs.success_redirect = '/success'
21
21
  post :create, :contact_us_contact => { :email => 'test@test.com', :message => 'test' }
22
- assigns(:contact).valid?.should eql(true)
23
- flash[:notice].should eql('Contact email was successfully sent.')
24
- response.should redirect_to('/success')
22
+ expect(assigns(:contact).valid?).to eql(true)
23
+ expect(flash[:notice]).to eql('Contact email was successfully sent.')
24
+ expect(response).to redirect_to('/success')
25
25
  ContactUs.success_redirect = '/'
26
26
  end
27
27
 
28
28
  it 'should render new with error message if invalid contact' do
29
29
  post :create, :contact_us_contact => { :email => 'test@test.com', :message => '' }
30
- assigns(:contact).valid?.should eql(false)
31
- flash[:error].should eql('You must enter both fields.')
32
- response.should render_template('new')
30
+ expect(assigns(:contact).valid?).to eql(false)
31
+ expect(flash[:error]).to eql('You must enter both fields.')
32
+ expect(response).to render_template('new')
33
33
  end
34
34
 
35
35
  end
@@ -38,8 +38,8 @@ describe ContactUs::ContactsController do
38
38
 
39
39
  it 'should assign contact for form and render page successfully' do
40
40
  get :new
41
- assigns(:contact).should be_an_instance_of(ContactUs::Contact)
42
- response.should be_success
41
+ expect(assigns(:contact)).to be_an_instance_of(ContactUs::Contact)
42
+ expect(response).to be_success
43
43
  end
44
44
 
45
45
  end
@@ -11,13 +11,13 @@ describe ContactUs do
11
11
  end
12
12
 
13
13
  it "should be valid" do
14
- ContactUs.should be_a(Module)
14
+ expect(ContactUs).to be_a(Module)
15
15
  end
16
16
 
17
17
  describe 'setup block' do
18
18
  it 'should yield self' do
19
19
  ContactUs.setup do |config|
20
- ContactUs.should eql(config)
20
+ expect(ContactUs).to eql(config)
21
21
  end
22
22
  end
23
23
  end
@@ -25,28 +25,28 @@ describe ContactUs do
25
25
  describe 'mailer_from' do
26
26
  it 'should be configurable' do
27
27
  ContactUs.mailer_from = "contact@please-change-me.com"
28
- ContactUs.mailer_from.should eql("contact@please-change-me.com")
28
+ expect(ContactUs.mailer_from).to eql("contact@please-change-me.com")
29
29
  end
30
30
  end
31
31
 
32
32
  describe 'mailer_to' do
33
33
  it 'should be configurable' do
34
34
  ContactUs.mailer_to = "contact@please-change-me.com"
35
- ContactUs.mailer_to.should eql("contact@please-change-me.com")
35
+ expect(ContactUs.mailer_to).to eql("contact@please-change-me.com")
36
36
  end
37
37
  end
38
38
 
39
39
  describe 'require_name' do
40
40
  it 'should be configurable' do
41
41
  ContactUs.require_name = true
42
- ContactUs.require_name.should eql(true)
42
+ expect(ContactUs.require_name).to eql(true)
43
43
  end
44
44
  end
45
45
 
46
46
  describe 'require_subject' do
47
47
  it 'should be configurable' do
48
48
  ContactUs.require_subject = true
49
- ContactUs.require_subject.should eql(true)
49
+ expect(ContactUs.require_subject).to eql(true)
50
50
  end
51
51
  end
52
52
 
@@ -13,11 +13,11 @@ describe "Rake tasks" do
13
13
 
14
14
  before(:each) do
15
15
  @destination_root = File.expand_path("../../dummy", __FILE__)
16
- File.exists?(@destination_root + "/config/initializers/contact_us.rb").should eql(false)
17
- File.exists?(@destination_root + "/config/locales/contact_us.en.yml").should eql(false)
18
- File.directory?(@destination_root + "/app/views/contact_us").should eql(false)
19
- File.directory?(@destination_root + "/app/views/contact_us/contact_mailer").should eql(false)
20
- File.directory?(@destination_root + "/app/views/contact_us/contacts").should eql(false)
16
+ expect(File.exists?(@destination_root + "/config/initializers/contact_us.rb")).to eql(false)
17
+ expect(File.exists?(@destination_root + "/config/locales/contact_us.en.yml")).to eql(false)
18
+ expect(File.directory?(@destination_root + "/app/views/contact_us")).to eql(false)
19
+ expect(File.directory?(@destination_root + "/app/views/contact_us/contact_mailer")).to eql(false)
20
+ expect(File.directory?(@destination_root + "/app/views/contact_us/contacts")).to eql(false)
21
21
  end
22
22
 
23
23
  describe "contact_us:install" do
@@ -27,7 +27,7 @@ describe "Rake tasks" do
27
27
  end
28
28
 
29
29
  it "creates initializer file" do
30
- File.exists?(File.join(@destination_root + "/config/initializers/contact_us.rb")).should eql(true)
30
+ expect(File.exists?(File.join(@destination_root + "/config/initializers/contact_us.rb"))).to eql(true)
31
31
  end
32
32
 
33
33
  end
@@ -38,7 +38,7 @@ describe "Rake tasks" do
38
38
  end
39
39
 
40
40
  it "creates locales files" do
41
- File.exists?(File.join(@destination_root + "/config/locales/contact_us.en.yml")).should eql(true)
41
+ expect(File.exists?(File.join(@destination_root + "/config/locales/contact_us.en.yml"))).to eql(true)
42
42
  end
43
43
  end
44
44
 
@@ -49,9 +49,9 @@ describe "Rake tasks" do
49
49
  end
50
50
 
51
51
  it "creates view files" do
52
- File.directory?(@destination_root + "/app/views/contact_us").should eql(true)
53
- File.directory?(@destination_root + "/app/views/contact_us/contact_mailer").should eql(true)
54
- File.directory?(@destination_root + "/app/views/contact_us/contacts").should eql(true)
52
+ expect(File.directory?(@destination_root + "/app/views/contact_us")).to eql(true)
53
+ expect(File.directory?(@destination_root + "/app/views/contact_us/contact_mailer")).to eql(true)
54
+ expect(File.directory?(@destination_root + "/app/views/contact_us/contacts")).to eql(true)
55
55
  end
56
56
 
57
57
  end
@@ -10,13 +10,13 @@ describe ContactUs::ContactMailer do
10
10
  end
11
11
 
12
12
  it "should render successfully" do
13
- lambda { ContactUs::ContactMailer.contact_email(@contact) }.should_not raise_error
13
+ expect { ContactUs::ContactMailer.contact_email(@contact) }.not_to raise_error
14
14
  end
15
15
 
16
16
  it "should use the ContactUs.mailer_from setting when it is set" do
17
17
  ContactUs.mailer_from = "contact@please-change-me.com"
18
18
  @mailer = ContactUs::ContactMailer.contact_email(@contact)
19
- @mailer.from.should eql([ContactUs.mailer_from])
19
+ expect(@mailer.from).to eql([ContactUs.mailer_from])
20
20
  ContactUs.mailer_from = nil
21
21
  end
22
22
 
@@ -27,33 +27,33 @@ describe ContactUs::ContactMailer do
27
27
  end
28
28
 
29
29
  it "should have the initializers to address" do
30
- @mailer.to.should eql([ContactUs.mailer_to])
30
+ expect(@mailer.to).to eql([ContactUs.mailer_to])
31
31
  end
32
32
 
33
33
  it "should use the users email in the from field when ContactUs.mailer_from is not set" do
34
- @mailer.from.should eql([@contact.email])
34
+ expect(@mailer.from).to eql([@contact.email])
35
35
  end
36
36
 
37
37
  it "should use the users email in the reply_to field" do
38
- @mailer.reply_to.should eql([@contact.email])
38
+ expect(@mailer.reply_to).to eql([@contact.email])
39
39
  end
40
40
 
41
41
  it "should have users email in the subject line" do
42
- @mailer.subject.should eql("Contact Us message from #{@contact.email}")
42
+ expect(@mailer.subject).to eql("Contact Us message from #{@contact.email}")
43
43
  end
44
44
 
45
45
  it "should have the message in the body" do
46
- @mailer.body.should match("<p>Thanks!</p>")
46
+ expect(@mailer.body).to match("<p>Thanks!</p>")
47
47
  end
48
48
 
49
49
  it "should deliver successfully" do
50
- lambda { ContactUs::ContactMailer.contact_email(@contact).deliver_now }.should_not raise_error
50
+ expect { ContactUs::ContactMailer.contact_email(@contact).deliver_now }.not_to raise_error
51
51
  end
52
52
 
53
53
  describe "and delivered" do
54
54
 
55
55
  it "should be added to the delivery queue" do
56
- lambda { ContactUs::ContactMailer.contact_email(@contact).deliver_now }.should change(ActionMailer::Base.deliveries,:size).by(1)
56
+ expect { ContactUs::ContactMailer.contact_email(@contact).deliver_now }.to change(ActionMailer::Base.deliveries,:size).by(1)
57
57
  end
58
58
 
59
59
  end
@@ -5,10 +5,10 @@ describe ContactUs::Contact do
5
5
 
6
6
  describe "Validations" do
7
7
 
8
- it {should validate_presence_of(:email)}
9
- it {should validate_presence_of(:message)}
10
- it {should_not validate_presence_of(:name)}
11
- it {should_not validate_presence_of(:subject)}
8
+ it {is_expected.to validate_presence_of(:email)}
9
+ it {is_expected.to validate_presence_of(:message)}
10
+ it {is_expected.not_to validate_presence_of(:name)}
11
+ it {is_expected.not_to validate_presence_of(:subject)}
12
12
 
13
13
  context 'with name and subject settings' do
14
14
 
@@ -22,8 +22,8 @@ describe ContactUs::Contact do
22
22
  ContactUs.require_subject =true
23
23
  end
24
24
 
25
- it {should validate_presence_of(:name)}
26
- it {should validate_presence_of(:subject)}
25
+ it {is_expected.to validate_presence_of(:name)}
26
+ it {is_expected.to validate_presence_of(:subject)}
27
27
 
28
28
  end
29
29
 
@@ -34,8 +34,8 @@ describe ContactUs::Contact do
34
34
  describe '#read_attribute_for_validation' do
35
35
  it 'should return attributes set during initialization' do
36
36
  contact = ContactUs::Contact.new(:email => "Valid@Email.com", :message => "Test")
37
- contact.read_attribute_for_validation(:email).should eql("Valid@Email.com")
38
- contact.read_attribute_for_validation(:message).should eql("Test")
37
+ expect(contact.read_attribute_for_validation(:email)).to eql("Valid@Email.com")
38
+ expect(contact.read_attribute_for_validation(:message)).to eql("Test")
39
39
  end
40
40
  end
41
41
 
@@ -43,21 +43,21 @@ describe ContactUs::Contact do
43
43
 
44
44
  it 'should return false if records invalid' do
45
45
  contact = ContactUs::Contact.new(:email => "Valid@Email.com", :message => "")
46
- contact.save.should eql(false)
46
+ expect(contact.save).to eql(false)
47
47
  end
48
48
 
49
49
  it 'should send email and return true if records valid' do
50
50
  mail = Mail.new(:from=>"Valid@Email.com", :to => "test@test.com")
51
- mail.stub(:deliver_now).and_return(true)
51
+ allow(mail).to receive(:deliver_now).and_return(true)
52
52
  contact = ContactUs::Contact.new(:email => "Valid@Email.com", :message => "Test")
53
- ContactUs::ContactMailer.should_receive(:contact_email).with(contact).and_return(mail)
54
- contact.save.should eql(true)
53
+ expect(ContactUs::ContactMailer).to receive(:contact_email).with(contact).and_return(mail)
54
+ expect(contact.save).to eql(true)
55
55
  end
56
56
 
57
57
  end
58
58
 
59
59
  describe '#to_key' do
60
- it { subject.should respond_to(:to_key) }
60
+ it { expect(subject).to respond_to(:to_key) }
61
61
  end
62
62
 
63
63
  end
data/spec/spec_helper.rb CHANGED
@@ -42,4 +42,5 @@ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
42
42
  RSpec.configure do |config|
43
43
  config.include RSpec::Matchers
44
44
  config.infer_spec_type_from_file_location!
45
+ config.raise_errors_for_deprecations!
45
46
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: contact_us
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeff Dutil
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-15 00:00:00.000000000 Z
11
+ date: 2015-04-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capybara
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '2.99'
33
+ version: '3.1'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '2.99'
40
+ version: '3.1'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: shoulda-matchers
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -159,6 +159,7 @@ files:
159
159
  - config/locales/contact_us.pt-BR.yml
160
160
  - config/locales/contact_us.pt-PT.yml
161
161
  - config/locales/contact_us.ru.yml
162
+ - config/locales/contact_us.zh-TW.yml
162
163
  - config/locales/contact_us.zh.yml
163
164
  - config/routes.rb
164
165
  - contact_us.gemspec