This file contains 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
# /features/authentication/homepage.feature | |
Feature: Homepage | |
Scenario Outline: Popular Activity | |
Given I am a new visitor | |
When I go to /notes | |
Then I should see an error message | |
# /features/steps/authentication/homepage_steps.rb | |
# (copied from login example) |
This file contains 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 Item | |
include DataMapper::Resource | |
has n, :cat_as, :through => Resource | |
has n, :cat_bs, :through => Resource | |
end | |
class CatA | |
include DataMapper::Resource | |
has n, :items, :through => Resource |
This file contains 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 spec_helper.rb | |
def mock_warden(scope) | |
warden = mock('warden') | |
warden.stub!("authenticate_#{scope}!").and_return(true) | |
warden.stub!(:authenticate!).and_return(true) | |
return warden | |
end | |
module ControllerExampleGroupBehaviour |
This file contains 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
Given /^I will confirm on next step$/ do | |
begin | |
evaluate_script("window.alert = function(msg) { return true; }") | |
evaluate_script("window.confirm = function(msg) { return true; }") | |
rescue Capybara::NotSupportedByDriverError | |
end | |
end |
This file contains 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
$("#SearchForm #name").autocomplete("/customers/search.json",{ | |
minChars: 2, | |
highlight: false, | |
delay: 100, | |
width: 310, | |
parse: function(data){ | |
var array = new Array(); | |
for (var i=0; i < data.length; i++) | |
{ | |
array[i] = {data:data[i], value: data[i].first_name, result: data[i].last_name + ", " + data[i].first_name} |
This file contains 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
scope :has_all_items_in_state, lambda {|item_states| | |
{ | |
:joins => :order_items, :conditions => { :order_items => { :state => item_states}}, | |
:select => "orders.*, COUNT(order_items.id) as item_count", | |
:group => "orders.id", | |
:having => "item_count = (select count(*) from order_items where order_id = orders.id)" | |
} | |
} |
This file contains 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
SELECT hour(created_at) as hour, count(hour(created_at)) as total FROM audit_logs group by hour(created_at) order by total DESC |
This file contains 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 Posts < ActiveRecord::Base | |
belongs_to :user | |
scope :extra, where(:extra => true) | |
def self.optional_scope(param = false) | |
if param | |
scope = where(:something => 'else') | |
else | |
scope = self | |
end |
This file contains 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
group :test, :cucumber do | |
gem 'capybara', :git => 'git://github.com/keeran/capybara.git' | |
gem 'selenium-webdriver', '0.0.27' | |
gem 'database_cleaner' | |
gem 'cucumber-rails' | |
gem 'cucumber' | |
gem 'rspec' | |
gem 'rspec-rails', ">= 2.0.0.beta.17" | |
gem 'spork' | |
gem 'launchy' |
This file contains 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
[2010-10-17 02:33:15] ERROR Errno::ECONNRESET: Connection reset by peer | |
/home/keeran/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/webrick/httpserver.rb:56:in `eof?' | |
/home/keeran/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/webrick/httpserver.rb:56:in `run' | |
/home/keeran/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/webrick/server.rb:183:in `block in start_thread' |
OlderNewer