Sha256: c3f4c193a67bfbe7f429aeb65fbaad92b9fe9dd02b2a8a62dc50775166dc42ea

Contents?: true

Size: 1.49 KB

Versions: 3

Compression:

Stored size: 1.49 KB

Contents

# models for use in tests

class Widget < ActiveRecord::Base
  # uses textcaptcha.yml file for configuration
  acts_as_textcaptcha
end

class Comment < ActiveRecord::Base
  # inline options (symbol keys) with api_key only
  acts_as_textcaptcha :api_key     => '8u5ixtdnq9csc84cok0owswgo',
                      :bcrypt_salt => '$2a$10$j0bmycH.SVfD1b5mpEGPpe'
end

class Review < ActiveRecord::Base
  # inline options with all possible options
  acts_as_textcaptcha 'api_key'     => '8u5ixtdnq9csc84cok0owswgo',
                      'bcrypt_salt' => '$2a$10$j0bmycH.SVfD1b5mpEGPpe',
                      'bcrypt_cost' => '3',
                      'questions'   => [{ 'question' => 'The green hat is what color?', 'answers' => 'green' }]
end

class Note < ActiveRecord::Base
  # inline options (string keys) with user defined questions only (no textcaptcha service)
  acts_as_textcaptcha 'questions'   => [{ 'question' => '1+1', 'answers' => '2,two' }],
                      'bcrypt_salt' => '$2a$10$j0bmycH.SVfD1b5mpEGPpe'

  # allows toggling perform_textcaptcha on/off (default on)
  attr_accessor :turn_off_captcha

  def perform_textcaptcha?
    !turn_off_captcha
  end
end

class Contact
  # non active record object (symbol keys), no API used
  include ActiveModel::Validations
  include ActiveModel::Conversion
  extend  ActsAsTextcaptcha::Textcaptcha
  acts_as_textcaptcha :questions   => [{ :question => 'one+1', :answers => '2,two' }],
                      :bcrypt_salt => '$2a$10$j0bmycH.SVfD1b5mpEGPpe'
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
acts_as_textcaptcha-3.0.2 test/test_models.rb
acts_as_textcaptcha-3.0.1 test/test_models.rb
acts_as_textcaptcha-3.0.0 test/test_models.rb