Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Fix for Issue 51 #53

Closed
wants to merge 2 commits into from

2 participants

Matt Campbell Uģis Ozols
Matt Campbell

Update the use of the Refinery::Settings API so that this engine works against edge. Please review and let me know if I'm headed in the correct direction. I can squash before you guys pull the changes if you like as well.

#51

Uģis Ozols
Owner

Hey @soupmatt,

Sorry for checking your pr only now. The issue was fixed in recent namespace change so I'm going to close this. Thanks for your time and effort!

Uģis Ozols ugisozols closed this
Matt Campbell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
8 app/models/refinery/inquiry_setting.rb
View
@@ -17,7 +17,7 @@ def confirmation_subject(locale='en')
def confirmation_subject=(value)
value.first.keys.each do |locale|
Refinery::Setting.set("inquiry_confirmation_subject_#{locale}".to_sym,
- value.first[locale.to_sym],
+ :value => value.first[locale.to_sym],
:scoping => "inquiries")
end
end
@@ -31,7 +31,7 @@ def confirmation_message(locale='en')
def confirmation_message=(value)
value.first.keys.each do |locale|
Refinery::Setting.set("inquiry_confirmation_messeage_#{locale}".to_sym,
- value.first[locale.to_sym],
+ :value => value.first[locale.to_sym],
:scoping => "inquiries")
end
end
@@ -47,9 +47,9 @@ def notification_subject
"New inquiry from your website",
:scoping => "inquiries")
end
-
+
def send_confirmation?
- Refinery::Setting.find_or_set(:inquiry_send_confirmation,
+ Refinery::Setting.find_or_set(:inquiry_send_confirmation,
true,
:scoping => "inquiries")
end
31 spec/models/refinery/inquiry_setting_spec.rb
View
@@ -0,0 +1,31 @@
+require 'spec_helper'
+
+module Refinery
+ describe InquirySetting do
+ describe ".confirmation_InquirySetting" do
+ it "has a default value" do
+ InquirySetting.confirmation_subject.should eq "Thank you for your inquiry"
+ end
+ context "after setting" do
+ let(:message_data) {
+ {'en' => 'Confirmation in English',
+ 'de' => 'Confirmation in German'}
+ }
+
+ before {
+ message_data.each_pair do |k,v|
+ InquirySetting.confirmation_subject= [{k => v}]
+ end
+ }
+ it "returns the 'en' message when called with no parameters" do
+ InquirySetting.confirmation_subject.should eq message_data['en']
+ end
+ it "returns the message for the local passed in" do
+ message_data.each_pair do |k,v|
+ InquirySetting.confirmation_subject(k).should eq v
+ end
+ end
+ end
+ end
+ end
+end
Something went wrong with that request. Please try again.