spud_inquiries 0.9.1 → 0.9.2
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.
- data/README.markdown +16 -5
- data/app/controllers/contacts_controller.rb +23 -17
- data/app/controllers/spud/admin/inquiries_controller.rb +2 -1
- data/app/controllers/spud/admin/inquiry_forms_controller.rb +3 -5
- data/app/controllers/spud/inquiries/sitemaps_controller.rb +3 -2
- data/app/mailers/spud/inquiry_mailer.rb +3 -2
- data/app/models/spud_inquiry.rb +2 -1
- data/app/models/spud_inquiry_field.rb +1 -0
- data/app/models/spud_inquiry_form.rb +8 -6
- data/app/models/spud_inquiry_form_field.rb +2 -5
- data/app/views/contacts/_show.html.erb +7 -5
- data/app/views/contacts/_show_liquid.html.erb +34 -0
- data/app/views/contacts/show.html.erb +4 -4
- data/app/views/contacts/show.js.erb +1 -0
- data/app/views/contacts/thankyou.js.erb +1 -0
- data/app/views/spud/admin/inquiry_forms/_form.html.erb +15 -9
- data/app/views/spud/admin/inquiry_forms/_spud_inquiry_form_field_fields.html.erb +8 -2
- data/app/views/spud/admin/inquiry_forms/index.html.erb +1 -1
- data/app/views/spud/admin/inquiry_forms/new.html.erb +1 -1
- data/app/views/spud/inquiries/sitemaps/show.xml.builder +1 -1
- data/config/routes.rb +15 -21
- data/db/migrate/20120117133412_create_spud_inquiry_fields.rb +1 -1
- data/db/migrate/20120122173829_add_field_order_to_spud_inquiry_form_fields.rb +1 -1
- data/db/migrate/20120126132407_add_spud_inquiry_form_id_to_spud_inquiries.rb +2 -2
- data/db/migrate/20120127023335_add_url_name_to_spud_inquiry_forms.rb +1 -1
- data/db/migrate/20121228145215_add_thank_you_content_to_spud_inquiry_form.rb +5 -0
- data/db/migrate/20130627121030_add_placeholder_to_spud_inquiry_form_fields.rb +5 -0
- data/lib/spud_inquiries/configuration.rb +2 -1
- data/lib/spud_inquiries/engine.rb +4 -0
- data/lib/spud_inquiries/liquid_form.rb +2 -1
- data/lib/spud_inquiries/version.rb +1 -1
- data/spec/controllers/contacts_controller_spec.rb +69 -0
- data/spec/controllers/spud/admin/inquiries_controller_spec.rb +55 -0
- data/spec/controllers/spud/admin/inquiry_forms_controller_spec.rb +97 -0
- data/spec/controllers/spud/inquiries/sitemaps_controller_spec.rb +23 -0
- data/spec/dummy/config/database.yml +0 -28
- data/spec/dummy/db/schema.rb +10 -8
- data/spec/dummy/log/development.log +87 -72
- data/spec/dummy/log/test.log +1244 -0
- data/spec/models/spud_inquiry_field_spec.rb +18 -0
- data/spec/models/spud_inquiry_form_field_spec.rb +36 -0
- data/spec/models/spud_inquiry_form_spec.rb +28 -0
- data/spec/models/spud_inquiry_spec.rb +22 -0
- data/spec/spec_helper.rb +9 -0
- metadata +28 -5
| @@ -0,0 +1,18 @@ | |
| 1 | 
            +
            require 'spec_helper'
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            describe SpudInquiryField do
         | 
| 4 | 
            +
             | 
| 5 | 
            +
              it {should belong_to(:spud_inquiry)}
         | 
| 6 | 
            +
             | 
| 7 | 
            +
              describe :validations do
         | 
| 8 | 
            +
                it "should save if validations pass" do
         | 
| 9 | 
            +
                  p = FactoryGirl.build(:spud_inquiry_field)
         | 
| 10 | 
            +
                  p.should be_valid
         | 
| 11 | 
            +
                end
         | 
| 12 | 
            +
             | 
| 13 | 
            +
                # it "should not be valid if inquiry is blank" do
         | 
| 14 | 
            +
                #   p = FactoryGirl.build(:spud_inquiry_field, :spud_inquiry => nil)
         | 
| 15 | 
            +
                #   p.should_not be_valid
         | 
| 16 | 
            +
                # end
         | 
| 17 | 
            +
              end
         | 
| 18 | 
            +
            end
         | 
| @@ -0,0 +1,36 @@ | |
| 1 | 
            +
            require 'spec_helper'
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            describe SpudInquiryFormField do
         | 
| 4 | 
            +
             | 
| 5 | 
            +
              it {should belong_to(:spud_inquiry_form)}
         | 
| 6 | 
            +
             | 
| 7 | 
            +
              describe :validations do
         | 
| 8 | 
            +
                it "should save if validations pass" do
         | 
| 9 | 
            +
                  p = FactoryGirl.build(:spud_inquiry_form_field)
         | 
| 10 | 
            +
                  p.should be_valid
         | 
| 11 | 
            +
                end
         | 
| 12 | 
            +
             | 
| 13 | 
            +
                it "should be invalid if name is blank" do
         | 
| 14 | 
            +
                  p = FactoryGirl.build(:spud_inquiry_form_field, :name => nil)
         | 
| 15 | 
            +
                  p.should_not be_valid
         | 
| 16 | 
            +
                end
         | 
| 17 | 
            +
             | 
| 18 | 
            +
                it "should be invalid if field_type is blank" do
         | 
| 19 | 
            +
                  p = FactoryGirl.build(:spud_inquiry_form_field, :field_type => nil)
         | 
| 20 | 
            +
                  p.should_not be_valid
         | 
| 21 | 
            +
                end
         | 
| 22 | 
            +
             | 
| 23 | 
            +
                # it "should not be valid if form is blank" do
         | 
| 24 | 
            +
                #   p = FactoryGirl.build(:spud_inquiry_form_field, :spud_inquiry_form => nil)
         | 
| 25 | 
            +
                #   p.should_not be_valid
         | 
| 26 | 
            +
                # end
         | 
| 27 | 
            +
              end
         | 
| 28 | 
            +
             | 
| 29 | 
            +
              describe :accessors do
         | 
| 30 | 
            +
                it "should fetch options list array" do
         | 
| 31 | 
            +
                  p = FactoryGirl.build(:spud_inquiry_form_field,:options => "Test,\"Quoted , Option\"")
         | 
| 32 | 
            +
                  p.options_list.should == ["Test","Quoted , Option"]
         | 
| 33 | 
            +
                end
         | 
| 34 | 
            +
             | 
| 35 | 
            +
              end
         | 
| 36 | 
            +
            end
         | 
| @@ -0,0 +1,28 @@ | |
| 1 | 
            +
            require 'spec_helper'
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            describe SpudInquiryForm do
         | 
| 4 | 
            +
             | 
| 5 | 
            +
              it {should have_many(:spud_inquiries)}
         | 
| 6 | 
            +
              it {should have_many(:spud_inquiry_form_fields)}
         | 
| 7 | 
            +
             | 
| 8 | 
            +
              describe :validations do
         | 
| 9 | 
            +
                it "should be invalid if name is blank" do
         | 
| 10 | 
            +
                  p = FactoryGirl.build(:spud_inquiry_form, :name => nil)
         | 
| 11 | 
            +
                  p.should_not be_valid
         | 
| 12 | 
            +
                end
         | 
| 13 | 
            +
             | 
| 14 | 
            +
                it "should require a unique name" do
         | 
| 15 | 
            +
                  p = FactoryGirl.create(:spud_inquiry_form, :name => "Test")
         | 
| 16 | 
            +
                  p2 = FactoryGirl.build(:spud_inquiry_form, :name => "Test")
         | 
| 17 | 
            +
                  p2.should_not be_valid
         | 
| 18 | 
            +
                end
         | 
| 19 | 
            +
              end
         | 
| 20 | 
            +
             | 
| 21 | 
            +
              describe :hooks do
         | 
| 22 | 
            +
                it "should generate a url_name before validating" do
         | 
| 23 | 
            +
                  p = FactoryGirl.build(:spud_inquiry_form, :name => "Contact Us")
         | 
| 24 | 
            +
                  p.should be_valid
         | 
| 25 | 
            +
                  p.url_name.should == p.name.gsub(/[^a-zA-Z0-9\ ]/," ").gsub(/\ \ +/," ").gsub(/\ /,"-").downcase
         | 
| 26 | 
            +
                end
         | 
| 27 | 
            +
              end
         | 
| 28 | 
            +
            end
         | 
| @@ -0,0 +1,22 @@ | |
| 1 | 
            +
            require 'spec_helper'
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            describe SpudInquiry do
         | 
| 4 | 
            +
             | 
| 5 | 
            +
              it {should have_many(:spud_inquiry_fields)}
         | 
| 6 | 
            +
              it {should belong_to(:spud_inquiry_form)}
         | 
| 7 | 
            +
             | 
| 8 | 
            +
             | 
| 9 | 
            +
              describe :accessors do
         | 
| 10 | 
            +
                it "should fetch email if field exists" do
         | 
| 11 | 
            +
                  p = FactoryGirl.create(:spud_inquiry)
         | 
| 12 | 
            +
                  email = FactoryGirl.create(:spud_inquiry_field, :spud_inquiry => p, :name => "email", :value => "test@spudcms.net")
         | 
| 13 | 
            +
             | 
| 14 | 
            +
                  p.email.should == "test@spudcms.net"
         | 
| 15 | 
            +
                end
         | 
| 16 | 
            +
             | 
| 17 | 
            +
                it "should return unknown sender if email non-existent" do
         | 
| 18 | 
            +
                  p = FactoryGirl.create(:spud_inquiry)
         | 
| 19 | 
            +
                  p.email.should == "Unknown Sender"
         | 
| 20 | 
            +
                end
         | 
| 21 | 
            +
              end
         | 
| 22 | 
            +
            end
         | 
    
        data/spec/spec_helper.rb
    CHANGED
    
    | @@ -38,3 +38,12 @@ RSpec.configure do |config| | |
| 38 38 | 
             
                DatabaseCleaner.clean
         | 
| 39 39 | 
             
              end
         | 
| 40 40 | 
             
            end
         | 
| 41 | 
            +
             | 
| 42 | 
            +
            Spud::Core::Engine.routes.draw do
         | 
| 43 | 
            +
                default_url_options :host => "test.host"
         | 
| 44 | 
            +
            end
         | 
| 45 | 
            +
             | 
| 46 | 
            +
            Spud::Inquiries::Engine.routes.draw do
         | 
| 47 | 
            +
                default_url_options :host => "test.host"
         | 
| 48 | 
            +
            end
         | 
| 49 | 
            +
             | 
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: spud_inquiries
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.9. | 
| 4 | 
            +
              version: 0.9.2
         | 
| 5 5 | 
             
              prerelease: 
         | 
| 6 6 | 
             
            platform: ruby
         | 
| 7 7 | 
             
            authors:
         | 
| @@ -9,7 +9,7 @@ authors: | |
| 9 9 | 
             
            autorequire: 
         | 
| 10 10 | 
             
            bindir: bin
         | 
| 11 11 | 
             
            cert_chain: []
         | 
| 12 | 
            -
            date:  | 
| 12 | 
            +
            date: 2013-06-27 00:00:00.000000000 Z
         | 
| 13 13 | 
             
            dependencies:
         | 
| 14 14 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 15 15 | 
             
              name: rails
         | 
| @@ -211,8 +211,11 @@ files: | |
| 211 211 | 
             
            - app/models/spud_inquiry_form_field.rb
         | 
| 212 212 | 
             
            - app/observers/inquiry_sweeper.rb
         | 
| 213 213 | 
             
            - app/views/contacts/_show.html.erb
         | 
| 214 | 
            +
            - app/views/contacts/_show_liquid.html.erb
         | 
| 214 215 | 
             
            - app/views/contacts/show.html.erb
         | 
| 216 | 
            +
            - app/views/contacts/show.js.erb
         | 
| 215 217 | 
             
            - app/views/contacts/thankyou.html.erb
         | 
| 218 | 
            +
            - app/views/contacts/thankyou.js.erb
         | 
| 216 219 | 
             
            - app/views/layouts/spud/inquiries/detail.html.erb
         | 
| 217 220 | 
             
            - app/views/spud/admin/inquiries/index.html.erb
         | 
| 218 221 | 
             
            - app/views/spud/admin/inquiries/show.html.erb
         | 
| @@ -234,6 +237,8 @@ files: | |
| 234 237 | 
             
            - db/migrate/20120126132522_add_recipients_to_spud_inquiry_forms.rb
         | 
| 235 238 | 
             
            - db/migrate/20120127023335_add_url_name_to_spud_inquiry_forms.rb
         | 
| 236 239 | 
             
            - db/migrate/20120413124900_change_inquiry_form_fields_column.rb
         | 
| 240 | 
            +
            - db/migrate/20121228145215_add_thank_you_content_to_spud_inquiry_form.rb
         | 
| 241 | 
            +
            - db/migrate/20130627121030_add_placeholder_to_spud_inquiry_form_fields.rb
         | 
| 237 242 | 
             
            - lib/spud_inquiries/configuration.rb
         | 
| 238 243 | 
             
            - lib/spud_inquiries/engine.rb
         | 
| 239 244 | 
             
            - lib/spud_inquiries/liquid_form.rb
         | 
| @@ -243,6 +248,10 @@ files: | |
| 243 248 | 
             
            - MIT-LICENSE
         | 
| 244 249 | 
             
            - Rakefile
         | 
| 245 250 | 
             
            - README.markdown
         | 
| 251 | 
            +
            - spec/controllers/contacts_controller_spec.rb
         | 
| 252 | 
            +
            - spec/controllers/spud/admin/inquiries_controller_spec.rb
         | 
| 253 | 
            +
            - spec/controllers/spud/admin/inquiry_forms_controller_spec.rb
         | 
| 254 | 
            +
            - spec/controllers/spud/inquiries/sitemaps_controller_spec.rb
         | 
| 246 255 | 
             
            - spec/dummy/app/assets/javascripts/application.js
         | 
| 247 256 | 
             
            - spec/dummy/app/assets/stylesheets/application.css
         | 
| 248 257 | 
             
            - spec/dummy/app/controllers/application_controller.rb
         | 
| @@ -271,6 +280,7 @@ files: | |
| 271 280 | 
             
            - spec/dummy/db/migrate/20120610131541_create_spud_user_settings.spud_core.rb
         | 
| 272 281 | 
             
            - spec/dummy/db/schema.rb
         | 
| 273 282 | 
             
            - spec/dummy/log/development.log
         | 
| 283 | 
            +
            - spec/dummy/log/test.log
         | 
| 274 284 | 
             
            - spec/dummy/public/404.html
         | 
| 275 285 | 
             
            - spec/dummy/public/422.html
         | 
| 276 286 | 
             
            - spec/dummy/public/500.html
         | 
| @@ -278,6 +288,10 @@ files: | |
| 278 288 | 
             
            - spec/dummy/Rakefile
         | 
| 279 289 | 
             
            - spec/dummy/README.rdoc
         | 
| 280 290 | 
             
            - spec/dummy/script/rails
         | 
| 291 | 
            +
            - spec/models/spud_inquiry_field_spec.rb
         | 
| 292 | 
            +
            - spec/models/spud_inquiry_form_field_spec.rb
         | 
| 293 | 
            +
            - spec/models/spud_inquiry_form_spec.rb
         | 
| 294 | 
            +
            - spec/models/spud_inquiry_spec.rb
         | 
| 281 295 | 
             
            - spec/spec_helper.rb
         | 
| 282 296 | 
             
            - spec/support/authlogic_helper.rb
         | 
| 283 297 | 
             
            homepage: http://www.github.com/davydotcom/spud_inquiries
         | 
| @@ -294,7 +308,7 @@ required_ruby_version: !ruby/object:Gem::Requirement | |
| 294 308 | 
             
                  version: '0'
         | 
| 295 309 | 
             
                  segments:
         | 
| 296 310 | 
             
                  - 0
         | 
| 297 | 
            -
                  hash:  | 
| 311 | 
            +
                  hash: 2218354112470977930
         | 
| 298 312 | 
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         | 
| 299 313 | 
             
              none: false
         | 
| 300 314 | 
             
              requirements:
         | 
| @@ -303,14 +317,18 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 303 317 | 
             
                  version: '0'
         | 
| 304 318 | 
             
                  segments:
         | 
| 305 319 | 
             
                  - 0
         | 
| 306 | 
            -
                  hash:  | 
| 320 | 
            +
                  hash: 2218354112470977930
         | 
| 307 321 | 
             
            requirements: []
         | 
| 308 322 | 
             
            rubyforge_project: 
         | 
| 309 | 
            -
            rubygems_version: 1.8. | 
| 323 | 
            +
            rubygems_version: 1.8.25
         | 
| 310 324 | 
             
            signing_key: 
         | 
| 311 325 | 
             
            specification_version: 3
         | 
| 312 326 | 
             
            summary: Inquiry form builder and mailer for spud (Useful for Contact Forms).
         | 
| 313 327 | 
             
            test_files:
         | 
| 328 | 
            +
            - spec/controllers/contacts_controller_spec.rb
         | 
| 329 | 
            +
            - spec/controllers/spud/admin/inquiries_controller_spec.rb
         | 
| 330 | 
            +
            - spec/controllers/spud/admin/inquiry_forms_controller_spec.rb
         | 
| 331 | 
            +
            - spec/controllers/spud/inquiries/sitemaps_controller_spec.rb
         | 
| 314 332 | 
             
            - spec/dummy/app/assets/javascripts/application.js
         | 
| 315 333 | 
             
            - spec/dummy/app/assets/stylesheets/application.css
         | 
| 316 334 | 
             
            - spec/dummy/app/controllers/application_controller.rb
         | 
| @@ -339,6 +357,7 @@ test_files: | |
| 339 357 | 
             
            - spec/dummy/db/migrate/20120610131541_create_spud_user_settings.spud_core.rb
         | 
| 340 358 | 
             
            - spec/dummy/db/schema.rb
         | 
| 341 359 | 
             
            - spec/dummy/log/development.log
         | 
| 360 | 
            +
            - spec/dummy/log/test.log
         | 
| 342 361 | 
             
            - spec/dummy/public/404.html
         | 
| 343 362 | 
             
            - spec/dummy/public/422.html
         | 
| 344 363 | 
             
            - spec/dummy/public/500.html
         | 
| @@ -346,5 +365,9 @@ test_files: | |
| 346 365 | 
             
            - spec/dummy/Rakefile
         | 
| 347 366 | 
             
            - spec/dummy/README.rdoc
         | 
| 348 367 | 
             
            - spec/dummy/script/rails
         | 
| 368 | 
            +
            - spec/models/spud_inquiry_field_spec.rb
         | 
| 369 | 
            +
            - spec/models/spud_inquiry_form_field_spec.rb
         | 
| 370 | 
            +
            - spec/models/spud_inquiry_form_spec.rb
         | 
| 371 | 
            +
            - spec/models/spud_inquiry_spec.rb
         | 
| 349 372 | 
             
            - spec/spec_helper.rb
         | 
| 350 373 | 
             
            - spec/support/authlogic_helper.rb
         |