ankh 0.1.3 → 0.2.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.
Files changed (71) hide show
  1. data/.gitignore +18 -0
  2. data/{spec/spec.opts → .rspec} +0 -0
  3. data/.rvmrc +1 -0
  4. data/Gemfile +4 -0
  5. data/LICENSE +4 -2
  6. data/README.rdoc +15 -5
  7. data/Rakefile +6 -84
  8. data/ankh.gemspec +20 -67
  9. data/lib/..rb +5 -0
  10. data/lib/ankh.rb +4 -6
  11. data/lib/ankh/model.rb +18 -10
  12. data/lib/ankh/question.rb +1 -1
  13. data/lib/ankh/railtie.rb +8 -0
  14. data/lib/ankh/validations/{human.rb → human_validator.rb} +0 -12
  15. data/lib/ankh/version.rb +3 -0
  16. data/spec/ankh/model_spec.rb +10 -7
  17. data/spec/dummy/Rakefile +7 -0
  18. data/spec/dummy/api_docs/api_authentication.markdown +70 -0
  19. data/spec/dummy/api_docs/api_user_creates_user.markdown +1170 -0
  20. data/spec/dummy/api_docs/partner_creation.markdown +78 -0
  21. data/spec/dummy/api_docs/topic_creation.markdown +76 -0
  22. data/spec/dummy/api_docs/user_creation.markdown +31 -0
  23. data/spec/dummy/app/assets/javascripts/application.js +9 -0
  24. data/spec/dummy/app/assets/stylesheets/application.css +7 -0
  25. data/spec/dummy/app/controllers/application_controller.rb +4 -0
  26. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  27. data/{features/step_definitions/ankh_steps.rb → spec/dummy/app/mailers/.gitkeep} +0 -0
  28. data/spec/dummy/app/models/.gitkeep +0 -0
  29. data/spec/dummy/app/views/devise/confirmations/new.html.erb +15 -0
  30. data/spec/dummy/app/views/devise/mailer/confirmation_instructions.html.erb +5 -0
  31. data/spec/dummy/app/views/devise/mailer/reset_password_instructions.html.erb +8 -0
  32. data/spec/dummy/app/views/devise/mailer/unlock_instructions.html.erb +7 -0
  33. data/spec/dummy/app/views/devise/passwords/edit.html.erb +19 -0
  34. data/spec/dummy/app/views/devise/passwords/new.html.erb +15 -0
  35. data/spec/dummy/app/views/devise/registrations/edit.html.erb +22 -0
  36. data/spec/dummy/app/views/devise/registrations/new.html.erb +20 -0
  37. data/spec/dummy/app/views/devise/sessions/new.html.erb +15 -0
  38. data/spec/dummy/app/views/devise/sessions/new.mobile.erb +14 -0
  39. data/spec/dummy/app/views/devise/shared/_links.erb +25 -0
  40. data/spec/dummy/app/views/devise/unlocks/new.html.erb +15 -0
  41. data/spec/dummy/config.ru +4 -0
  42. data/spec/dummy/config/application.rb +45 -0
  43. data/spec/dummy/config/boot.rb +10 -0
  44. data/spec/dummy/config/database.yml +20 -0
  45. data/spec/dummy/config/environment.rb +5 -0
  46. data/spec/dummy/config/environments/development.rb +30 -0
  47. data/spec/dummy/config/environments/production.rb +60 -0
  48. data/spec/dummy/config/environments/test.rb +39 -0
  49. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  50. data/spec/dummy/config/initializers/inflections.rb +10 -0
  51. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  52. data/spec/dummy/config/initializers/secret_token.rb +7 -0
  53. data/spec/dummy/config/initializers/session_store.rb +8 -0
  54. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  55. data/spec/dummy/config/locales/en.yml +5 -0
  56. data/spec/dummy/config/routes.rb +3 -0
  57. data/spec/dummy/db/development.sqlite3 +0 -0
  58. data/spec/dummy/db/schema.rb +188 -0
  59. data/spec/dummy/db/test.sqlite3 +0 -0
  60. data/spec/dummy/lib/assets/.gitkeep +0 -0
  61. data/spec/dummy/public/404.html +26 -0
  62. data/spec/dummy/public/422.html +26 -0
  63. data/spec/dummy/public/500.html +26 -0
  64. data/spec/dummy/public/favicon.ico +0 -0
  65. data/spec/dummy/script/rails +6 -0
  66. data/spec/spec_helper.rb +10 -14
  67. metadata +205 -130
  68. data/features/ankh.feature +0 -9
  69. data/features/support/env.rb +0 -4
  70. data/lib/ankh/rails/legacy.rb +0 -41
  71. data/spec/support/active_record_spec_helper.rb +0 -44
@@ -1,9 +0,0 @@
1
- Feature: something something
2
- In order to something something
3
- A user something something
4
- something something something
5
-
6
- Scenario: something something
7
- Given inspiration
8
- When I create a sweet new gem
9
- Then everyone should see how awesome I am
@@ -1,4 +0,0 @@
1
- $LOAD_PATH.unshift(File.dirname(__FILE__) + '/../../lib')
2
- require 'ankh'
3
-
4
- require 'spec/expectations'
@@ -1,41 +0,0 @@
1
- module Ankh
2
- module Legacy
3
- module ActiveRecord
4
- def extended(base)
5
- base.class_attribute :_validators
6
- end
7
-
8
- def validates_with(*args, &block)
9
- _validators ||= {}
10
-
11
- options = args.extract_options!
12
- args.each do |klass|
13
- validator = klass.new(options, &block)
14
- validator.setup(self) if validator.respond_to?(:setup)
15
-
16
- if validator.respond_to?(:attributes) && !validator.attributes.empty?
17
- validator.attributes.each do |attribute|
18
- _validators[nil] ||= []
19
- _validators[attribute.to_sym] << validator
20
- end
21
- else
22
- _validators[nil] ||= []
23
- _validators[nil] << validator
24
- end
25
-
26
- validate(validator, options)
27
- end
28
- end
29
-
30
- private
31
- def _merge_attributes(attr_names)
32
- options = attr_names.extract_options!
33
- options.merge(:attributes => attr_names.flatten)
34
- end
35
- end
36
- end
37
- end
38
-
39
- unless ActiveRecord::Base.respond_to?(:validates_with)
40
- ActiveRecord::Base.extend Ankh::Legacy::ActiveRecord
41
- end
@@ -1,44 +0,0 @@
1
- # taken from the state_machine gem
2
- # Load TestCase helpers
3
- require 'active_support/test_case'
4
- require 'active_record/fixtures'
5
-
6
- begin
7
- require 'active_record/test_case'
8
- rescue LoadError
9
- class ActiveRecord::TestCase < ActiveSupport::TestCase
10
- # self.fixture_path = FIXTURES_ROOT
11
- self.use_instantiated_fixtures = false
12
- self.use_transactional_fixtures = true
13
- end
14
- end
15
-
16
- # Establish database connection
17
- ActiveRecord::Base.establish_connection({'adapter' => 'sqlite3', 'database' => ':memory:'})
18
- # ActiveRecord::Base.logger = Logger.new("#{File.dirname(__FILE__)}/../../active_record.log")
19
-
20
- module ActiveRecordSpecHelper
21
- TABLES = [
22
- "posts"
23
- ]
24
-
25
- def create_tables
26
- each_table do |table_name|
27
- ActiveRecord::Base.connection.create_table table_name unless table_exists?(table_name)
28
- end
29
- end
30
-
31
- def drop_tables
32
- each_table do |table_name|
33
- ActiveRecord::Base.connection.drop_table table_name if table_exists?(table_name)
34
- end
35
- end
36
-
37
- def table_exists?(table_name)
38
- ActiveRecord::Base.connection.table_exists?(table_name)
39
- end
40
-
41
- def each_table(&block)
42
- TABLES.each { |table_name| block.call(table_name) }
43
- end
44
- end