Skip to content

Instantly share code, notes, and snippets.

View nicolasblanco's full-sized avatar
🎯
Focusing

Nicolas Blanco nicolasblanco

🎯
Focusing
View GitHub Profile
{ scopeName = 'text.haml';
fileTypes = ( 'haml', 'sass' );
foldingStartMarker = '^\s*([-%#\:\.\w\=].*)\s$';
foldingStopMarker = '^\s*$';
patterns = (
{ contentName = 'string.quoted.double.ruby';
begin = '^\s*==';
end = '$\n?';
patterns = ( { include = '#interpolated_ruby'; } );
},
class CreateAccessories < ActiveRecord::Migration
def self.up
create_table :accessories do |t|
t.string :title
t.string :manufacturer_id
t.string :manufacturer
t.string :sku
t.float :price
t.float :former_price
t.float :shipping_cost
>> s.title
=> "Alpеs-de-Haute-Provence"
>> s.title.parameterize
=> #<ActiveSupport::Multibyte::Chars:0x5fabce8 @wrapped_string="alps-de-haute-provence">
>> ActiveSupport::Multibyte::Chars.g_pack(ActiveSupport::Multibyte::Chars.g_unpack(s.title).map { |c| c == [1077] ? [101] : c }).parameterize
=> #<ActiveSupport::Multibyte::Chars:0x5fb14e0 @wrapped_string="alpes-de-haute-provence">
#rspec@irc.freenode.net
[13:59] slainer68: My question : i've got in my class a "case my_object ... when String ... when Array ...". How should I test this with a mock ?
[13:59] slainer68: I've tested with my_object = mock("my_object", :class => String) but that does not work.
[13:59] pd: slainer68: i wouldn't mock at all, pass a real string or a real array
[14:00] slainer68: pd: that would be okay with a simple class, but in my case i need to use a mock because i'm testing a Net::HTTP class
[14:00] slainer68: my class got : case http_response when Net::HTTPSuccess ...
[14:01] pd: i see
[14:04] pd: slainer68: so mock('foo', :class => String) will change the .class response, but String===that_obj still doesn't work
[14:04] pd: uhh i don't see any good way around that
ENV['RAILS_ENV'] = ARGV.first || ENV['RAILS_ENV'] || 'development'
require File.expand_path(File.dirname(__FILE__) + "/../../config/environment")
gem "rspec", "=1.1.12"
gem "selenium-client", "=1.2.14"
require "selenium/client"
require "selenium/rspec/spec_helper"
ENV['RAILS_ENV'] = ARGV.first || ENV['RAILS_ENV'] || 'development'
require File.expand_path(File.dirname(__FILE__) + "/../../config/environment")
puts "$$$$"
puts Rails.env
puts "$$$$"
gem "rspec", "=1.1.12"
gem "selenium-client", "=1.2.14"
require "selenium/client"
using System;
using System.Linq;
using System.Collections.Generic;
class app {
static void Main() {
string[] names = { "Burke", "Connor", "Frank",
"Everett", "Albert", "George",
"Harris", "David" };
names = ["burke", "connor", "frank", "everett", "albert", "george", "harris", "david"]
query = names.inject([]) { |m, n| m << n.upcase if n.size == 5; m }.sort
query.each { |name| puts name }
# BURKE
# DAVID
# FRANCK
Feature: all indexes pages should load correctly
In order to be sure that all indexes views render correctly...
Scenario: Index page should load
Given I am on the homepage
Then I should see "Keldelice, le portail de la gastronomie"
Scenario: Recipes index page should load
Given I am on the recipes index page
Then I should see "une succulente recette de cuisine"
nicolas@imac-de-nicolas-blanco ~/keldelice /master> rake features
(in /Users/nicolas/keldelice)
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby -I "/Library/Ruby/Gems/1.8/gems/cucumber-0.2.3/lib:lib" "/Library/Ruby/Gems/1.8/gems/cucumber-0.2.3/bin/cucumber" --format pretty --require features/step_definitions/webrat_steps.rb --require features/support/env.rb --require features/support/paths.rb features/pages.feature
FiveRuns Manage (1.1.1): Rails version (2.2.2) is supported
Feature: all indexes pages should load correctly
In order to be sure that all indexes views render correctly...
Scenario: Index page should load # features/pages.feature:4
Given I am on the homepage # features/step_definitions/webrat_steps.rb:6
Then I should see "Keldelice, le portail de la gastronomie" # features/step_definitions/webrat_steps.rb:93