my step definition
Transform /^user "([^"]*)"$/ do | email |
Person.find_by_email(email)
end
Given /^login as (user "([^"]*)")$/ do | user |
login_as email
end
my feature
login as user "[email protected]"
I am getting this error
And user "[email protected]" has security role "contact" # features/step_definitions/security_role_...
Hello,
I'm developing a website for my University and I got a problem.
There is a page where I have the list of all students of the university. The admin can select some students that will be able to go to a selective process and then he have to see them in other separate page.
How can I do that using Ruby On Rails?
Thanks,
Hugo Hen...
How would I go about removing all empty elements (empty list items) from a nested Hash or YAML file?
Thanks for any advice.
...
Hello,
I am trying to execute cmds on a remote CPU through telnet. While some commands sent (through Ruby's stdlib for telnet) are successful, others are giving me a weird response:
*===============================================================
Welcome to Microsoft Telnet Server.
*=============================================...
Say, we have an HTML, in which, all ...
<div class="replace-me">
</div>
... must be replaced with
<video src='my_video.mov'></video>
The code is following:
doc.css("div.replace-me").each do |div|
div.replace "<video src='my_video.mov'></video>"
end
It's simple, but, unfortunately, it does't work for me. Nokogiri crashes with f...
How can one change the following text
The quick brown fox jumps over the lazy dog.
to
The quick brown fox +
jumps over the +
lazy dog.
using regex?
UPDATE1
A solution for Ruby is still missing... A simple one I came to so far is
def textwrap text, width, indent="\n"
return text.split("\n").collect do |line|
line.sc...
gem install rcov
Error:
Building native extensions. This could take a while...
ERROR: Error installing rcov:
ERROR: Failed to build gem native extension.
"C:/Program Files/Ruby191/bin/ruby.exe" extconf.rb
creating Makefile
make
Makefile:154: warning: overriding commands for target `C:/Program'
Makefile:148: warning: ignoring ...
We have a 8 million row MySQL table. We want to prune about 2m rows from it, remove some outdated indexes and add new ones. To achieve almost no downtime, our plan is to create a clone of the table (and lock the original), run a script (Ruby) to prune the data that we don't need anymore and finally add the new indexes. Then we would p...
I am still relatively new to unit testing. I have written a class in Ruby that takes a file, searches through that file for a given Regex pattern, replaces it, then saves the changes back to the file. I want to be able to write unit tests for this method, but I don't know how I would go about doing that. Can somebody tell me how we unit ...
Can someone tell me how to configure rails to get an smtp log.
thanks,
ash
...
At work, we do distributed testing, where rsync out to everyone elses machine and distribute out test files to speed up the testing process. One issue we are running into is that if someone has an instance of pgadmin open, it won't let us reset the test database due to connections being open.
Is there any way we can programmatically kil...
I'm learning Python (and it's my first programming language so don't be too intense with your reasons) and I wanted to know how it stacks up to other scripting languages, like Perl and Ruby. What is Python better in comparison to other scripting languages, and what is it worse for?
...
Is there any better way to write this condition?
if (self.expense.nil? && self.income.nil?) || (!self.expense.nil? && !self.income.nil?)
puts "test"
end
...
I am a complete Ruby newby and am playing around with rspec
I am testing a class (Account) that has this line:
attr_reader :balance
When I try to test it with this method:
it "should deposit twice" do
@acc.deposit(75)
expect {
@acc.deposit(50)
}.to change(Account.balance).to(125)
end
I get this error:
NoMethodError in...
Why doesn't this work?
I have an array of Objects, one of the attributes is the db id. I can make the array like so.
qc_parts.map!{|a| a.id}
However when I want to just make it a string. With
qc_parts.map!{|a| a.id}.join(",")
I only get an array out. I've also tried .to_s & .to_a
Any idea why this would be happening?
...
I want to strip leading and trailing quotes, in Ruby, from a string. The quote character will occur 0 or 1 time. For example, all of the following should be converted to foo,bar:
"foo,bar"
"foo,bar
foo,bar"
foo,bar
...
I'm trying to use ruby and Savon to consume a web service.
The test service is http://www.webservicex.net/WS/WSDetails.aspx?WSID=9&CATID=2
require 'rubygems'
require 'savon'
client = Savon::Client.new "http://www.webservicex.net/stockquote.asmx?WSDL"
client.get_quote do |soap|
soap.body = {:symbol => "AAPL"}
end
Which retur...
This is strictly theoretical.
module BleeTest
def meth
puts 'foo'
end
end
This code runs without error, but is it ever possible the invoke the method "meth"?
It seems to me that "meth" is an instance method of a module which cannot be instantiated. But then why is this construct allowed by the interpreter?
...
Not sure what this means and why... I got the undefined method error when I try to go to http://localhost:3000/forums, and after I generate my first forum.
ActionView::TemplateError (undefined method `topics_path' for #<ActionView::Base:0x10319f2e0>) on line #25 of app/views/forums/index.html.erb:
The area of code the error refers to...
If you start a ruby app with the script/server command, what command do you use to stop it?
...