Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add dependency on Lucky #103

Open
matthewmcgarvey opened this issue Nov 19, 2020 · 0 comments
Open

Add dependency on Lucky #103

matthewmcgarvey opened this issue Nov 19, 2020 · 0 comments

Comments

@matthewmcgarvey
Copy link
Member

Related #20

LuckyFlow was meant to be like Capybara which can be used with any framework or library so it does not have a dependency on Lucky. The problem is that there are still helpful methods added that use classes provided by Lucky and Avram but because the dependency is missing we can't actually use or test those methods because they don't exist from LuckyFlow's point of view.

I believe that we should go ahead and make that dependency explicit so that we can fully exploit that connection and test it correctly.

def visit(action : Lucky::Action.class, as user : User? = nil)
visit(action.route, as: user)
end
def visit(route_helper : Lucky::RouteHelper, as user : User? = nil)
url = route_helper.url
uri = URI.parse(url)
if uri.query && user
url += "&backdoor_user_id=#{user.id}"
elsif uri.query.nil? && user
url += "?backdoor_user_id=#{user.id}"
end
session.navigate_to(url)
end

def fill_form(
form : Avram::SaveOperation.class | Avram::Operation.class,
**fields_and_values
)
fields_and_values.each do |name, value|
fill "#{form.param_key}:#{name}", with: value
end
end

private def have_current_path(action : Lucky::Action.class)
have_current_path(action.route)
end
private def have_current_path(route_helper : Lucky::RouteHelper)
HaveCurrentPathExpectation.new(route_helper.path)
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant