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 SectionLocator | |
| def within_parent(content, elements = ['*'], &block) | |
| expr = %(//*[(#{elements.join('|')})/descendant-or-self::*[contains(., "#{content}")]]) | |
| within(:xpath, expr, &block) | |
| end | |
| def within_parent_preceding(content, elements = ['*'], &block) | |
| expr = %(//*[(#{elements.join('|')})[contains(., "#{content}")]]/..) | |
| within(:xpath, expr, &block) |
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
| default_exposure do |name| | |
| collection = name.to_s.pluralize | |
| if respond_to?(collection) && collection != name.to_s && send(collection).respond_to?(:scoped) | |
| proxy = send(collection) | |
| else | |
| proxy = name.to_s.classify.constantize | |
| end | |
| instance_variable_set("@#{name}") = if id = params["#{name}_id"] || params[:id] | |
| proxy.find(id).tap do |r| |
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
| ruby-1.9.2-p0 :026 > s = Session.create | |
| => #<Session _id: 4d3845f0c1037b05f3000005, created_at: 2011-01-20 14:25:52 UTC, updated_at: 2011-01-20 14:25:52 UTC, name: "aa", custom: nil> | |
| ruby-1.9.2-p0 :027 > s.timers << Pomodoro.new | |
| => [#<Pomodoro _id: 4d384601c1037b05f3000006, created_at: 2011-01-20 14:26:09 UTC, updated_at: 2011-01-20 14:26:09 UTC, duration: 1500>] | |
| ruby-1.9.2-p0 :028 > s.timers.count | |
| => 1 | |
| ruby-1.9.2-p0 :029 > s.reload | |
| => #<Session _id: 4d3845f0c1037b05f3000005, created_at: 2011-01-20 14:25:52 UTC, updated_at: 2011-01-20 14:25:52 UTC, name: "aa", custom: nil> | |
| ruby-1.9.2-p0 :030 > s.pomodoros.count | |
| => 0 |
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
| (in /Users/voxdolo/dev/decent_exposure) | |
| DecentExposure classes extending DecentExposure | |
| - should respond to #expose | |
| - should respond to #default_exposure | |
| DecentExposure.expose | |
| - creates a method with the given name | |
| - prevents the method from being a callable action | |
| - declares the method as a helper method |
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
| /Users/dev/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/minitest/unit.rb:566:in `block in process_args': invalid option: | |
| --profile (OptionParser::InvalidOption) | |
| from /Users/dev/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/minitest/unit.rb:545:in `new' | |
| from /Users/dev/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/minitest/unit.rb:545:in `process_args' | |
| from /Users/dev/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/minitest/unit.rb:576:in `run' | |
| from /Users/dev/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/minitest/unit.rb:492:in `block in autorun' | |
| (in /Users/dev/hashrocket/heatusa) |
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 ThingsController < ApplicationController | |
| respond_to :html, :json | |
| # decent_exposure won't currently intuit a collection (plural resource) for you. The SLTD error is | |
| # caused by a circular reference between an undeclared collection (which the singular resource attempts | |
| # to scope from) and the singular resource. To fix this problem, just define the collection: | |
| expose(:things) { Thing.all } | |
| # or alternatively, something like: | |
| # expose(:things) { current_user.things } | |
| expose(:thing) |
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
| source 'http://rubygems.org' | |
| gem 'bundler', '~> 1.0.0' | |
| gem 'decent_exposure', '~> 1.0.0.rc1' | |
| gem 'devise', '~> 1.1.2' | |
| gem 'haml' | |
| gem 'hassle', :git => 'git://github.com/Papipo/hassle.git' | |
| gem 'pg' | |
| gem 'rails', '3.0.0' |
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 File.join(File.dirname(__FILE__),'dev_gemfile') | |
| source 'http://rubygems.org' | |
| gem 'bundler', '~> 1.0.0' | |
| gem 'decent_exposure', '~> 1.0.0.rc1' | |
| gem 'devise', '~> 1.1.2' | |
| gem 'haml' | |
| gem 'hassle', :git => 'git://github.com/Papipo/hassle.git' | |
| gem 'pg' |
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
| source 'http://rubygems.org' | |
| gem 'bundler', '~> 1.0.0' | |
| gem 'decent_exposure', '~> 1.0.0.rc1' | |
| gem 'devise', '~> 1.1.2' | |
| gem 'haml' | |
| gem 'hassle', :git => 'git://github.com/Papipo/hassle.git' | |
| gem 'pg' | |
| gem 'rails', '3.0.0' |
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 wait_conditionally_until | |
| if page.driver.wait? | |
| page.wait_until do | |
| begin | |
| yield | |
| rescue Selenium::WebDriver::Error::WebDriverError => e | |
| # do nothing - continue to wait for timeout | |
| end | |
| end | |
| else |