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
| <?xml version="1.0" encoding="UTF-8"?> | |
| <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
| <plist version="1.0"> | |
| <dict> | |
| <key>DVTConsoleDebuggerInputTextColor</key> | |
| <string>0.052 0.489 0.482 1</string> | |
| <key>DVTConsoleDebuggerInputTextFont</key> | |
| <string>Menlo-Bold - 11.0</string> | |
| <key>DVTConsoleDebuggerOutputTextColor</key> | |
| <string>0.432 0.325 0.276 1</string> |
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: API | |
| In order to use the service from third party apps | |
| As a user | |
| I want to be able to use an API | |
| Background: | |
| Given a user exists # Pickle | |
| And I login as the user using basic auth | |
| Scenario Outline: Get a ticket |
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 Features | |
| module MailHelpers | |
| def last_email | |
| ActionMailer::Base.deliveries[0] | |
| end | |
| # Can be used like: | |
| # extract_token_from_email(:reset_password) | |
| def extract_token_from_email(token_name) |
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 "member password recovery" do | |
| # As a member who forgot my password | |
| # I want to recover my site access easily | |
| # | |
| attr_accessor :current_email_address | |
| specify "email recovery of a new password" do | |
| member = make_activated_member |
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 Hash | |
| def except(*blacklist) | |
| {}.tap do |h| | |
| (keys - blacklist).each { |k| h[k] = self[k] } | |
| end | |
| end | |
| def only(*whitelist) | |
| {}.tap do |h| | |
| (keys & whitelist).each { |k| h[k] = self[k] } |
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 SpecialResponderController < ActionController::Base | |
| protected | |
| def self.responder | |
| lambda do |controller, resources, options| | |
| if controller.is_special? | |
| SpecialResponder.call(controller, resources, options) | |
| else | |
| super.call(controller, resources, options) | |
| end | |
| 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
| class Hash | |
| # options: | |
| # :exclude => [keys] - keys need to be symbols | |
| def to_ostruct_recursive(options = {}) | |
| convert_to_ostruct_recursive(self, options) | |
| end | |
| private | |
| def convert_to_ostruct_recursive(obj, options) | |
| result = obj |
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 Hash | |
| def with_sym_keys | |
| self.inject({}) { |memo, (k,v)| memo[k.to_sym] = v; memo } | |
| end | |
| 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
| # config/initializer/notification_center.rb | |
| NotificationCenter.queue | |
| NotificationCenter.thread | |
| ActiveSupport::Notifications.subscribe /(.)+\.notification/i do |*args| | |
| NotificationCenter.queue << args | |
| 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
| # RSpec's subject method, both implicitly and explicitly set, is useful for | |
| # declaratively setting up the context of the object under test. If you provide a | |
| # class for your describe block, subject will implicitly be set to a new instance | |
| # of this class (with no arguments passed to the constructor). If you want | |
| # something more complex done, such as setting arguments, you can use the | |
| # explicit subject setter, which takes a block. | |
| describe Person do | |
| context "born 19 years ago" do | |
| subject { Person.new(:birthdate => 19.years.ago } | |
| it { should be_eligible_to_vote } |