D
DeNigris Sean
Hi list,
I can't figure out why this doesn't do what I expected...
# Spec file:
context "showing Ruby reference materials" do
it "should open the rspec book in preview" do
require "sean/preview"
class << ApplicationScripting:review
def self.reference
preview =3D double('Preview')
=
preview.should_receiveopen).with('.../the-rspec-book_b12_0.pdf')
end
end
require "sean/vim"
class << ApplicationScripting::Vim
def self.reference
vim =3D double('Vim')
end
end
VimPlugin::show_ruby_reference_materials
end
end
# Library file
class VimPlugin
def self.show_ruby_reference_materials
require "sean/preview"
preview =3D ApplicationScripting:review.reference
preview.open =
'/Users/sean/Downloads/the-rspec-book_b12_0.pdf'
require "sean/vim"
vim_screen =3D =
ApplicationScripting::Vim.reference.window(1).screen
require "sean/screen"
another_screen =3D System::Screen::screens.detect { |s| =
s !=3D vim_screen }
preview.window(1).frame =3D =
another_screen.available_frame
preview.activate
end
end
I was hoping that in the spec/test code, the mocked out version would be =
called, but it used the regular implementations instead. I'm guessing =
that "self" is not being changed in the definitions, but if I open up =
the classes like:
module ::ApplicationScripting
class Preview
def self.reference
preview =3D double('Preview')
=
preview.should_receiveopen).with('.../the-rspec-book_b12_0.pdf')
end
end
end
I get "undefined method `double' for ApplicationScripting:review"
I'm out of ideas and I'm not getting what's going on on a deeper level =
here.
Thanks in advance!
Sean DeNigris
I can't figure out why this doesn't do what I expected...
# Spec file:
context "showing Ruby reference materials" do
it "should open the rspec book in preview" do
require "sean/preview"
class << ApplicationScripting:review
def self.reference
preview =3D double('Preview')
=
preview.should_receiveopen).with('.../the-rspec-book_b12_0.pdf')
end
end
require "sean/vim"
class << ApplicationScripting::Vim
def self.reference
vim =3D double('Vim')
end
end
VimPlugin::show_ruby_reference_materials
end
end
# Library file
class VimPlugin
def self.show_ruby_reference_materials
require "sean/preview"
preview =3D ApplicationScripting:review.reference
preview.open =
'/Users/sean/Downloads/the-rspec-book_b12_0.pdf'
require "sean/vim"
vim_screen =3D =
ApplicationScripting::Vim.reference.window(1).screen
require "sean/screen"
another_screen =3D System::Screen::screens.detect { |s| =
s !=3D vim_screen }
preview.window(1).frame =3D =
another_screen.available_frame
preview.activate
end
end
I was hoping that in the spec/test code, the mocked out version would be =
called, but it used the regular implementations instead. I'm guessing =
that "self" is not being changed in the definitions, but if I open up =
the classes like:
module ::ApplicationScripting
class Preview
def self.reference
preview =3D double('Preview')
=
preview.should_receiveopen).with('.../the-rspec-book_b12_0.pdf')
end
end
end
I get "undefined method `double' for ApplicationScripting:review"
I'm out of ideas and I'm not getting what's going on on a deeper level =
here.
Thanks in advance!
Sean DeNigris