-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5cb20a5
commit 8627bb7
Showing
53 changed files
with
365 additions
and
254 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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
# frozen_string_literal: true | ||
|
||
appraise 'rails-5.2' do | ||
gem 'rails', '~> 5.2.0' | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'bundler/gem_tasks' | ||
require 'rspec/core/rake_task' | ||
|
||
|
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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
#!/usr/bin/env ruby | ||
# frozen_string_literal: true | ||
|
||
require 'bundler/setup' | ||
require 'rails_edge_test' | ||
|
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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
#!/usr/bin/env ruby | ||
# frozen_string_literal: true | ||
|
||
require 'open3' | ||
require 'rails_edge_test' | ||
|
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
# frozen_string_literal: true | ||
|
||
module RailsEdgeTest | ||
module Dsl | ||
def controller(controller_class, &) | ||
|
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 |
---|---|---|
@@ -1,49 +1,53 @@ | ||
module RailsEdgeTest::Dsl | ||
Action = Struct.new(:name, :controller) do | ||
def initialize(*args) | ||
super | ||
@edges = {} | ||
@let_handler = LetHandler.new | ||
end | ||
# frozen_string_literal: true | ||
|
||
def edge(description, &block) | ||
edge = Edge.new(description, self) | ||
@edges[edge] = block | ||
end | ||
module RailsEdgeTest | ||
module Dsl | ||
Action = Struct.new(:name, :controller) do | ||
def initialize(*args) | ||
super | ||
@edges = {} | ||
@let_handler = LetHandler.new | ||
end | ||
|
||
def let(title, &block) | ||
@let_handler.add_definition(title, &block) | ||
end | ||
def edge(description, &block) | ||
edge = Edge.new(description, self) | ||
@edges[edge] = block | ||
end | ||
|
||
def generate(title, &block) | ||
@let_handler.add_definition("generate_#{title}", &block) | ||
end | ||
def let(title, &block) | ||
@let_handler.add_definition(title, &block) | ||
end | ||
|
||
def __edges | ||
@edges | ||
end | ||
def generate(title, &block) | ||
@let_handler.add_definition("generate_#{title}", &block) | ||
end | ||
|
||
def __let_handler | ||
@let_handler | ||
end | ||
def __edges | ||
@edges | ||
end | ||
|
||
def controller_class | ||
controller.controller_class | ||
end | ||
def __let_handler | ||
@let_handler | ||
end | ||
|
||
# support calling methods defined in controller | ||
def method_missing(method_name, ...) | ||
if controller.respond_to?(method_name) | ||
controller.public_send(method_name, ...) | ||
else | ||
super | ||
def controller_class | ||
controller.controller_class | ||
end | ||
|
||
# support calling methods defined in controller | ||
def method_missing(method_name, ...) | ||
if controller.respond_to?(method_name) | ||
controller.public_send(method_name, ...) | ||
else | ||
super | ||
end | ||
end | ||
end | ||
|
||
# always define respond_to_missing? when defining method_missing: | ||
# https://thoughtbot.com/blog/always-define-respond-to-missing-when-overriding | ||
def respond_to_missing?(method_name, include_private = false) | ||
controller.respond_to?(method_name) || super | ||
# always define respond_to_missing? when defining method_missing: | ||
# https://thoughtbot.com/blog/always-define-respond-to-missing-when-overriding | ||
def respond_to_missing?(method_name, include_private = false) | ||
controller.respond_to?(method_name) || super | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,31 @@ | ||
module RailsEdgeTest::Dsl | ||
Controller = Struct.new(:controller_class) do | ||
def initialize(*args) | ||
super | ||
@actions = [] | ||
@let_handler = LetHandler.new | ||
end | ||
# frozen_string_literal: true | ||
|
||
def action(name, &block) | ||
new_action = Action.new(name, self) | ||
new_action.instance_exec(&block) | ||
@actions << new_action | ||
end | ||
module RailsEdgeTest | ||
module Dsl | ||
Controller = Struct.new(:controller_class) do | ||
def initialize(*args) | ||
super | ||
@actions = [] | ||
@let_handler = LetHandler.new | ||
end | ||
|
||
def let(title, &block) | ||
@let_handler.add_definition(title, &block) | ||
end | ||
def action(name, &block) | ||
new_action = Action.new(name, self) | ||
new_action.instance_exec(&block) | ||
@actions << new_action | ||
end | ||
|
||
def __actions | ||
@actions | ||
end | ||
def let(title, &block) | ||
@let_handler.add_definition(title, &block) | ||
end | ||
|
||
def __actions | ||
@actions | ||
end | ||
|
||
def __let_handler | ||
@let_handler | ||
def __let_handler | ||
@let_handler | ||
end | ||
end | ||
end | ||
end |
Oops, something went wrong.