elixir-web / weber

[WiP] Web framework for Elixir inspired by Rails [#WeberMVC at freenode]
http://elixir-web.github.io/weber/
MIT License
372 stars 33 forks source link

TDD / BDD / Spec'ing requests with Weber #157

Closed troessner closed 10 years ago

troessner commented 10 years ago

Hey guys,

I searched for a way to spec requests in a similar fashion like rspec-rails allows me for rails but couldn't find anything.

I am talking about something like this:

describe AccountsController do
  describe "GET 'new'" do
    it 'renders the "new" template' do
      get 'new'

      expect(response.status).to eq(200)
      expect(response.body).to have_content('Hello my friend!')
    end
  end
end

I assume this is not possible right now?

So, besides from doing the obvious, which is to write a corresponding library for elixir, how would you spec your requests?

Starting a server, shell out to curl or something similar and then parse the response?

0xAX commented 10 years ago

Hello @troessner,

You're absolutely right, there is no ability to write dsl spec requests now in Weber. As you can see we test it with exunit and hackney http client - https://github.com/0xAX/weber/blob/master/templates/default/test/response_test.exs,

this is only in plans

troessner commented 10 years ago

Thanks for the explanation, I submitted a pull request which updates the documentation to make this more clear: https://github.com/0xAX/weber/pull/158

0xAX commented 10 years ago

@troessner Thanks for the PR, so i'm closing issue