BDD de fuera a dentro

  • 734 views
Uploaded on

 

More in: Technology , Business
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
734
On Slideshare
0
From Embeds
0
Number of Embeds
1

Actions

Shares
Downloads
9
Comments
0
Likes
2

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. scenario List of users do create_user mary create_user paul visit users_page assert page.has_content?(mary) assert page.has_content?(paul)end
  • 2. scenario List of users do create_user mary create_user paul visit users_page assert page.has_content?(mary) assert page.has_content?(paul)end
  • 3. $ rails g model User name:string
  • 4. scenario List of users do create_user mary create_user paul visit users_page assert page.has_content?(mary) assert page.has_content?(paul)end
  • 5. $ rails g controller users index
  • 6. scenario List of users do create_user mary create_user paul visit users_page assert page.has_content?(mary) assert page.has_content?(paul)end
  • 7. describe users/index.html.erb do it renders the list of users do render_view :users => [mock(:name => Joe)] assert_contains rendered, Joe endend
  • 8. describe users/index.html.erb do it renders the list of users do render_view :users => [mock(:name => Joe)] assert_contains rendered, Joe endend
  • 9. describe users/index.html.erb do it renders the list of users do render_view :users => [mock(:name => Joe)] assert_contains rendered, Joe endend
  • 10. <h2>Users</h2><ul> <%= @users.each do |user| %> <li> <%= user.name %> </li> <% end %></ul>
  • 11. <h2>Users</h2><ul> <%= @users.each do |user| %> <li> <%= user.name %> </li> <% end %></ul>
  • 12. <h2>Users</h2><ul> <%= @users.each do |user| %> <li> <%= user.name %> </li> <% end %></ul>
  • 13. scenario List of users do create_user mary create_user paul visit users_page assert page.has_content?(mary) assert page.has_content?(paul)end
  • 14. describe UsersController do describe GET index do it assigns the users do User.stub(:all => users_stub) get :index assert_equal users_stub, assigns[:user] end endend
  • 15. describe UsersController do describe GET index do it assigns the users do User.stub(:all => users_stub) get :index assert_equal users_stub, assigns[:user] end endend
  • 16. describe UsersController do describe GET index do it assigns the users do User.stub(:all => users_stub) get :index assert_equal users_stub, assigns[:user] end endend
  • 17. describe UsersController do describe GET index do it assigns the users do User.stub(:all => users_stub) get :index assert_equal users_stub, assigns[:user] end endend
  • 18. class UsersController def index @users = User.all endend
  • 19. class UsersController def index @users = User.all endend
  • 20. scenario List of users do create_user mary create_user paul visit users_page assert page.has_content?(mary) assert page.has_content?(paul)end