Skip to content

Instantly share code, notes, and snippets.

View chintanparikh's full-sized avatar
🎯
Focusing

Chintan Parikh chintanparikh

🎯
Focusing
View GitHub Profile
/home/chintanparikh/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/irb/completion.rb:9:in `require': cannot load such file -- readline (LoadError)
from /home/chintanparikh/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/irb/completion.rb:9:in `<top (required)>'
from /home/chintanparikh/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.3/lib/rails/commands/console.rb:3:in `require'
from /home/chintanparikh/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.3/lib/rails/commands/console.rb:3:in `<top (required)>'
from /home/chintanparikh/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.3/lib/rails/commands.rb:38:in `require'
from /home/chintanparikh/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.3/lib/rails/commands.rb:38:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
<%= form_for(@project) do |f| %>
<%= f.error_messages %>
<p>
<%= f.label :name %>
<%= f.text_field :name %>
</p>
<%= f.submit %>
<% end %>
chintanparikh in ~/Documents/Rails/ticketee on develop?
[1] $ rake cucumber:ok ✘
/home/chintanparikh/.rvm/rubies/ruby-1.9.3-p194/bin/ruby -S bundle exec cucumber --profile default
Using the default profile...
wrong number of arguments (1 for 0) (ArgumentError)
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p194/gems/factory_girl-3.3.0/lib/factory_girl/syntax/default.rb:6:in `define'
/home/chintanparikh/Documents/Rails/ticketee/factories/project_factory.rb:1:in `<top (required)>'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:245:in `load'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:245:in `block in load'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:236:in `load_dependency'
chintanparikh in ~/Documents/Rails/ticketee on develop?
$ bin/cucumber features/viewing_projects.feature
Using the default profile...
Factory already registered: project (FactoryGirl::DuplicateDefinitionError)
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p194/gems/factory_girl-3.3.0/lib/factory_girl/disallows_duplicates_registry.rb:11:in `register'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p194/gems/factory_girl-3.3.0/lib/factory_girl.rb:58:in `block in register_factory'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p194/gems/factory_girl-3.3.0/lib/factory_girl.rb:57:in `each'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p194/gems/factory_girl-3.3.0/lib/factory_girl.rb:57:in `register_factory'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p194/gems/factory_girl-3.3.0/lib/factory_girl/syntax/default.rb:20:in `factory'
/home/chintanparikh/Documents/Rails/ticketee/factories/project_factory.rb:2:in `block in <top (required)>'
@project = Project.find(params[:id])
rescue ActiveRecord::RecordNotFound
flash[:alert] = "The project you were looking for could not be found"
redirect_to projects_path
--------------------- post_steps.rb (Using this with Cucumber) --------------------
Given /^there is a post called "(.*?)"$/ do |title|
FactoryGirl.create(:post, :title => title)
end
--------------------- factories/post_factory.rb -----------------------------
FactoryGirl.define do
factory :post do
Feature: Editing Posts
In order to be able to edit posts
As a user
I want to be able to do this via an interface
Background:
Given there is a post called "Hello, world"
When I follow "Hello, world"
Scenario: Editing a new post
Given /^there is a category called "(.*?)"$/ do |category_name|
FactoryGirl.create(:category, name: category_name)
end
Then /^I want to see "(.*?)"$/ do |text|
page.should have_text(text)
end
@chintanparikh
chintanparikh / usr.rb
Created June 9, 2012 14:24
nokogiri_xml_xpath
require 'nokogiri'
require 'open-uri'
xml_content = <<XML
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:usr="http://streams.atlassian.com/syndication/username/1.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:thr="http://purl.org/syndication/thread/1.0">
<title>MongoDB - Activity Stream</title>
<id>https://jira.mongodb.org</id>
<updated>2012-06-09T13:57:52Z</updated>
<dc:date>2012-06-09T13:57:52Z</dc:date>
<entry>
@chintanparikh
chintanparikh / usr.rb
Created June 9, 2012 14:25
Nokogiri XML parsing
require 'nokogiri'
require 'open-uri'
xml = Nokogiri::XML(open('https://jira.mongodb.org/plugins/servlet/streams'))
xml.xpath('//usr:username').each do |username|
puts username.content
end