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
| class AccountsController < ApplicationController | |
| def new | |
| @account = Account.new | |
| end | |
| def create | |
| @account = Account.new(params[:account]) | |
| if @account.save | |
| session[:account_id] = @account.id | |
| flash[:notice] = "Thank you for signing up! You are now logged in." |
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
| Feature: Beer Donations | |
| In order to donate a beer | |
| A user | |
| Should be signed_in | |
| Background: | |
| Given user@example.com is a user with password "secret" | |
| Scenario: A registered user should be able to donate a beer to another registered user | |
| Given someone@example.com is a user |
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
| def can_edit?(this_user) | |
| =begin | |
| if can_delete(this_user) | |
| return true | |
| end | |
| if this_user.isadmin | |
| return true | |
| end | |
| if user == this_user | |
| return true |
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
| def para (attributes = {}, &block) | |
| method_missing(:p, attributes, &block) | |
| end | |
| para do | |
| <<-END_PARAGRAPH | |
| Hello there. I love #{input 'inputting VARIOUS things'}. I also get a kick | |
| out of #{code 'coding various things'}. There's such a thrill in | |
| seeing all of the exciting #{output 'output you can get'} from a | |
| well-written program. |
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
| def para (attributes = {}, &block) | |
| method_missing(:p, attributes, &block) | |
| end | |
| para do | |
| foo = <<-END_PARAGRAPH | |
| Hello there. I love #{input 'inputting VARIOUS things'}. I also get a kick | |
| out of #{code 'coding various things'}. There's such a thrill in | |
| seeing all of the exciting #{output 'output you can get'} from a | |
| well-written program. |
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
| def uses(source = nil) | |
| block = proc { yield } | |
| klass.inject_csv_source = block_given? ? block : source | |
| 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
| require 'cgi' | |
| module LoggedInControllerExtension | |
| def self.included(base) | |
| base.extend Setup | |
| base.setup_logged_in | |
| end | |
| module Setup | |
| def setup_logged_in |
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 'cgi' | |
| module LoggedInControllerExtension | |
| def self.included(base) | |
| base.extend Setup | |
| base.setup_logged_in | |
| end | |
| module Setup | |
| def setup_logged_in |
NewerOlder