before_actions 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +106 -0
- data/Rakefile +13 -19
- data/app/controllers/before_actions/foo_controller.rb +8 -0
- data/lib/before_actions.rb +7 -1
- data/lib/before_actions/controller.rb +29 -20
- data/lib/before_actions/engine.rb +7 -0
- data/lib/before_actions/version.rb +1 -1
- data/spec/controllers/admin_foos_controller_spec.rb +78 -0
- data/spec/controllers/foos_controller_spec.rb +139 -0
- data/{test → spec}/dummy/README.rdoc +0 -0
- data/{test → spec}/dummy/Rakefile +0 -0
- data/{test → spec}/dummy/app/assets/javascripts/application.js +0 -3
- data/{test → spec}/dummy/app/assets/stylesheets/application.css +0 -0
- data/spec/dummy/app/controllers/admin_foos_controller.rb +53 -0
- data/{test → spec}/dummy/app/controllers/application_controller.rb +0 -0
- data/spec/dummy/app/controllers/foos_controller.rb +92 -0
- data/{test → spec}/dummy/app/helpers/application_helper.rb +0 -0
- data/spec/dummy/app/models/admin_foo.rb +2 -0
- data/spec/dummy/app/models/foo.rb +3 -0
- data/spec/dummy/app/views/admin_foos/_form.html.erb +21 -0
- data/spec/dummy/app/views/admin_foos/edit.html.erb +6 -0
- data/spec/dummy/app/views/admin_foos/index.html.erb +25 -0
- data/spec/dummy/app/views/admin_foos/new.html.erb +5 -0
- data/spec/dummy/app/views/admin_foos/show.html.erb +9 -0
- data/spec/dummy/app/views/foos/_form.html.erb +21 -0
- data/spec/dummy/app/views/foos/edit.html.erb +6 -0
- data/spec/dummy/app/views/foos/index.html.erb +25 -0
- data/spec/dummy/app/views/foos/new.html.erb +5 -0
- data/spec/dummy/app/views/foos/show.html.erb +9 -0
- data/{test → spec}/dummy/app/views/layouts/application.html.erb +0 -0
- data/{test → spec}/dummy/bin/bundle +0 -0
- data/{test → spec}/dummy/bin/rails +0 -0
- data/{test → spec}/dummy/bin/rake +0 -0
- data/{test → spec}/dummy/config.ru +0 -0
- data/{test → spec}/dummy/config/application.rb +8 -0
- data/{test → spec}/dummy/config/boot.rb +0 -0
- data/{test → spec}/dummy/config/database.yml +0 -0
- data/{test → spec}/dummy/config/environment.rb +0 -0
- data/{test → spec}/dummy/config/environments/development.rb +0 -0
- data/{test → spec}/dummy/config/environments/production.rb +0 -0
- data/{test → spec}/dummy/config/environments/test.rb +0 -0
- data/{test → spec}/dummy/config/initializers/backtrace_silencers.rb +0 -0
- data/{test → spec}/dummy/config/initializers/filter_parameter_logging.rb +0 -0
- data/{test → spec}/dummy/config/initializers/inflections.rb +0 -0
- data/{test → spec}/dummy/config/initializers/mime_types.rb +0 -0
- data/{test → spec}/dummy/config/initializers/secret_token.rb +0 -0
- data/spec/dummy/config/initializers/session_store.rb +3 -0
- data/{test → spec}/dummy/config/initializers/wrap_parameters.rb +0 -0
- data/{test → spec}/dummy/config/locales/en.yml +0 -0
- data/{test → spec}/dummy/config/routes.rb +4 -0
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/db/migrate/20140912040816_create_foos.rb +9 -0
- data/spec/dummy/db/migrate/20140912042735_create_admin_foos.rb +9 -0
- data/spec/dummy/db/schema.rb +28 -0
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/lib/templates/rails/scaffold_controller/controller.rb +97 -0
- data/spec/dummy/log/development.log +15 -0
- data/spec/dummy/log/test.log +1590 -0
- data/{test → spec}/dummy/public/404.html +0 -0
- data/{test → spec}/dummy/public/422.html +0 -0
- data/{test → spec}/dummy/public/500.html +0 -0
- data/{test → spec}/dummy/public/favicon.ico +0 -0
- data/spec/rails_helper.rb +54 -0
- data/spec/spec_helper.rb +85 -0
- metadata +168 -74
- data/README.rdoc +0 -60
- data/lib/before_actions/command.rb +0 -15
- data/test/before_actions_test.rb +0 -7
- data/test/dummy/config/initializers/session_store.rb +0 -3
- data/test/integration/navigation_test.rb +0 -10
- data/test/test_helper.rb +0 -15
@@ -1,15 +0,0 @@
|
|
1
|
-
module BeforeActions
|
2
|
-
class Command
|
3
|
-
|
4
|
-
def initialize(controller)
|
5
|
-
@controller = controller
|
6
|
-
end
|
7
|
-
|
8
|
-
def actions(*actions, &block)
|
9
|
-
if actions.empty? || actions.map(&:to_s).include?(@controller.action_name)
|
10
|
-
@controller.instance_eval(&block)
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
end
|
15
|
-
end
|
data/test/before_actions_test.rb
DELETED
data/test/test_helper.rb
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
# Configure Rails Environment
|
2
|
-
ENV["RAILS_ENV"] = "test"
|
3
|
-
|
4
|
-
require File.expand_path("../dummy/config/environment.rb", __FILE__)
|
5
|
-
require "rails/test_help"
|
6
|
-
|
7
|
-
Rails.backtrace_cleaner.remove_silencers!
|
8
|
-
|
9
|
-
# Load support files
|
10
|
-
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
|
11
|
-
|
12
|
-
# Load fixtures from the engine
|
13
|
-
if ActiveSupport::TestCase.method_defined?(:fixture_path=)
|
14
|
-
ActiveSupport::TestCase.fixture_path = File.expand_path("../fixtures", __FILE__)
|
15
|
-
end
|