consul 0.4.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of consul might be problematic. Click here for more details.

Files changed (71) hide show
  1. data/.gitignore +2 -1
  2. data/.travis.yml +8 -0
  3. data/Rakefile +4 -2
  4. data/lib/consul/active_record.rb +1 -1
  5. data/lib/consul/version.rb +1 -1
  6. data/spec/rails-2.3/Gemfile +2 -1
  7. data/spec/rails-2.3/app_root/config/initializers/fix_missing_source_file.rb +1 -0
  8. data/spec/rails-2.3/rcov.opts +0 -0
  9. data/spec/rails-2.3/{spec_helper.rb → spec/spec_helper.rb} +5 -3
  10. data/spec/rails-2.3/spec.opts +0 -0
  11. data/spec/rails-3.0/.rspec +2 -0
  12. data/spec/rails-3.0/Gemfile +12 -0
  13. data/spec/rails-3.0/Rakefile +11 -0
  14. data/spec/rails-3.0/app_root/.gitignore +4 -0
  15. data/spec/rails-3.0/app_root/config/application.rb +31 -0
  16. data/spec/rails-3.0/app_root/config/boot.rb +13 -0
  17. data/spec/rails-3.0/app_root/config/database.yml +4 -0
  18. data/spec/rails-3.0/app_root/config/environment.rb +5 -0
  19. data/spec/rails-3.0/app_root/config/environments/test.rb +35 -0
  20. data/spec/rails-3.0/app_root/config/initializers/backtrace_silencers.rb +7 -0
  21. data/spec/rails-3.0/app_root/config/initializers/inflections.rb +10 -0
  22. data/spec/rails-3.0/app_root/config/initializers/mime_types.rb +5 -0
  23. data/spec/rails-3.0/app_root/config/initializers/secret_token.rb +7 -0
  24. data/spec/rails-3.0/app_root/config/initializers/session_store.rb +8 -0
  25. data/spec/rails-3.0/app_root/config/routes.rb +3 -0
  26. data/spec/rails-3.0/app_root/lib/tasks/.gitkeep +0 -0
  27. data/spec/rails-3.0/app_root/log/.gitkeep +0 -0
  28. data/spec/rails-3.0/app_root/script/rails +6 -0
  29. data/spec/rails-3.0/rcov.opts +2 -0
  30. data/spec/rails-3.0/spec/spec_helper.rb +23 -0
  31. data/spec/rails-3.2/.rspec +2 -0
  32. data/spec/rails-3.2/Gemfile +13 -0
  33. data/spec/rails-3.2/Rakefile +11 -0
  34. data/spec/rails-3.2/app_root/.gitignore +4 -0
  35. data/spec/rails-3.2/app_root/config/application.rb +31 -0
  36. data/spec/rails-3.2/app_root/config/boot.rb +13 -0
  37. data/spec/rails-3.2/app_root/config/database.yml +4 -0
  38. data/spec/rails-3.2/app_root/config/environment.rb +5 -0
  39. data/spec/rails-3.2/app_root/config/environments/test.rb +35 -0
  40. data/spec/rails-3.2/app_root/config/initializers/backtrace_silencers.rb +7 -0
  41. data/spec/rails-3.2/app_root/config/initializers/inflections.rb +10 -0
  42. data/spec/rails-3.2/app_root/config/initializers/mime_types.rb +5 -0
  43. data/spec/rails-3.2/app_root/config/initializers/secret_token.rb +7 -0
  44. data/spec/rails-3.2/app_root/config/initializers/session_store.rb +8 -0
  45. data/spec/rails-3.2/app_root/config/routes.rb +3 -0
  46. data/spec/rails-3.2/app_root/log/.gitignore +1 -0
  47. data/spec/rails-3.2/rcov.opts +2 -0
  48. data/spec/rails-3.2/spec/spec_helper.rb +29 -0
  49. data/spec/{rails-2.3 → shared}/app_root/app/controllers/application_controller.rb +7 -0
  50. data/spec/{rails-2.3 → shared}/app_root/app/controllers/cakes_controller.rb +8 -0
  51. data/spec/{rails-2.3 → shared}/app_root/app/controllers/dashboards_controller.rb +1 -0
  52. data/spec/{rails-2.3 → shared}/app_root/app/controllers/risks_controller.rb +0 -0
  53. data/spec/{rails-2.3 → shared}/app_root/app/controllers/songs_controller.rb +2 -0
  54. data/spec/{rails-2.3 → shared}/app_root/app/controllers/users_controller.rb +2 -0
  55. data/spec/shared/app_root/app/models/client.rb +9 -0
  56. data/spec/{rails-2.3 → shared}/app_root/app/models/note.rb +0 -0
  57. data/spec/{rails-2.3 → shared}/app_root/app/models/power.rb +0 -0
  58. data/spec/{rails-2.3 → shared}/app_root/app/models/user.rb +0 -0
  59. data/spec/{rails-2.3 → shared}/app_root/db/migrate/001_create_users.rb +0 -0
  60. data/spec/{rails-2.3 → shared}/app_root/db/migrate/002_create_clients.rb +0 -0
  61. data/spec/{rails-2.3 → shared}/app_root/db/migrate/003_create_notes.rb +0 -0
  62. data/spec/shared/{controllers → consul/controllers}/cakes_controller_spec.rb +0 -0
  63. data/spec/shared/{controllers → consul/controllers}/dashboards_controller_spec.rb +0 -0
  64. data/spec/shared/{controllers → consul/controllers}/risks_controller_spec.rb +0 -0
  65. data/spec/shared/{controllers → consul/controllers}/songs_controller_spec.rb +0 -0
  66. data/spec/shared/{controllers → consul/controllers}/users_controller_spec.rb +0 -0
  67. data/spec/shared/consul/power_spec.rb +1 -1
  68. metadata +105 -83
  69. data/spec/rails-2.3/app_root/app/models/client.rb +0 -7
  70. data/spec/rails-2.3/app_root/lib/console_with_fixtures.rb +0 -4
  71. data/spec/rails-2.3/app_root/script/console +0 -7
data/.gitignore CHANGED
@@ -2,7 +2,8 @@ doc
2
2
  pkg
3
3
  *.gem
4
4
  .idea
5
- spec/app_root/log/*
5
+ *.db
6
+ app_root/log/*
6
7
  Gemfile.lock
7
8
 
8
9
 
data/.travis.yml ADDED
@@ -0,0 +1,8 @@
1
+ language: ruby
2
+ rvm:
3
+ - "1.8.7"
4
+ - "1.9.2"
5
+ - "1.9.3"
6
+ - rbx-18mode
7
+ - rbx-19mode
8
+ script: rake all:bundle all:spec
data/Rakefile CHANGED
@@ -8,16 +8,18 @@ namespace :all do
8
8
 
9
9
  desc "Run specs on all spec apps"
10
10
  task :spec do
11
+ success = true
11
12
  for_each_directory_of('spec/**/Rakefile') do |directory|
12
13
  env = "SPEC=../../#{ENV['SPEC']} " if ENV['SPEC']
13
- system("cd #{directory} && #{env} bundle exec rake spec")
14
+ success &= system("cd #{directory} && #{env} bundle exec rake spec")
14
15
  end
16
+ fail "Tests failed" unless success
15
17
  end
16
18
 
17
19
  desc "Bundle all spec apps"
18
20
  task :bundle do
19
21
  for_each_directory_of('spec/**/Gemfile') do |directory|
20
- system("cd #{directory} && bundle install")
22
+ system("cd #{directory} && rm -f Gemfile.lock && bundle install")
21
23
  end
22
24
  end
23
25
 
@@ -5,7 +5,7 @@ module Consul
5
5
 
6
6
  def authorize_values_for(property, options = {})
7
7
  if defined?(AssignableValues)
8
- assignable_values_for property, options.merge(:through => lambda { ::Power.current })
8
+ assignable_values_for property, options.merge(:through => proc { ::Power.current })
9
9
  else
10
10
  raise "To use .authorize_values_for, add the gem 'assignable_values' to your Gemfile"
11
11
  end
@@ -1,3 +1,3 @@
1
1
  module Consul
2
- VERSION = '0.4.0'
2
+ VERSION = '0.4.1'
3
3
  end
@@ -7,6 +7,7 @@ gem 'rspec-rails', '~>1.3'
7
7
  gem 'shoulda-matchers'
8
8
  gem 'sqlite3'
9
9
  gem 'rspec_candy'
10
- gem 'ruby-debug'
10
+ gem 'ruby-debug', :platforms => :mri_18
11
+ gem 'test-unit', '~>1.2', :platforms => :ruby_19
11
12
 
12
13
  gem 'consul', :path => '../..'
@@ -0,0 +1 @@
1
+ MissingSourceFile::REGEXPS.push([/^cannot load such file -- (.+)$/i, 1])
File without changes
@@ -1,10 +1,10 @@
1
- $: << File.join(File.dirname(__FILE__), "/../lib" )
1
+ $: << File.join(File.dirname(__FILE__), "/../../lib" )
2
2
 
3
3
  # Set the default environment to sqlite3's in_memory database
4
- ENV['RAILS_ENV'] ||= 'in_memory'
4
+ ENV['RAILS_ENV'] = 'in_memory'
5
5
 
6
6
  # Load the Rails environment and testing framework
7
- require "#{File.dirname(__FILE__)}/app_root/config/environment"
7
+ require "#{File.dirname(__FILE__)}/../app_root/config/environment"
8
8
  require 'spec/rails'
9
9
 
10
10
  ### Load dependencies
@@ -24,7 +24,9 @@ silence_warnings {RAILS_ENV = ENV['RAILS_ENV']}
24
24
  Dir[File.expand_path(File.join(File.dirname(__FILE__),'support','**','*.rb'))].each {|f| require f}
25
25
 
26
26
  # Run the migrations
27
+ print "\033[30m" # dark gray text
27
28
  ActiveRecord::Migrator.migrate("#{Rails.root}/db/migrate")
29
+ print "\033[0m"
28
30
 
29
31
  Spec::Runner.configure do |config|
30
32
  config.use_transactional_fixtures = true
File without changes
@@ -0,0 +1,2 @@
1
+ --colour
2
+ --format progress
@@ -0,0 +1,12 @@
1
+ source :rubygems
2
+
3
+ gem 'assignable_values'
4
+ gem 'rails', '~>3.0.17'
5
+ gem 'rspec'
6
+ gem 'rspec-rails'
7
+ gem 'shoulda-matchers'
8
+ gem 'sqlite3'
9
+ gem 'rspec_candy'
10
+ gem 'ruby-debug', :platforms => :mri_18
11
+
12
+ gem 'consul', :path => '../..'
@@ -0,0 +1,11 @@
1
+ require 'rake'
2
+ require 'rspec/core/rake_task'
3
+
4
+ desc 'Default: Run all specs for a specific rails version.'
5
+ task :default => :spec
6
+
7
+ desc "Run all specs for a specific rails version"
8
+ RSpec::Core::RakeTask.new(:spec) do |t|
9
+ t.pattern = defined?(SPEC) ? SPEC : ['**/*_spec.rb', '../shared/**/*_spec.rb']
10
+ t.verbose = false
11
+ end
@@ -0,0 +1,4 @@
1
+ .bundle
2
+ db/*.sqlite3
3
+ log/*.log
4
+ tmp/**/*
@@ -0,0 +1,31 @@
1
+ require File.expand_path('../boot', __FILE__)
2
+
3
+ require 'rails/all'
4
+
5
+ # If you have a Gemfile, require the gems listed there, including any gems
6
+ # you've limited to :test, :development, or :production.
7
+ Bundler.require(:default, Rails.env) if defined?(Bundler)
8
+
9
+ module SpecApp
10
+ class Application < Rails::Application
11
+ config.encoding = "utf-8"
12
+
13
+ config.cache_classes = true
14
+ config.whiny_nils = true
15
+
16
+ config.consider_all_requests_local = true
17
+ config.action_controller.perform_caching = false
18
+
19
+ config.action_dispatch.show_exceptions = false
20
+
21
+ config.action_controller.allow_forgery_protection = false
22
+
23
+ config.action_mailer.delivery_method = :test
24
+
25
+ config.active_support.deprecation = :stderr
26
+
27
+ config.root = File.expand_path('../..', __FILE__)
28
+
29
+ # railties.plugins << Rails::Plugin.new(File.expand_path('../../../../..', __FILE__))
30
+ end
31
+ end
@@ -0,0 +1,13 @@
1
+ require 'rubygems'
2
+
3
+ # Set up gems listed in the Gemfile.
4
+ gemfile = File.expand_path('../../Gemfile', __FILE__)
5
+ begin
6
+ ENV['BUNDLE_GEMFILE'] = gemfile
7
+ require 'bundler'
8
+ Bundler.setup
9
+ rescue Bundler::GemNotFound => e
10
+ STDERR.puts e.message
11
+ STDERR.puts "Try running `bundle install`."
12
+ exit!
13
+ end if File.exist?(gemfile)
@@ -0,0 +1,4 @@
1
+ test:
2
+ adapter: sqlite3
3
+ database: db/consul_test.db
4
+ verbosity: quiet
@@ -0,0 +1,5 @@
1
+ # Load the rails application
2
+ require File.expand_path('../application', __FILE__)
3
+
4
+ # Initialize the rails application
5
+ SpecApp::Application.initialize!
@@ -0,0 +1,35 @@
1
+ SpecApp::Application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb
3
+
4
+ # The test environment is used exclusively to run your application's
5
+ # test suite. You never need to work with it otherwise. Remember that
6
+ # your test database is "scratch space" for the test suite and is wiped
7
+ # and recreated between test runs. Don't rely on the data there!
8
+ config.cache_classes = true
9
+
10
+ # Log error messages when you accidentally call methods on nil.
11
+ config.whiny_nils = true
12
+
13
+ # Show full error reports and disable caching
14
+ config.consider_all_requests_local = true
15
+ config.action_controller.perform_caching = false
16
+
17
+ # Raise exceptions instead of rendering exception templates
18
+ config.action_dispatch.show_exceptions = false
19
+
20
+ # Disable request forgery protection in test environment
21
+ config.action_controller.allow_forgery_protection = false
22
+
23
+ # Tell Action Mailer not to deliver emails to the real world.
24
+ # The :test delivery method accumulates sent emails in the
25
+ # ActionMailer::Base.deliveries array.
26
+ config.action_mailer.delivery_method = :test
27
+
28
+ # Use SQL instead of Active Record's schema dumper when creating the test database.
29
+ # This is necessary if your schema can't be completely dumped by the schema dumper,
30
+ # like if you have constraints or database-specific column types
31
+ # config.active_record.schema_format = :sql
32
+
33
+ # Print deprecation notices to the stderr
34
+ config.active_support.deprecation = :stderr
35
+ end
@@ -0,0 +1,7 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
4
+ # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
5
+
6
+ # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
7
+ # Rails.backtrace_cleaner.remove_silencers!
@@ -0,0 +1,10 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Add new inflection rules using the following format
4
+ # (all these examples are active by default):
5
+ # ActiveSupport::Inflector.inflections do |inflect|
6
+ # inflect.plural /^(ox)$/i, '\1en'
7
+ # inflect.singular /^(ox)en/i, '\1'
8
+ # inflect.irregular 'person', 'people'
9
+ # inflect.uncountable %w( fish sheep )
10
+ # end
@@ -0,0 +1,5 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Add new mime types for use in respond_to blocks:
4
+ # Mime::Type.register "text/richtext", :rtf
5
+ # Mime::Type.register_alias "text/html", :iphone
@@ -0,0 +1,7 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Your secret key for verifying the integrity of signed cookies.
4
+ # If you change this key, all old signed cookies will become invalid!
5
+ # Make sure the secret is at least 30 characters and all random,
6
+ # no regular words or you'll be exposed to dictionary attacks.
7
+ SpecApp::Application.config.secret_token = 'cb014a08a45243e7143f31e04774c342c1fba329fd594ae1a480d8283b1a851f425dc08044311fb4be6d000b6e6681de7c76d19148419a5ffa0a9f84556d3b33'
@@ -0,0 +1,8 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ SpecApp::Application.config.session_store :cookie_store, :key => '_app_root_session'
4
+
5
+ # Use the database for sessions instead of the cookie-based default,
6
+ # which shouldn't be used to store highly confidential information
7
+ # (create the session table with "rails generate session_migration")
8
+ # HasDefaultSpecApp::Application.config.session_store :active_record_store
@@ -0,0 +1,3 @@
1
+ SpecApp::Application.routes.draw do
2
+ match ':controller(/:action(/:id(.:format)))'
3
+ end
File without changes
File without changes
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby1.8
2
+ # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
3
+
4
+ APP_PATH = File.expand_path('../../config/application', __FILE__)
5
+ require File.expand_path('../../config/boot', __FILE__)
6
+ require 'rails/commands'
@@ -0,0 +1,2 @@
1
+ --exclude "spec/*,gems/*"
2
+ --rails
@@ -0,0 +1,23 @@
1
+ $: << File.join(File.dirname(__FILE__), "/../../lib" )
2
+
3
+ # Set the default environment to sqlite3's in_memory database
4
+ ENV['RAILS_ENV'] ||= 'test'
5
+ ENV['RAILS_ROOT'] = 'app_root'
6
+
7
+ # Load the Rails environment and testing framework
8
+ require "#{File.dirname(__FILE__)}/../app_root/config/environment"
9
+ require 'rspec/rails'
10
+
11
+ require 'rspec_candy/helpers'
12
+
13
+ FileUtils.rm(Dir.glob("#{Rails.root}/db/*.db"), :force => true)
14
+
15
+ # Run the migrations
16
+ print "\033[30m" # dark gray text
17
+ ActiveRecord::Migrator.migrate("#{Rails.root}/db/migrate")
18
+ print "\033[0m"
19
+
20
+ RSpec.configure do |config|
21
+ config.use_transactional_fixtures = true
22
+ config.use_instantiated_fixtures = false
23
+ end
@@ -0,0 +1,2 @@
1
+ --colour
2
+ --format progress
@@ -0,0 +1,13 @@
1
+ source :rubygems
2
+
3
+ gem 'assignable_values'
4
+ gem 'rails', '~>3.2.0'
5
+ gem 'rspec'
6
+ gem 'rspec-rails'
7
+ gem 'shoulda-matchers'
8
+ gem 'sqlite3'
9
+ gem 'rspec_candy'
10
+ gem 'ruby-debug', :platforms => :mri_18
11
+ gem 'database_cleaner'
12
+
13
+ gem 'consul', :path => '../..'
@@ -0,0 +1,11 @@
1
+ require 'rake'
2
+ require 'rspec/core/rake_task'
3
+
4
+ desc 'Default: Run all specs for a specific rails version.'
5
+ task :default => :spec
6
+
7
+ desc "Run all specs for a specific rails version"
8
+ RSpec::Core::RakeTask.new(:spec) do |t|
9
+ t.pattern = defined?(SPEC) ? SPEC : ['**/*_spec.rb', '../shared/**/*_spec.rb']
10
+ t.verbose = false
11
+ end
@@ -0,0 +1,4 @@
1
+ .bundle
2
+ db/*.sqlite3
3
+ log/*.log
4
+ tmp/**/*
@@ -0,0 +1,31 @@
1
+ require File.expand_path('../boot', __FILE__)
2
+
3
+ require 'rails/all'
4
+
5
+ # If you have a Gemfile, require the gems listed there, including any gems
6
+ # you've limited to :test, :development, or :production.
7
+ Bundler.require(:default, Rails.env) if defined?(Bundler)
8
+
9
+ module SpecApp
10
+ class Application < Rails::Application
11
+ config.encoding = "utf-8"
12
+
13
+ config.cache_classes = true
14
+ config.whiny_nils = true
15
+
16
+ config.consider_all_requests_local = true
17
+ config.action_controller.perform_caching = false
18
+
19
+ config.action_dispatch.show_exceptions = false
20
+
21
+ config.action_controller.allow_forgery_protection = false
22
+
23
+ config.action_mailer.delivery_method = :test
24
+
25
+ config.active_support.deprecation = :stderr
26
+
27
+ config.root = File.expand_path('../..', __FILE__)
28
+
29
+ # railties.plugins << Rails::Plugin.new(File.expand_path('../../../../..', __FILE__))
30
+ end
31
+ end
@@ -0,0 +1,13 @@
1
+ require 'rubygems'
2
+
3
+ # Set up gems listed in the Gemfile.
4
+ gemfile = File.expand_path('../../Gemfile', __FILE__)
5
+ begin
6
+ ENV['BUNDLE_GEMFILE'] = gemfile
7
+ require 'bundler'
8
+ Bundler.setup
9
+ rescue Bundler::GemNotFound => e
10
+ STDERR.puts e.message
11
+ STDERR.puts "Try running `bundle install`."
12
+ exit!
13
+ end if File.exist?(gemfile)
@@ -0,0 +1,4 @@
1
+ test:
2
+ adapter: sqlite3
3
+ database: db/consul_test.db
4
+ verbosity: quiet
@@ -0,0 +1,5 @@
1
+ # Load the rails application
2
+ require File.expand_path('../application', __FILE__)
3
+
4
+ # Initialize the rails application
5
+ SpecApp::Application.initialize!
@@ -0,0 +1,35 @@
1
+ SpecApp::Application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb
3
+
4
+ # The test environment is used exclusively to run your application's
5
+ # test suite. You never need to work with it otherwise. Remember that
6
+ # your test database is "scratch space" for the test suite and is wiped
7
+ # and recreated between test runs. Don't rely on the data there!
8
+ config.cache_classes = true
9
+
10
+ # Log error messages when you accidentally call methods on nil.
11
+ config.whiny_nils = true
12
+
13
+ # Show full error reports and disable caching
14
+ config.consider_all_requests_local = true
15
+ config.action_controller.perform_caching = false
16
+
17
+ # Raise exceptions instead of rendering exception templates
18
+ config.action_dispatch.show_exceptions = false
19
+
20
+ # Disable request forgery protection in test environment
21
+ config.action_controller.allow_forgery_protection = false
22
+
23
+ # Tell Action Mailer not to deliver emails to the real world.
24
+ # The :test delivery method accumulates sent emails in the
25
+ # ActionMailer::Base.deliveries array.
26
+ config.action_mailer.delivery_method = :test
27
+
28
+ # Use SQL instead of Active Record's schema dumper when creating the test database.
29
+ # This is necessary if your schema can't be completely dumped by the schema dumper,
30
+ # like if you have constraints or database-specific column types
31
+ # config.active_record.schema_format = :sql
32
+
33
+ # Print deprecation notices to the stderr
34
+ config.active_support.deprecation = :stderr
35
+ end
@@ -0,0 +1,7 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
4
+ # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
5
+
6
+ # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
7
+ # Rails.backtrace_cleaner.remove_silencers!
@@ -0,0 +1,10 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Add new inflection rules using the following format
4
+ # (all these examples are active by default):
5
+ # ActiveSupport::Inflector.inflections do |inflect|
6
+ # inflect.plural /^(ox)$/i, '\1en'
7
+ # inflect.singular /^(ox)en/i, '\1'
8
+ # inflect.irregular 'person', 'people'
9
+ # inflect.uncountable %w( fish sheep )
10
+ # end
@@ -0,0 +1,5 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Add new mime types for use in respond_to blocks:
4
+ # Mime::Type.register "text/richtext", :rtf
5
+ # Mime::Type.register_alias "text/html", :iphone
@@ -0,0 +1,7 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Your secret key for verifying the integrity of signed cookies.
4
+ # If you change this key, all old signed cookies will become invalid!
5
+ # Make sure the secret is at least 30 characters and all random,
6
+ # no regular words or you'll be exposed to dictionary attacks.
7
+ SpecApp::Application.config.secret_token = 'cb014a08a45243e7143f31e04774c342c1fba329fd594ae1a480d8283b1a851f425dc08044311fb4be6d000b6e6681de7c76d19148419a5ffa0a9f84556d3b33'
@@ -0,0 +1,8 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ SpecApp::Application.config.session_store :cookie_store, :key => '_app_root_session'
4
+
5
+ # Use the database for sessions instead of the cookie-based default,
6
+ # which shouldn't be used to store highly confidential information
7
+ # (create the session table with "rails generate session_migration")
8
+ # HasDefaultSpecApp::Application.config.session_store :active_record_store
@@ -0,0 +1,3 @@
1
+ SpecApp::Application.routes.draw do
2
+ match ':controller(/:action(/:id(.:format)))'
3
+ end
@@ -0,0 +1 @@
1
+ *.log
@@ -0,0 +1,2 @@
1
+ --exclude "spec/*,gems/*"
2
+ --rails
@@ -0,0 +1,29 @@
1
+ $: << File.join(File.dirname(__FILE__), "/../../lib" )
2
+
3
+ ENV['RAILS_ENV'] ||= 'test'
4
+ ENV['RAILS_ROOT'] = 'app_root'
5
+
6
+ FileUtils.rm(Dir.glob("#{ENV['RAILS_ROOT']}/db/*.db"), :force => true)
7
+
8
+ # Load the Rails environment and testing framework
9
+ require "#{File.dirname(__FILE__)}/../app_root/config/environment"
10
+ require 'rspec/rails'
11
+ require 'database_cleaner'
12
+
13
+ DatabaseCleaner.strategy = :truncation
14
+
15
+ require 'rspec_candy/helpers'
16
+
17
+
18
+ # Run the migrations
19
+ print "\033[30m" # dark gray text
20
+ ActiveRecord::Migrator.migrate("#{Rails.root}/db/migrate")
21
+ print "\033[0m"
22
+
23
+ RSpec.configure do |config|
24
+ config.use_transactional_fixtures = false
25
+ config.use_instantiated_fixtures = false
26
+ config.before(:each) do
27
+ DatabaseCleaner.clean
28
+ end
29
+ end
@@ -6,5 +6,12 @@ class ApplicationController < ActionController::Base
6
6
  current_power do
7
7
  Power.new(User.new)
8
8
  end
9
+
10
+
11
+ private
12
+
13
+ def render_nothing
14
+ render :nothing => true
15
+ end
9
16
 
10
17
  end
@@ -4,34 +4,42 @@ class CakesController < ApplicationController
4
4
 
5
5
  def show
6
6
  notify_spy
7
+ render_nothing
7
8
  end
8
9
 
9
10
  def index
10
11
  notify_spy
12
+ render_nothing
11
13
  end
12
14
 
13
15
  def new
14
16
  notify_spy
17
+ render_nothing
15
18
  end
16
19
 
17
20
  def create
18
21
  notify_spy
22
+ render_nothing
19
23
  end
20
24
 
21
25
  def edit
22
26
  notify_spy
27
+ render_nothing
23
28
  end
24
29
 
25
30
  def update
26
31
  notify_spy
32
+ render_nothing
27
33
  end
28
34
 
29
35
  def destroy
30
36
  notify_spy
37
+ render_nothing
31
38
  end
32
39
 
33
40
  def custom_action
34
41
  notify_spy
42
+ render_nothing
35
43
  end
36
44
 
37
45
  private
@@ -4,6 +4,7 @@ class DashboardsController < ApplicationController
4
4
 
5
5
  def show
6
6
  observe(current_power)
7
+ render_nothing
7
8
  end
8
9
 
9
10
  def error
@@ -4,9 +4,11 @@ class SongsController < ApplicationController
4
4
  skip_power_check :only => :show
5
5
 
6
6
  def show
7
+ render_nothing
7
8
  end
8
9
 
9
10
  def update
11
+ render_nothing
10
12
  end
11
13
 
12
14
  end
@@ -3,9 +3,11 @@ class UsersController < ApplicationController
3
3
  power :always_false, :map => { :show => :always_true }
4
4
 
5
5
  def show
6
+ render_nothing
6
7
  end
7
8
 
8
9
  def update
10
+ render_nothing
9
11
  end
10
12
 
11
13
  end
@@ -0,0 +1,9 @@
1
+ class Client < ActiveRecord::Base
2
+
3
+ has_many :notes
4
+
5
+ def self.active
6
+ scoped(:conditions => ["deleted = ? OR deleted IS NULL", false])
7
+ end
8
+
9
+ end
@@ -105,7 +105,7 @@ describe Consul::Power do
105
105
  end
106
106
 
107
107
  it 'should cache scope ids' do
108
- @user.power.should_receive(:clients).once.and_return(double('scope', :construct_finder_sql => 'SELECT 1').as_null_object)
108
+ @user.power.should_receive(:clients).once.and_return(double('scope', :construct_finder_sql => 'SELECT 1', :to_sql => 'SELECT 1').as_null_object)
109
109
  2.times { @user.power.client_ids }
110
110
  end
111
111
 
metadata CHANGED
@@ -1,61 +1,56 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: consul
3
- version: !ruby/object:Gem::Version
4
- hash: 15
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.4.1
5
5
  prerelease:
6
- segments:
7
- - 0
8
- - 4
9
- - 0
10
- version: 0.4.0
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Henning Koch
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2012-08-01 00:00:00 +02:00
19
- default_executable:
20
- dependencies:
21
- - !ruby/object:Gem::Dependency
12
+ date: 2012-11-23 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
22
15
  name: memoizer
23
- prerelease: false
24
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
25
17
  none: false
26
- requirements:
27
- - - ">="
28
- - !ruby/object:Gem::Version
29
- hash: 3
30
- segments:
31
- - 0
32
- version: "0"
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
33
22
  type: :runtime
34
- version_requirements: *id001
35
- - !ruby/object:Gem::Dependency
36
- name: rails
37
23
  prerelease: false
38
- requirement: &id002 !ruby/object:Gem::Requirement
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: rails
32
+ requirement: !ruby/object:Gem::Requirement
39
33
  none: false
40
- requirements:
41
- - - ">="
42
- - !ruby/object:Gem::Version
43
- hash: 3
44
- segments:
45
- - 0
46
- version: "0"
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
47
38
  type: :runtime
48
- version_requirements: *id002
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
49
46
  description: A scope-based authorization solution for Ruby on Rails.
50
47
  email: henning.koch@makandra.de
51
48
  executables: []
52
-
53
49
  extensions: []
54
-
55
50
  extra_rdoc_files: []
56
-
57
- files:
51
+ files:
58
52
  - .gitignore
53
+ - .travis.yml
59
54
  - README.md
60
55
  - Rakefile
61
56
  - consul.gemspec
@@ -68,16 +63,6 @@ files:
68
63
  - lib/consul/version.rb
69
64
  - spec/rails-2.3/Gemfile
70
65
  - spec/rails-2.3/Rakefile
71
- - spec/rails-2.3/app_root/app/controllers/application_controller.rb
72
- - spec/rails-2.3/app_root/app/controllers/cakes_controller.rb
73
- - spec/rails-2.3/app_root/app/controllers/dashboards_controller.rb
74
- - spec/rails-2.3/app_root/app/controllers/risks_controller.rb
75
- - spec/rails-2.3/app_root/app/controllers/songs_controller.rb
76
- - spec/rails-2.3/app_root/app/controllers/users_controller.rb
77
- - spec/rails-2.3/app_root/app/models/client.rb
78
- - spec/rails-2.3/app_root/app/models/note.rb
79
- - spec/rails-2.3/app_root/app/models/power.rb
80
- - spec/rails-2.3/app_root/app/models/user.rb
81
66
  - spec/rails-2.3/app_root/config/boot.rb
82
67
  - spec/rails-2.3/app_root/config/database.yml
83
68
  - spec/rails-2.3/app_root/config/environment.rb
@@ -86,57 +71,94 @@ files:
86
71
  - spec/rails-2.3/app_root/config/environments/postgresql.rb
87
72
  - spec/rails-2.3/app_root/config/environments/sqlite.rb
88
73
  - spec/rails-2.3/app_root/config/environments/sqlite3.rb
74
+ - spec/rails-2.3/app_root/config/initializers/fix_missing_source_file.rb
89
75
  - spec/rails-2.3/app_root/config/preinitializer.rb
90
76
  - spec/rails-2.3/app_root/config/routes.rb
91
- - spec/rails-2.3/app_root/db/migrate/001_create_users.rb
92
- - spec/rails-2.3/app_root/db/migrate/002_create_clients.rb
93
- - spec/rails-2.3/app_root/db/migrate/003_create_notes.rb
94
- - spec/rails-2.3/app_root/lib/console_with_fixtures.rb
95
77
  - spec/rails-2.3/app_root/log/.gitignore
96
- - spec/rails-2.3/app_root/script/console
97
78
  - spec/rails-2.3/rcov.opts
98
79
  - spec/rails-2.3/spec.opts
99
- - spec/rails-2.3/spec_helper.rb
80
+ - spec/rails-2.3/spec/spec_helper.rb
81
+ - spec/rails-3.0/.rspec
82
+ - spec/rails-3.0/Gemfile
83
+ - spec/rails-3.0/Rakefile
84
+ - spec/rails-3.0/app_root/.gitignore
85
+ - spec/rails-3.0/app_root/config/application.rb
86
+ - spec/rails-3.0/app_root/config/boot.rb
87
+ - spec/rails-3.0/app_root/config/database.yml
88
+ - spec/rails-3.0/app_root/config/environment.rb
89
+ - spec/rails-3.0/app_root/config/environments/test.rb
90
+ - spec/rails-3.0/app_root/config/initializers/backtrace_silencers.rb
91
+ - spec/rails-3.0/app_root/config/initializers/inflections.rb
92
+ - spec/rails-3.0/app_root/config/initializers/mime_types.rb
93
+ - spec/rails-3.0/app_root/config/initializers/secret_token.rb
94
+ - spec/rails-3.0/app_root/config/initializers/session_store.rb
95
+ - spec/rails-3.0/app_root/config/routes.rb
96
+ - spec/rails-3.0/app_root/lib/tasks/.gitkeep
97
+ - spec/rails-3.0/app_root/log/.gitkeep
98
+ - spec/rails-3.0/app_root/script/rails
99
+ - spec/rails-3.0/rcov.opts
100
+ - spec/rails-3.0/spec/spec_helper.rb
101
+ - spec/rails-3.2/.rspec
102
+ - spec/rails-3.2/Gemfile
103
+ - spec/rails-3.2/Rakefile
104
+ - spec/rails-3.2/app_root/.gitignore
105
+ - spec/rails-3.2/app_root/config/application.rb
106
+ - spec/rails-3.2/app_root/config/boot.rb
107
+ - spec/rails-3.2/app_root/config/database.yml
108
+ - spec/rails-3.2/app_root/config/environment.rb
109
+ - spec/rails-3.2/app_root/config/environments/test.rb
110
+ - spec/rails-3.2/app_root/config/initializers/backtrace_silencers.rb
111
+ - spec/rails-3.2/app_root/config/initializers/inflections.rb
112
+ - spec/rails-3.2/app_root/config/initializers/mime_types.rb
113
+ - spec/rails-3.2/app_root/config/initializers/secret_token.rb
114
+ - spec/rails-3.2/app_root/config/initializers/session_store.rb
115
+ - spec/rails-3.2/app_root/config/routes.rb
116
+ - spec/rails-3.2/app_root/log/.gitignore
117
+ - spec/rails-3.2/rcov.opts
118
+ - spec/rails-3.2/spec/spec_helper.rb
119
+ - spec/shared/app_root/app/controllers/application_controller.rb
120
+ - spec/shared/app_root/app/controllers/cakes_controller.rb
121
+ - spec/shared/app_root/app/controllers/dashboards_controller.rb
122
+ - spec/shared/app_root/app/controllers/risks_controller.rb
123
+ - spec/shared/app_root/app/controllers/songs_controller.rb
124
+ - spec/shared/app_root/app/controllers/users_controller.rb
125
+ - spec/shared/app_root/app/models/client.rb
126
+ - spec/shared/app_root/app/models/note.rb
127
+ - spec/shared/app_root/app/models/power.rb
128
+ - spec/shared/app_root/app/models/user.rb
129
+ - spec/shared/app_root/db/migrate/001_create_users.rb
130
+ - spec/shared/app_root/db/migrate/002_create_clients.rb
131
+ - spec/shared/app_root/db/migrate/003_create_notes.rb
100
132
  - spec/shared/consul/active_record_spec.rb
133
+ - spec/shared/consul/controllers/cakes_controller_spec.rb
134
+ - spec/shared/consul/controllers/dashboards_controller_spec.rb
135
+ - spec/shared/consul/controllers/risks_controller_spec.rb
136
+ - spec/shared/consul/controllers/songs_controller_spec.rb
137
+ - spec/shared/consul/controllers/users_controller_spec.rb
101
138
  - spec/shared/consul/power_spec.rb
102
- - spec/shared/controllers/cakes_controller_spec.rb
103
- - spec/shared/controllers/dashboards_controller_spec.rb
104
- - spec/shared/controllers/risks_controller_spec.rb
105
- - spec/shared/controllers/songs_controller_spec.rb
106
- - spec/shared/controllers/users_controller_spec.rb
107
- has_rdoc: true
108
139
  homepage: https://github.com/makandra/consul
109
140
  licenses: []
110
-
111
141
  post_install_message:
112
142
  rdoc_options: []
113
-
114
- require_paths:
143
+ require_paths:
115
144
  - lib
116
- required_ruby_version: !ruby/object:Gem::Requirement
145
+ required_ruby_version: !ruby/object:Gem::Requirement
117
146
  none: false
118
- requirements:
119
- - - ">="
120
- - !ruby/object:Gem::Version
121
- hash: 3
122
- segments:
123
- - 0
124
- version: "0"
125
- required_rubygems_version: !ruby/object:Gem::Requirement
147
+ requirements:
148
+ - - ! '>='
149
+ - !ruby/object:Gem::Version
150
+ version: '0'
151
+ required_rubygems_version: !ruby/object:Gem::Requirement
126
152
  none: false
127
- requirements:
128
- - - ">="
129
- - !ruby/object:Gem::Version
130
- hash: 3
131
- segments:
132
- - 0
133
- version: "0"
153
+ requirements:
154
+ - - ! '>='
155
+ - !ruby/object:Gem::Version
156
+ version: '0'
134
157
  requirements: []
135
-
136
158
  rubyforge_project:
137
- rubygems_version: 1.3.9.4
159
+ rubygems_version: 1.8.24
138
160
  signing_key:
139
161
  specification_version: 3
140
162
  summary: A scope-based authorization solution for Ruby on Rails.
141
163
  test_files: []
142
-
164
+ has_rdoc:
@@ -1,7 +0,0 @@
1
- class Client < ActiveRecord::Base
2
-
3
- has_many :notes
4
-
5
- named_scope :active, :conditions => ["deleted = ? OR deleted IS NULL", false]
6
-
7
- end
@@ -1,4 +0,0 @@
1
- # Loads fixtures into the database when running the test app via the console
2
- (ENV['FIXTURES'] ? ENV['FIXTURES'].split(/,/) : Dir.glob(File.join(Rails.root, '../fixtures/*.{yml,csv}'))).each do |fixture_file|
3
- Fixtures.create_fixtures(File.join(Rails.root, '../fixtures'), File.basename(fixture_file, '.*'))
4
- end
@@ -1,7 +0,0 @@
1
- irb = RUBY_PLATFORM =~ /(:?mswin|mingw)/ ? 'irb.bat' : 'irb'
2
- libs = " -r irb/completion"
3
- libs << " -r test/test_helper"
4
- libs << " -r console_app"
5
- libs << " -r console_with_helpers"
6
- libs << " -r console_with_fixtures"
7
- exec "#{irb} #{libs} --simple-prompt"