-
Notifications
You must be signed in to change notification settings - Fork 242
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #304 from guard/update_guard_compat_n_rework_specs
Update guard compat n rework specs
- Loading branch information
Showing
14 changed files
with
181 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,4 +14,3 @@ matrix: | |
allow_failures: | ||
- rvm: jruby-19mode | ||
- rvm: rbx | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
require "ostruct" | ||
|
||
require "guard/rspec" | ||
|
||
module Guard | ||
class RSpec < Plugin | ||
class Dsl | ||
def initialize(dsl) | ||
@dsl = dsl | ||
end | ||
|
||
def watch_spec_files_for(expr) | ||
@dsl.send(:watch, expr) { |m| rspec.spec.(m[1]) } | ||
end | ||
|
||
def rspec | ||
@rspec ||= OpenStruct.new(to_s: "spec").tap do |rspec| | ||
rspec.spec_dir = "spec" | ||
rspec.spec = ->(m) { "#{rspec.spec_dir}/#{m}_spec.rb" } | ||
rspec.spec_helper = "#{rspec.spec_dir}/spec_helper.rb" | ||
rspec.spec_files = %r{^#{rspec.spec_dir}/.+_spec\.rb$} | ||
rspec.spec_support = %r{^#{rspec.spec_dir}/support/(.+)\.rb$} | ||
end | ||
end | ||
|
||
def ruby | ||
# Ruby apps | ||
@ruby || OpenStruct.new.tap do |ruby| | ||
ruby.lib_files = %r{^(lib/.+)\.rb$} | ||
end | ||
end | ||
|
||
def rails(options = {}) | ||
# Rails example | ||
@rails ||= OpenStruct.new.tap do |rails| | ||
exts = options.dup.delete(:view_extensions) || %w(erb haml slim) | ||
|
||
rails.app_files = %r{^app/(.+)\.rb$} | ||
|
||
rails.views = %r{^app/(views/.+/[^/]*\.(?:#{exts * "|"}))$} | ||
rails.view_dirs = %r{^app/views/(.+)/[^/]*\.(?:#{exts * "|"})$} | ||
rails.layouts = %r{^app/layouts/(.+)/.*\.("#{exts * "|"}")$} | ||
|
||
rails.controllers = %r{^app/controllers/(.+)_controller\.rb$} | ||
rails.routes = "config/routes.rb" | ||
rails.app_controller = "app/controllers/application_controller.rb" | ||
rails.spec_helper = "#{rspec.spec_dir}/rails_helper.rb" | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.