Questions tagged [rack-test]
46 questions
0
votes
1 answer
Can I use rack-test for deployment tests?
I've built a simple api in Sinatra, with the purpose of setting up a deployment pipeline using Docker. I'm at a stage where I could easily switch Sinatra for something else and there's currently one reason why I might do so.
I once wrote an api…

Erik B
- 40,889
- 25
- 119
- 135
0
votes
2 answers
Configuring rack-test to start the server indirectly
Here is my rack application:
class MainAppLogic
def initialize
Rack::Server.start(:app =>Server, :server => "WEBrick", :Port => "8080")
end
end
class Server
def self.call(env)
return [200, {},["Hello, World"]]
…

thesecretmaster
- 1,950
- 1
- 27
- 39
0
votes
1 answer
Capybara feature specs only working if js: true
My test code in the spec/features/posts_spec.rb looks like this
require 'spec_helper'
feature 'Posts' do
scenario 'Editing of Micropost', js: true do
visit '/signin'
fill_in 'Email', with: 'user@example.com
...
The code works fine with…

Obromios
- 15,408
- 15
- 72
- 127
0
votes
1 answer
Resizing the window in Capybara with rack_test
I'm using rack_test as my driver for Capybara and I'm trying to resize the window.
The best example I could find on this was this gist, but the resize method does not seem to work for rack_test
> Capybara.current_driver
=> :rack_test
>…

user2490003
- 10,706
- 17
- 79
- 155
0
votes
1 answer
Rack::Test::Methods setting id when using get method
I'm struggling with API methods from Rack::Test. Providing the resource parametets, makes sense for the post method, but for get, seems, it doesn't.
When I want to fetch the resource with definite id, I'm trying to make the request:
get…

DreamWalker
- 1,327
- 1
- 11
- 19
0
votes
0 answers
POST request with Capybara/Cucumber and Rack/Test
I have the same problem as follows:
In "support/env.rb":
module CapybaraApp
def app; Capybara.app; end
end
World(CapybaraApp)
World(Rack::Test::Methods)
In "step_definitions/restUtils.rb":
Quando /^Send POST request to "([^\"]*)" with:$/ do |url,…

Giovani Hoff
- 1
- 3
0
votes
1 answer
Sinatra Rack Test "0 Tests" run
I'm trying to get some unit tests written for a small Sinatra app. When I run ruby test.rb, the terminal reports that it is "running tests" but it is not actually picking up my unit tests.
The app itself runs fine whether by locally typing ruby…

jdussault
- 427
- 5
- 12
0
votes
1 answer
Running two tests simultaneously in RSpec / Rack::Test / Sinatra
Given the example sinatra app
post '/1' do
sleep(1) until @2
0
end
post '/2' do
@2 = true
0
end
and the example RSpec test
describe 'test' do
it 'does /1' do
post '/1'
expect(last_response.body) to eq?(0)
end
it 'does /2'
…

VULPINE
- 31
- 3
0
votes
2 answers
When writing Rails controller tests, why use #post vs #get vs #delete?
I'm realizing I don't understand the rationale for why Rails controller tests / specs are structured the way they are.
When writing controller tests, we're encouraged to more or less treat the controller as a unit and write unit tests accordingly,…

Topher Hunt
- 4,404
- 2
- 27
- 51
0
votes
0 answers
How to set the variable "app" in Rack Test?
I have an Rack app:
def app
Rack::Builder.new{
run MyApp
}.to_app
end
This works fine, but I want to change app to something else, because there is an model named App.
How to set Rack Test to run against an app with another name?…

B Seven
- 44,484
- 66
- 240
- 385
0
votes
1 answer
Ruby load module in test
I am running a padrino application and have started with the included mailers. I want to test that a mail is sent and had previously had no trouble accessing the Mail::TestMailer object to look at the mails delivered during the test.
That is the…

Peter Saxton
- 4,466
- 5
- 33
- 51
0
votes
0 answers
Rails 4.1 + Rspec + rack-test : undefined method `app'
I've been working on a Rails 4.1.1 app and I am setting up Rspec.
I want to test a controller using the rask-test last_response method.
I followed the instructions and here is my spec_helper.rb file
require 'rack/test'
require…

Bertrand Dubaut
- 35
- 1
- 6
0
votes
1 answer
minitest racktest
Does anybody have any examples of using minitest and reacktest together to create request specs?
I want to be able to request a resource:
get '/api/resource', format: :json
And then test the response.

dagda1
- 26,856
- 59
- 237
- 450
0
votes
2 answers
Why does rspec fail?
i want to check page's title through rspec. in chrome i see the expected result but rspec claim the title is empty(in chrome view source it also ok). here some code:
application.html.rb
site | <%= yield(:title)…

Nir
- 2,497
- 9
- 42
- 71