This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| http://rubyonrails.org/ | |
| http://guides.rubyonrails.org/ | |
| http://pragprog.com/book/rails4/agile-web-development-with-rails (excelente livro) | |
| http://www.slideshare.net/dextra/minicurso-ruby-on-rails-dextra (palestra introdutória) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'spec_helper' | |
| describe LineItemsController do | |
| mock :order | |
| mock :customer | |
| # GET /orders/11/line_items | |
| get :index, :order_id => 11 do | |
| default :stub => :off |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'spec_helper' | |
| describe CustomersController do | |
| before(:each) do | |
| mock_filter(:require_user_owner) | |
| end | |
| # GET /customers | |
| get :index do |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module ControllerMacros | |
| def self.included(base) | |
| base.extend(GroupMethods) | |
| end | |
| def mock_access(user = mock_model(User)) | |
| controller.stub('require_user').and_return(true) | |
| controller.stub('current_user').and_return(user) | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module MacrosBase | |
| def self.included(base) | |
| base.extend(GroupMethods) | |
| end | |
| module GroupMethods | |
| def mock(model_name) | |
| class_eval <<-EOFMOCK | |
| def mock_#{model_name}(stubs={}) | |
| (@mock_#{model_name} ||= mock_model(#{model_name.to_s.classify}).as_null_object).tap do |#{model_name}| |
NewerOlder