BDD de fuera a dentro

1,083 views

Published on

Published in: Technology, Business
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,083
On SlideShare
0
From Embeds
0
Number of Embeds
20
Actions
Shares
0
Downloads
10
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide

BDD de fuera a dentro

  1. 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. 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. 3. $ rails g model User name:string
  4. 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. 5. $ rails g controller users index
  6. 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. 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. 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. 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. 10. <h2>Users</h2><ul> <%= @users.each do |user| %> <li> <%= user.name %> </li> <% end %></ul>
  11. 11. <h2>Users</h2><ul> <%= @users.each do |user| %> <li> <%= user.name %> </li> <% end %></ul>
  12. 12. <h2>Users</h2><ul> <%= @users.each do |user| %> <li> <%= user.name %> </li> <% end %></ul>
  13. 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. 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. 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. 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. 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. 18. class UsersController def index @users = User.all endend
  19. 19. class UsersController def index @users = User.all endend
  20. 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

×