John, for the record, you have to add github as a source for
spicycode-rcov (gem sources -a http://gems.github.com).
JD
From: [email protected]
[[email protected]] On Behalf Of Jim D.
[[email protected]]
Sent: Tuesday, October 21, 2008 11:10 PM
To: [email protected]
Subject: Re: [Ironruby-core] Cucumber / RSpec Story Runner
Here’s another test if you are using gems. It should work with ir
test_spec.rb
JD
From: [email protected]
[[email protected]] On Behalf Of Orion E.
[[email protected]]
Sent: Tuesday, October 21, 2008 11:07 PM
To: [email protected]
Subject: Re: [Ironruby-core] Cucumber / RSpec Story Runner
Sure. Here’s the entire contents of the ruby file
$LOAD_PATH << ‘c:/dev/rspec/lib’
require ‘spec’
module ActiveSupport; end # workaround ironruby defined? bug
class Vehicle
def initialize(people)
@people = people
end
attr_accessor :people
end
describe Vehicle do
it “should assign people using the constructor” do
car = Vehicle.new([‘orion’, ‘john’, ‘jim’])
car.should have(3).people
end
end
Note I’m not using gems or anything else like that. To replicate this
you’d basically do this:
svn checkout ironruby 168 into c:\dev\ironruby
rake compile
git clone rspec straight from github, and stick it in c:\dev\rspec
edit c:\dev\rspec\lib\spec\extensions\main.rb and fix the call to
File.expand_path
spin up a command prompt and set PATH=blahblah so it can see the
ironruby binaries that got build previously
ir rspectest.rb
On 22/10/2008, at 6:40 PM, John L. (IRONRUBY) wrote:
Orion – can you supply us with your rspectest.rb file?
I was just hacking around with rspec 1.1.9 here, and it’s blowing up
with a bunch of dependencies on startup.
Thanks,
-John
From:
[email protected]mailto:[email protected]
[mailto:[email protected]] On Behalf Of Orion E.
Sent: Tuesday, October 21, 2008 7:37 PM
To: [email protected]mailto:[email protected]
Subject: Re: [Ironruby-core] Cucumber / RSpec Story Runner
The nested defined? bug is logged here:
http://rubyforge.org/tracker/index.php?func=detail&aid=22503&group_id=4359&atid=16798
The ‘caller’ one is actually 2 bugs, both of which have been logged by
ben hall already
http://rubyforge.org/tracker/?group_id=4359&atid=16798&func=detail&aid=22315
http://rubyforge.org/tracker/?group_id=4359&atid=16798&func=detail&aid=22348
For those interested in running rspec right now, a better fix is to
replace line 26 of main.rb with
args.last[:spec_path] = File.expand_path( caller(0)[1].split(‘:’).first
)
This will only cause rspec to lose the line number - you also have to
run ir with the -D flag, or it doesn’t include the path at all.
As far as my quick-hack investigation shows me, rspec only uses this
data for showing friendly error messages, rather than any core logic, so
perhaps it’s not super-critical.
It would be nice to run it unpatched tho, IronRuby is looking incredibly
close to doing that
Jim D. wrote:
I’ll add a rake task to compile release. Can you try to isolate those
cases and file bugs? The second one is pretty easy, but I’d like to have
tracking on both of them.
From:
[email protected]mailto:[email protected]
[mailto:[email protected]] On Behalf Of Orion E.
Sent: Tuesday, October 21, 2008 7:04 PM
To: [email protected]mailto:[email protected]
Subject: Re: [Ironruby-core] Cucumber / RSpec Story Runner
I just ran rspec 1.1.9 (straight from github) on IronRuby build 167, and
it appears to work (I only have a simple test, but hey).
I only had to make 2 changes:
rspec\lib\spec\extensions\main.rb:26 is
args.last[:spec_path] = File.expand_path(caller(0)[1])
IronRuby still doesn’t seem to handle caller quite the same as MRI. I
have no idea what that code is for, but I replaced it with this as a
quick hack
args.last[:spec_path] = “.”
and it seemed to work.
I encountered another problem using the ‘have’ matcher - rspec does this
if inflector = (defined?(ActiveSupport::Inflector) ?
ActiveSupport::Inflector : (defined?(Inflector) ? Inflector : nil))
IronRuby throws uninitialized constant Object::ActiveSupport, whereas
MRI just returns nil - it looks like IR isn’t handling defined? on
nested things properly yet.
To work around this I just put
module ActiveSupport; end
at the top of my ruby file to get around the nested module issue.
And presto!
C:\development\irtest>ir rspectest.rb
.
Finished in 2.072133 seconds
1 example, 0 failures
C:\development\irtest>ruby rspectest.rb
.
Finished in 0.053 seconds
1 example, 0 failures
The only problem now is that 2.07 seconds is somewhat larger than
0.053… I am using the debug build of ir though, as that’s what
rake:compile seems to give me.
Just playing with VS now to see if I can build a release version and try
that
Ben H. wrote:
Hi,
To get rspec to work you will need to modify the actual Ironruby
source. I’ve raised bugs to get the changes required fixed, however I
did this based on 1.1.4, I think Cucumber will have a whole load more
bugs attached as it has more dependencies.
I know for a fact you won’t be able to run Cucumber unmodified due to
existing bugs around gems. (for example, gem needing .rb at the end
of the file to be able to find it)
However, I haven’t had chance to take a closer look.
Ben
On Fri, Oct 17, 2008 at 2:53 PM, Curt H.
[email protected]mailto:[email protected] wrote:
If you explicitly set the GEM_PATH before requiring gems, you should be
able to use gems that are already present. I haven’t tried any other
gem operations.
I assume you’re running with the latest source?