Problem with Sinatra, json and Rspec

23 views
Skip to first unread message

Elton Santos

unread,
Feb 1, 2017, 1:15:19 PM2/1/17
to Ruby on Rails: Talk
Hi, I have a giant problem that I'm 5 days stuck!!! I have a app:


But Can't work with tests. Look:

it "Has response HTTP 200" do
     
get "/"
      puts last_response
.inspect
      expect
(last_response).to have_http_status(:success)
   
end

In inspect return this:

#<Rack::MockResponse:0x007fbc948c2f50 @original_headers={"Content-Type"=>"text/html;charset=utf-8", "X-Cascade"=>"pass", "Content-Length"=>"459", "X-XSS-Protection"=>"1; mode=block", "X-Content-Type-Options"=>"nosniff", "X-Frame-Options"=>"SAMEORIGIN"}, @errors="", @body_string=nil, @status=404, @header={"Content-Type"=>"text/html;charset=utf-8", "X-Cascade"=>"pass", "Content-Length"=>"459", "X-XSS-Protection"=>"1; mode=block", "X-Content-Type-Options"=>"nosniff", "X-Frame-Options"=>"SAMEORIGIN"}, @chunked=false, @writer=#<Proc:0x007fbc948c28c0@/Users/eltonsantos/.rvm/gems/ruby-2.3.3@sinatra/gems/rack-1.6.5/lib/rack/response.rb:30 (lambda)>, @block=nil, @length=459, @body=["<!DOCTYPE html>\n<html>\n<head>\n  <style type=\"text/css\">\n  body { text-align:center;font-family:helvetica,arial;font-size:22px;\n    color:#888;margin:20px}\n  #c {margin:0 auto;width:500px;text-align:left}\n  </style>\n</head>\n<body>\n  <h2>Sinatra doesn&rsquo;t know this ditty.</h2>\n  <img src='http://example.org/__sinatra__/404.png'>\n  <div id=\"c\">\n    Try this:\n    <pre>get &#x27;&#x2F;&#x27; do\n  &quot;Hello World&quot;\nend\n</pre>\n  </div>\n</body>\n</html>\n"]>


How configure sinatra for use with rspec and json??? Serious, I trying but I do not know what to do anymore :(

Elton Santos

unread,
Feb 1, 2017, 1:17:47 PM2/1/17
to Ruby on Rails: Talk
No test with rspec work :(

Elton Santos

unread,
Feb 1, 2017, 11:20:30 PM2/1/17
to Ruby on Rails: Talk
someone?

tamouse pontiki

unread,
Feb 1, 2017, 11:34:24 PM2/1/17
to rubyonra...@googlegroups.com


On Wed, Feb 1, 2017 at 10:20 PM Elton Santos <elton.me...@gmail.com> wrote:
someone? 



Maybe you want the Sinatra mailing list instead of the Rails mailing list? 

Elton Santos

unread,
Feb 1, 2017, 11:52:14 PM2/1/17
to Ruby on Rails: Talk
Sinatra is a gem of ruby, I'm on the correct list. Will you help me or will you just keep talking things that have nothing to do? 

thiagocifani

unread,
Feb 1, 2017, 11:54:57 PM2/1/17
to rubyonra...@googlegroups.com
First, you are asking for help, be more polite. Second you are in the wrong list. This list is about rails, Sinatra is another framework. Please, try to post in the right list first.

Em 2 de fev de 2017 2:52 AM, "Elton Santos" <elton.me...@gmail.com> escreveu:
Sinatra is a gem of ruby, I'm on the correct list. Will you help me or will you just keep talking things that have nothing to do? 

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/f08ad5a4-4582-4c41-aa98-d37f194cc997%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Elton Santos

unread,
Feb 2, 2017, 12:07:42 AM2/2/17
to Ruby on Rails: Talk
Interesting, I was the one to post doubts about it? I do not think so:


I asking for help and I didnt find the correct list and active, you know then? And about education I think if you do not want to help just do not talk. Save time and avoid stress. Because there is always time to rebuke, but to help, is not there?

tamouse pontiki

unread,
Feb 2, 2017, 1:43:18 AM2/2/17
to Ruby on Rails: Talk

You are on the Rails list. Rails is also a gem of Ruby. And no I won't help anyone with an arrogant attitude like that.


--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-ta...@googlegroups.com.
To post to this group, send email to rubyonra...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/0e551021-6fac-470f-ac93-1e48ae017b0b%40googlegroups.com.

Robby O'Connor

unread,
Feb 2, 2017, 2:06:46 AM2/2/17
to rubyonra...@googlegroups.com, tamouse pontiki
People who are asking for help shouldn't be acting arrogant. You're not entitled to help.

I'd encourage you to either:

- Search Stackoverflow.com (search before you ask)
- Actually try googling or even better looking at the sinatra site: http://www.sinatrarb.com -- Oh look a slack for Sinatra...where you can get help and it's on topic: http://sinatra-slack.herokuapp.com/
On 02/02/2017 01:42 AM, tamouse pontiki wrote:
> You are on the Rails list. Rails is also a gem of Ruby. And no I won't
> help anyone with an arrogant attitude like that.
>
>
> On Wed, Feb 1, 2017, 11:07 PM Elton Santos <elton.me...@gmail.com
> <mailto:elton.me...@gmail.com>> wrote:
>
> Interesting, I was the one to post doubts about it? I do not think so:
>
> https://groups.google.com/forum/#!searchin/rubyonrails-talk/sinatra%7Csort:relevance
>
> I asking for help and I didnt find the correct list and active, you
> know then? And about education I think if you do not want to help
> just do not talk. Save time and avoid stress. Because there is
> always time to rebuke, but to help, is not there?
>
> --
> You received this message because you are subscribed to the Google
> Groups "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it,
> send an email to rubyonrails-ta...@googlegroups.com
> <mailto:rubyonrails-ta...@googlegroups.com>.
> To post to this group, send email to
> rubyonra...@googlegroups.com
> <mailto:rubyonra...@googlegroups.com>.
> <https://groups.google.com/d/msgid/rubyonrails-talk/0e551021-6fac-470f-ac93-1e48ae017b0b%40googlegroups.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout.
>
> --
> You received this message because you are subscribed to the Google
> Groups "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to rubyonrails-ta...@googlegroups.com
> <mailto:rubyonrails-ta...@googlegroups.com>.
> To post to this group, send email to rubyonra...@googlegroups.com
> <mailto:rubyonra...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/rubyonrails-talk/CAHUC_t97gECCJN9yQaZtiQ52MDT0rX1u36Fo1qqpTRdLKW4YcQ%40mail.gmail.com
> <https://groups.google.com/d/msgid/rubyonrails-talk/CAHUC_t97gECCJN9yQaZtiQ52MDT0rX1u36Fo1qqpTRdLKW4YcQ%40mail.gmail.com?utm_medium=email&utm_source=footer>.
signature.asc
Reply all
Reply to author
Forward
0 new messages