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

@env['router.request'] not available during testing? #21

Open
GBH opened this issue Oct 21, 2011 · 2 comments
Open

@env['router.request'] not available during testing? #21

GBH opened this issue Oct 21, 2011 · 2 comments

Comments

@GBH
Copy link

GBH commented Oct 21, 2011

Rack this is pretty new to me, so I'm trying to figure out why in my tests this value is not being set. I'm using http_router with Cramp (http://cramp.in). From what I can gather it doesn't seem that env is properly set for Rack::MockRequest.new

In Cramp you'd find something like this:

@request = Rack::MockRequest.new(app)

app is basically class of the Cramp::Action, or Rack app basically. So in my case it's like UsersController::Show

Then it seems you can call get on that @request with some URI. But it seems that the router is completely out the game here. Is it correct to assume I just have to fake extra params that I was expecting to get from path like this: /:variaible/users/:id

Thanks.

@joshbuddy
Copy link
Owner

Can you show me what you're trying to do?

@GBH
Copy link
Author

GBH commented Oct 26, 2011

I'm just spoiled by Rails. But I think what I want is a way to test if routes I've defined actually work.

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

2 participants