inkling 0.0.3a

Sign up to get free protection for your applications and to get access to all the features.
Files changed (88) hide show
  1. data/README.txt +194 -0
  2. data/app/controllers/inkling/admin/base_controller.rb +5 -0
  3. data/app/controllers/inkling/admin/content_types_controller.rb +4 -0
  4. data/app/controllers/inkling/admin/permissions_controller.rb +4 -0
  5. data/app/controllers/inkling/admin/roles_controller.rb +4 -0
  6. data/app/controllers/inkling/admin/users_controller.rb +4 -0
  7. data/app/controllers/inkling/base_controller.rb +9 -0
  8. data/app/controllers/inkling/content_controller.rb +6 -0
  9. data/app/controllers/inkling/home_controller.rb +44 -0
  10. data/app/controllers/inkling/paths_controller.rb +31 -0
  11. data/app/controllers/inkling/proxying_controller.rb +19 -0
  12. data/app/controllers/inkling/themes_controller.rb +4 -0
  13. data/app/controllers/inkling/users/confirmations_controller.rb +3 -0
  14. data/app/controllers/inkling/users/passwords_controller.rb +1 -0
  15. data/app/controllers/inkling/users/sessions_controller.rb +5 -0
  16. data/app/models/inkling/can_can_action.rb +5 -0
  17. data/app/models/inkling/log.rb +3 -0
  18. data/app/models/inkling/path.rb +54 -0
  19. data/app/models/inkling/permission.rb +7 -0
  20. data/app/models/inkling/role.rb +10 -0
  21. data/app/models/inkling/role_membership.rb +8 -0
  22. data/app/models/inkling/theme.rb +74 -0
  23. data/app/models/inkling/type.rb +4 -0
  24. data/app/models/inkling/user.rb +16 -0
  25. data/app/views/inkling/admin/permissions/_form.html.erb +15 -0
  26. data/app/views/inkling/admin/permissions/edit.html.erb +1 -0
  27. data/app/views/inkling/admin/permissions/index.html.erb +26 -0
  28. data/app/views/inkling/admin/permissions/new.html.erb +1 -0
  29. data/app/views/inkling/admin/permissions/show.html.erb +11 -0
  30. data/app/views/inkling/admin/roles/index.html.erb +3 -0
  31. data/app/views/inkling/admin/sites/index.html.erb +1 -0
  32. data/app/views/inkling/admin/types/index.html.erb +12 -0
  33. data/app/views/inkling/admin/users/_form.html.erb +16 -0
  34. data/app/views/inkling/admin/users/edit.html.erb +1 -0
  35. data/app/views/inkling/admin/users/index.html.erb +18 -0
  36. data/app/views/inkling/admin/users/new.html.erb +1 -0
  37. data/app/views/inkling/admin/users/show.html.erb +11 -0
  38. data/app/views/inkling/home/_dashboard.html.erb +29 -0
  39. data/app/views/inkling/home/dashboard.html.erb +13 -0
  40. data/app/views/inkling/paths/_content_form.html.erb +7 -0
  41. data/app/views/inkling/paths/_path.html.erb +17 -0
  42. data/app/views/inkling/paths/index.html.erb +14 -0
  43. data/app/views/inkling/paths/update_tree.js.erb +2 -0
  44. data/app/views/inkling/themes/_form.html.erb +17 -0
  45. data/app/views/inkling/themes/edit.html.erb +1 -0
  46. data/app/views/inkling/themes/index.html.erb +11 -0
  47. data/app/views/inkling/themes/new.html.erb +1 -0
  48. data/app/views/inkling/themes/show.html.erb +1 -0
  49. data/app/views/inkling/users/confirmations/new.html.erb +12 -0
  50. data/app/views/inkling/users/mailer/confirmation_instructions.html.erb +5 -0
  51. data/app/views/inkling/users/mailer/reset_password_instructions.html.erb +8 -0
  52. data/app/views/inkling/users/mailer/unlock_instructions.html.erb +7 -0
  53. data/app/views/inkling/users/passwords/edit.html.erb +16 -0
  54. data/app/views/inkling/users/passwords/new.html.erb +12 -0
  55. data/app/views/inkling/users/registrations/edit.html.erb +25 -0
  56. data/app/views/inkling/users/registrations/new.html.erb +18 -0
  57. data/app/views/inkling/users/sessions/new.html.erb +17 -0
  58. data/app/views/inkling/users/shared/_links.erb +19 -0
  59. data/app/views/inkling/users/unlocks/new.html.erb +12 -0
  60. data/app/views/layouts/inkling/admin.html.erb +43 -0
  61. data/app/views/layouts/inkling/manage.html.erb +43 -0
  62. data/bin/inkling +3 -0
  63. data/config/initializers/init.rb +4 -0
  64. data/config/initializers/rspec_generator.rb +6 -0
  65. data/config/routes.rb +18 -0
  66. data/lib/generators/inkling_generator.rb +19 -0
  67. data/lib/generators/templates/create_inkling_tables.rb +73 -0
  68. data/lib/inkling/ability.rb +21 -0
  69. data/lib/inkling/commands/generator.rb +66 -0
  70. data/lib/inkling/commands.rb +12 -0
  71. data/lib/inkling/engine.rb +35 -0
  72. data/lib/inkling/routing.rb +26 -0
  73. data/lib/inkling/slugs.rb +17 -0
  74. data/lib/inkling/types.rb +61 -0
  75. data/lib/inkling/util/migration_helpers.rb +22 -0
  76. data/lib/inkling/version.rb +3 -0
  77. data/lib/inkling.rb +3 -0
  78. data/lib/tasks/cucumber.rake +53 -0
  79. data/lib/tasks/inkling.rake +48 -0
  80. data/lib/tasks/rspec.rake +68 -0
  81. data/spec/controllers/inkling/proxying_spec.rb +9 -0
  82. data/spec/models/path_spec.rb +13 -0
  83. data/spec/models/permission_spec.rb +29 -0
  84. data/spec/models/theme_spec.rb +66 -0
  85. data/spec/spec_helper.rb +26 -0
  86. data/spec/support/devise.rb +3 -0
  87. data/spec/support/inkling_spec_helper.rb +1 -0
  88. metadata +222 -0
@@ -0,0 +1,35 @@
1
+ require "inkling"
2
+ require "inkling/types"
3
+ require "inkling/version"
4
+ require "inkling/slugs"
5
+ require "inkling/routing"
6
+ require 'cancan'
7
+ require "inkling/ability"
8
+ require "devise"
9
+ require 'devise/orm/active_record'
10
+
11
+ require "rails"
12
+
13
+ module Inkling
14
+ TMP_DIR = "tmp/inkling/"
15
+ THEMES_DIR = "#{TMP_DIR}themes/"
16
+ THEME_LAYOUTS_DIR = "#{THEMES_DIR}layouts/"
17
+ BOOTSTRAP_TASKS = []
18
+
19
+ class Engine < Rails::Engine
20
+ config.inkling = Inkling
21
+
22
+ initializer "static assets" do |app|
23
+ app.middleware.insert_after ::ActionDispatch::Static, ::ActionDispatch::Static, "#{root}/public"
24
+ end
25
+ end
26
+
27
+ WELCOME_MSG = <<-MSG
28
+
29
+ Welcome!
30
+ Inkling was bootstrapped at #{Time.now}.
31
+ Start the server ('rails server') then visit http://localhost:3000/inkling/users/sign_in.
32
+ Use the default admin account admin@localhost.com/test123.
33
+
34
+ MSG
35
+ end
@@ -0,0 +1,26 @@
1
+ require 'ruby-debug'
2
+ module Inkling
3
+ module Routing
4
+ class TypeConstraint
5
+ attr_accessor :type
6
+
7
+ def initialize(type, prefix = nil)
8
+ @type = type
9
+ @prefix = prefix
10
+ end
11
+
12
+ def matches?(request)
13
+ path = @prefix.nil? ? request.path : request.path.gsub(@prefix, "")
14
+ matching_path = Inkling::Path.find_by_slug(path)
15
+
16
+ if matching_path
17
+ result = matching_path.content.is_a? @type.constantize
18
+ request.params[:id] = matching_path.content.id
19
+ result
20
+ else
21
+ false
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,17 @@
1
+ module Inkling
2
+ module Slugs
3
+ #copied from enki see http://www.enkiblog.com/
4
+ def sluggerize(slug)
5
+ text = slug.dup
6
+ text.downcase!
7
+ text.gsub!(/&(\d)+;/, '') # Ditch Entities
8
+ text.gsub!('&', 'and') # Replace & with 'and'
9
+ text.gsub!(/['"]/, '') # replace quotes by nothing
10
+ text.gsub!(/\ +/, '-') # replace all white space sections with a dash
11
+ text.gsub!(/(-)$/, '') # trim dashes
12
+ text.gsub!(/^(-)/, '') # trim dashes
13
+ text.gsub!(/[^\/a-zA-Z0-9\-]/, '-') # Get rid of anything we don't like
14
+ text
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,61 @@
1
+ module Inkling
2
+ module Types
3
+ module ActsAs
4
+ def self.included(base)
5
+ base.extend(ClassMethods)
6
+ end
7
+
8
+ module ClassMethods
9
+ def acts_as_inkling(friendly_name = self.class.name)
10
+
11
+ Inkling::Types::Register.register(self)
12
+ cattr_accessor :friendly_name
13
+ self.friendly_name = (friendly_name or self)
14
+ has_one :path, :as => :content, :dependent => :destroy, :class_name => "Inkling::Path"
15
+ after_create :create_path
16
+ after_update :update_path
17
+
18
+ send :include, InstanceMethods
19
+ end
20
+ end
21
+ end
22
+
23
+ module InstanceMethods
24
+ #Creates a path to represent the ContentType instance; the path is used for routing, etc..
25
+ def create_path
26
+ path = Inkling::Path.new
27
+ path.content = self
28
+ path.save!
29
+ end
30
+
31
+ def update_path
32
+ self.path.update_slug!
33
+ self.path.save!
34
+ end
35
+ end
36
+
37
+ class Register
38
+ def self.listed
39
+ @listed ||= []
40
+ end
41
+
42
+ def self.keys
43
+ @keys ||= []
44
+ end
45
+
46
+ def self.register(type)
47
+ if keys.include?(type.name)
48
+ flush!
49
+ end
50
+
51
+ keys << type.name
52
+ listed << type unless listed.index(type)
53
+ end
54
+
55
+ def self.flush!
56
+ @keys = []
57
+ @listed = []
58
+ end
59
+ end
60
+ end
61
+ end
@@ -0,0 +1,22 @@
1
+ module Inkling
2
+ module Util
3
+ module MigrationHelpers
4
+ def add_foreign_key(from_table, from_column, to_table)
5
+ constraint_name = "fk_#{from_table}_#{from_column}"
6
+
7
+ execute %{alter table #{from_table}
8
+ add constraint #{constraint_name}
9
+ foreign key (#{from_column})
10
+ references #{to_table}(id)}
11
+ end
12
+
13
+
14
+ def remove_foreign_key(from_table, from_column)
15
+ constraint_name = "fk_#{from_table}_#{from_column}"
16
+
17
+ execute %{alter table #{from_table}
18
+ drop foreign key #{constraint_name}}
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,3 @@
1
+ module Inkling
2
+ VERSION = "0.0.3a"
3
+ end
data/lib/inkling.rb ADDED
@@ -0,0 +1,3 @@
1
+ require 'inkling/engine' if defined?(Rails)
2
+
3
+
@@ -0,0 +1,53 @@
1
+ # IMPORTANT: This file is generated by cucumber-rails - edit at your own peril.
2
+ # It is recommended to regenerate this file in the future when you upgrade to a
3
+ # newer version of cucumber-rails. Consider adding your own code to a new file
4
+ # instead of editing this one. Cucumber will automatically load all features/**/*.rb
5
+ # files.
6
+
7
+
8
+ unless ARGV.any? {|a| a =~ /^gems/} # Don't load anything when running the gems:* tasks
9
+
10
+ vendored_cucumber_bin = Dir["#{Rails.root}/vendor/{gems,plugins}/cucumber*/bin/cucumber"].first
11
+ $LOAD_PATH.unshift(File.dirname(vendored_cucumber_bin) + '/../lib') unless vendored_cucumber_bin.nil?
12
+
13
+ begin
14
+ require 'cucumber/rake/task'
15
+
16
+ namespace :cucumber do
17
+ Cucumber::Rake::Task.new({:ok => 'db:test:prepare'}, 'Run features that should pass') do |t|
18
+ t.binary = vendored_cucumber_bin # If nil, the gem's binary is used.
19
+ t.fork = true # You may get faster startup if you set this to false
20
+ t.profile = 'default'
21
+ end
22
+
23
+ Cucumber::Rake::Task.new({:wip => 'db:test:prepare'}, 'Run features that are being worked on') do |t|
24
+ t.binary = vendored_cucumber_bin
25
+ t.fork = true # You may get faster startup if you set this to false
26
+ t.profile = 'wip'
27
+ end
28
+
29
+ Cucumber::Rake::Task.new({:rerun => 'db:test:prepare'}, 'Record failing features and run only them if any exist') do |t|
30
+ t.binary = vendored_cucumber_bin
31
+ t.fork = true # You may get faster startup if you set this to false
32
+ t.profile = 'rerun'
33
+ end
34
+
35
+ desc 'Run all features'
36
+ task :all => [:ok, :wip]
37
+ end
38
+ desc 'Alias for cucumber:ok'
39
+ task :cucumber => 'cucumber:ok'
40
+
41
+ task :default => :cucumber
42
+
43
+ task :features => :cucumber do
44
+ STDERR.puts "*** The 'features' task is deprecated. See rake -T cucumber ***"
45
+ end
46
+ rescue LoadError
47
+ desc 'cucumber rake task not available (cucumber not installed)'
48
+ task :cucumber do
49
+ abort 'Cucumber rake task is not available. Be sure to install cucumber as a gem or plugin'
50
+ end
51
+ end
52
+
53
+ end
@@ -0,0 +1,48 @@
1
+ namespace :inkling do
2
+
3
+ desc "Boostraps (calls generators, creates databases, runs migrations, seeds the database) Inkling"
4
+ task :bootstrap => ["environment", "inkling:generate", "inkling:run_bootstrap_tasks", "db:create", "db:migrate", "inkling:init", "inkling:welcome_msg"]
5
+
6
+ desc "Wipes migrations dir Hard reset (caveat raker), then bootstrap. Destroys db, recreates it, regenerates all migrations, migrates, and initializes with inkling data"
7
+ task :rebuild => ["environment", "inkling:destroy_migrations", "db:drop", "inkling:bootstrap"]
8
+
9
+
10
+ desc "Runs system('rm -rf db/migrate/*')"
11
+ task :destroy_migrations do
12
+ system("rm -rf db/migrate/*")
13
+ end
14
+
15
+
16
+ desc "Runs system('rails generate inkling')"
17
+ task :generate do
18
+ system("rails generate inkling")
19
+ end
20
+
21
+ desc "Iterates through array Inkling::REBUILD_TASKS and executes each task it finds (useful to add your bootstrap sequence to inkling:rebuild)"
22
+ task :run_bootstrap_tasks do
23
+ for task in Inkling::BOOTSTRAP_TASKS
24
+ Rake::Task[task].execute
25
+ end
26
+ end
27
+
28
+ desc "Create a default user with login 'admin' and password 'admin'"
29
+ task :default_admin => [:environment] do
30
+ user = Inkling::User.create!(:email => "admin@localhost.com", :password => "test123", :password_confirmation => "test123")
31
+ Inkling::RoleMembership.create!(:user => user, :role => Inkling::Role.find_by_name(Inkling::Role::ADMIN))
32
+ puts "Inkling> Created default administrator: login - 'admin@localhost.com', password - 'test123'."
33
+ end
34
+
35
+ desc "Initializes inkling data."
36
+ task :init => [:environment] do
37
+ Inkling::Role.create!(:name => Inkling::Role::ADMIN)
38
+ Rake::Task["inkling:default_admin"].execute
39
+ puts "Inkling> Created administrator role."
40
+ end
41
+
42
+ task :welcome_msg do
43
+ puts Inkling::WELCOME_MSG
44
+ end
45
+
46
+ desc "Runs specs and cukes."
47
+ task :megatest => [:environment, :spec, :cucumber]
48
+ end
@@ -0,0 +1,68 @@
1
+ begin
2
+ require 'rspec/core'
3
+ require 'rspec/core/rake_task'
4
+ rescue MissingSourceFile
5
+ module Rspec
6
+ module Core
7
+ class RakeTask
8
+ def initialize(name)
9
+ task name do
10
+ # if rspec-rails is a configured gem, this will output helpful material and exit ...
11
+ require File.expand_path(File.dirname(__FILE__) + "/../../config/environment")
12
+
13
+ # ... otherwise, do this:
14
+ raise <<-MSG
15
+
16
+ #{"*" * 80}
17
+ * You are trying to run an rspec rake task defined in
18
+ * #{__FILE__},
19
+ * but rspec can not be found in vendor/gems, vendor/plugins or system gems.
20
+ #{"*" * 80}
21
+ MSG
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
28
+
29
+ Rake.application.instance_variable_get('@tasks').delete('default')
30
+
31
+ spec_prereq = Rails.root.join('config', 'database.yml').exist? ? "db:test:prepare" : :noop
32
+ task :noop do
33
+ end
34
+
35
+ task :default => :spec
36
+ task :stats => "spec:statsetup"
37
+
38
+ desc "Run all specs in spec directory (excluding plugin specs)"
39
+ Rspec::Core::RakeTask.new(:spec => spec_prereq)
40
+
41
+ namespace :spec do
42
+ [:requests, :models, :controllers, :views, :helpers, :mailers, :lib].each do |sub|
43
+ desc "Run the code examples in spec/#{sub}"
44
+ Rspec::Core::RakeTask.new(sub => spec_prereq) do |t|
45
+ t.pattern = "./spec/#{sub}/**/*_spec.rb"
46
+ end
47
+ end
48
+
49
+ task :statsetup do
50
+ require 'rails/code_statistics'
51
+ ::STATS_DIRECTORIES << %w(Model\ specs spec/models) if File.exist?('spec/models')
52
+ ::STATS_DIRECTORIES << %w(View\ specs spec/views) if File.exist?('spec/views')
53
+ ::STATS_DIRECTORIES << %w(Controller\ specs spec/controllers) if File.exist?('spec/controllers')
54
+ ::STATS_DIRECTORIES << %w(Helper\ specs spec/helpers) if File.exist?('spec/helpers')
55
+ ::STATS_DIRECTORIES << %w(Library\ specs spec/lib) if File.exist?('spec/lib')
56
+ ::STATS_DIRECTORIES << %w(Mailer\ specs spec/mailers) if File.exist?('spec/mailers')
57
+ ::STATS_DIRECTORIES << %w(Routing\ specs spec/routing) if File.exist?('spec/routing')
58
+ ::STATS_DIRECTORIES << %w(Request\ specs spec/requests) if File.exist?('spec/requests')
59
+ ::CodeStatistics::TEST_TYPES << "Model specs" if File.exist?('spec/models')
60
+ ::CodeStatistics::TEST_TYPES << "View specs" if File.exist?('spec/views')
61
+ ::CodeStatistics::TEST_TYPES << "Controller specs" if File.exist?('spec/controllers')
62
+ ::CodeStatistics::TEST_TYPES << "Helper specs" if File.exist?('spec/helpers')
63
+ ::CodeStatistics::TEST_TYPES << "Library specs" if File.exist?('spec/lib')
64
+ ::CodeStatistics::TEST_TYPES << "Mailer specs" if File.exist?('spec/mailer')
65
+ ::CodeStatistics::TEST_TYPES << "Routing specs" if File.exist?('spec/routing')
66
+ ::CodeStatistics::TEST_TYPES << "Request specs" if File.exist?('spec/requests')
67
+ end
68
+ end
@@ -0,0 +1,9 @@
1
+ require File.dirname(__FILE__) + '/../../spec_helper'
2
+
3
+ describe Inkling::ProxyingController do
4
+
5
+ it "should assemble a resource route and proxy onto it" do
6
+ post 'proxy', {:content_type => "Inkling::Foo"}
7
+ response.redirect_url.should eql "http://test.host/inkling/content_types/foo/new"
8
+ end
9
+ end
@@ -0,0 +1,13 @@
1
+ require File.dirname(__FILE__) + '/../spec_helper'
2
+
3
+ describe Inkling::Path do
4
+
5
+ # let(:foo) {ContentTypes::Foo.create(:name => "1")}
6
+ #
7
+ # it "should update the path based on its parent" do
8
+ # foo2 = ContentTypes::Foo.create(:name => "2")
9
+ # foo2.path.move_to_child_of foo.path
10
+ # foo2.save
11
+ # foo2.path.slug.should == "/1/2"
12
+ # end
13
+ end
@@ -0,0 +1,29 @@
1
+ require File.dirname(__FILE__) + '/../spec_helper'
2
+
3
+ describe Inkling::Permission do
4
+ let(:type) {Inkling::Type.create!(:klass_name => "String")}
5
+ let(:user) {Inkling::User.create!(:email => "admin@localhost.com", :password => "test123", :password_confirmation => "test123")}
6
+
7
+ it "should let an administrator have automatic manage permission over foo" do
8
+ create_role_and_membership(Inkling::Role::ADMIN, user)
9
+
10
+ ability = Inkling::Ability.new(user)
11
+ ability.can?(:manage, String).should be_true
12
+ end
13
+
14
+ it "should apply CanCanAction based perm.s via the role to the user on the type" do
15
+ role = create_role_and_membership("content_editor", user)
16
+ update_action = Inkling::CanCanAction.create!(:name => "update")
17
+ foo_update_permission = Inkling::Permission.create(:role_id => role.id, :can_can_action_id => update_action.id, :type_id => type.id)
18
+ ability = Inkling::Ability.new(user)
19
+ ability.can?(:update, String).should be_true
20
+ ability.cannot?(:delete, String).should be_true
21
+ end
22
+
23
+
24
+ def create_role_and_membership(role_name, user)
25
+ role = Inkling::Role.create(:name => role_name)
26
+ membership = Inkling::RoleMembership.create!(:user => user, :role => role)
27
+ role
28
+ end
29
+ end
@@ -0,0 +1,66 @@
1
+ require File.dirname(__FILE__) + '/../spec_helper'
2
+
3
+ describe Inkling::Theme do
4
+
5
+ default = <<-DEFAULT
6
+ <html>
7
+ <head>
8
+ <title>Inkling Administration</title>
9
+ <meta http-equiv="content-type" content="text/html; charset=utf-8" />
10
+ <meta name="keywords" content="" />
11
+ <meta name="description" content="" />
12
+ </head>
13
+ <body>
14
+
15
+
16
+ <div id="header">
17
+ <div id="logo">
18
+ <h1><%= link_to 'Inkling', inkling_user_root_path %></h1>
19
+ </div>
20
+ <div id="tabs">
21
+ <%= link_to 'Home', inkling_user_root_path %> | <%= link_to 'Tree', inkling_paths_path %>
22
+ </div>
23
+ </div>
24
+
25
+ <div class="notice"><%= notice %></div>
26
+ <div class="alert"><%= alert %></div>
27
+
28
+ <div id="page">
29
+ <div id="main">
30
+ <%= yield %>
31
+ </div>
32
+ </div>
33
+
34
+ <div id="footer">
35
+ <span id="version" align='center'>Inkling version <%= Inkling::VERSION %></span>
36
+ </div>
37
+
38
+
39
+ </body>
40
+ </html>
41
+ DEFAULT
42
+
43
+ let(:theme) {Inkling::Theme.create!(:name => "default", :body => default)}
44
+
45
+ it "should write the theme to the tmp/inkling/themes directory" do
46
+ theme
47
+ lines = []
48
+ file = File.open("tmp/inkling/themes/#{theme.file_name}", "rb")
49
+ contents = file.read
50
+
51
+ file_words = contents.split(/\W/)
52
+ theme_words = theme.body.split(/\W/)
53
+ file_words.size.should == theme_words.size
54
+
55
+ i = 0
56
+ for word in theme_words
57
+ word.should == file_words[i]
58
+ i += 1
59
+ end
60
+ end
61
+
62
+ it "should delete the file when the theme model is deleted" do
63
+ theme.destroy
64
+ File.exist?("tmp/inkling/themes/#{theme.file_name}").should be_false
65
+ end
66
+ end
@@ -0,0 +1,26 @@
1
+ # This file is copied to ~/spec when you run 'ruby script/generate rspec'
2
+ # from the project root directory.
3
+ ENV["RAILS_ENV"] ||= 'test'
4
+ require File.expand_path(File.dirname(__FILE__) + "/../config/environment") #nf patching generated spec_helper
5
+ #require File.dirname(__FILE__) + "/../config/environment" unless defined?(Rails)
6
+ require 'rspec/rails'
7
+
8
+ # Requires supporting files with custom matchers and macros, etc,
9
+ # in ./support/ and its subdirectories.
10
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
11
+
12
+ Rspec.configure do |config|
13
+ # == Mock Framework
14
+ #
15
+ # If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
16
+ #
17
+ # config.mock_with :mocha
18
+ # config.mock_with :flexmock
19
+ # config.mock_with :rr
20
+ config.mock_with :rspec
21
+
22
+ # If you'd prefer not to run each of your examples within a transaction,
23
+ # uncomment the following line.
24
+ # config.use_transactional_examples = false
25
+ config.use_transactional_examples = true
26
+ end
@@ -0,0 +1,3 @@
1
+ RSpec.configure do |config|
2
+ config.include Devise::TestHelpers, :type => :controller
3
+ end
@@ -0,0 +1 @@
1
+ require 'ruby-debug'