Running the unit tests

3 views
Skip to first unread message

Scott Woods

unread,
May 19, 2010, 11:27:00 AM5/19/10
to Skyline CMS
Hi there,

We're a custom web development company, and we're starting to use
Skyline quite a bit for our projects. We've been really happy with it.
Thank you for choosing to make it open source!

We have a specific question: we're trying to run the tests that come
with the gem, and can't find a way to get them working without
modifying the existing setup. Is there a way to run them that works
out of the box?

Thanks again,
Scott

--
Scott Woods
President
West Arete Computing
http://westarete.com




Ronald Wind

unread,
May 19, 2010, 1:08:54 PM5/19/10
to skyli...@googlegroups.com
Hi Scott,

Thanks for your mail.
Can you please mail me how you are trying to run the tests and what
output you're getting? You said you can get it to work with a
modification, can you also tell what modifications you made?

Thanks,
Kind regards,

Ronald

Scott Woods

unread,
May 19, 2010, 2:33:12 PM5/19/10
to Skyline CMS
Hi Ronald,

Oops. Sorry about sending the request with zero details. Here's a
transcript of all the ways that I've tried to run the tests in the
skyline gem source:

http://gist.github.com/406596

I would have expected to be able to run "rake test" or run one of the
tests by hand. Are you guys running the tests in a different
fashion?

Actually, now that I read through the test_helper, I'm guessing that
the gem can not be tested independently, but needs to be vendored as
part of a Rails app. Is that correct? Even so, I'm having a hard time
figuring out how to invoke the tests. Here's my session from trying to
run one within a Rails app:

http://gist.github.com/406650

Do I need to require the gem's tasks files in the top-level Rails
app's Rakefile? I'm closer than I was when I wrote the first email,
but not sure if there's an easier way to be doing this.

Thanks very much,
Scott

Ronald Wind

unread,
May 20, 2010, 5:01:26 AM5/20/10
to skyli...@googlegroups.com
Hi Scott,

We indeed only test the gem when its vendored as part of an app. My
colleague who know a lot more about testing Skyline and the way it is
setup is on vacation this week, but maybe I can help.
I can test Skyline (when vendored to /vendor/plugins/skyline) with one
of these commands:

$ cd a_rails_project
$ rake skyline:test

$ cd a_rails_project/vendor/plugins/skyline/test
$ ruby unit/page_test.rb

Hopefully this also works in your environment. If not, my colleague will
have a look when he's back in the office.

Regards,

Scott Woods

unread,
May 20, 2010, 1:55:24 PM5/20/10
to Skyline CMS
Hi Ronald,

I see part of what's going on. That doesn't work for my setup (more on
this in a minute):

$ rake skyline:test
(in /Users/woods/src/git/...)
rake aborted!
Don't know how to build task 'skyline:test'
(See full trace by running task with --trace)

Here are the skyline tasks that are available:

$ rake -T skyline
(in /Users/woods/src/git/...)
rake skyline:db:migrate # Migrate the skyline migrations
rake skyline:db:migrate:down # Runs the "down" for a given migration
VERSION.
rake skyline:db:migrate:redo # Rollbacks the database one migration
and re migrate up.
rake skyline:db:migrate:reset # Resets your database using your
migrations for the current environment
rake skyline:db:migrate:up # Runs the "up" for a given migration
VERSION.
rake skyline:db:rollback # Rolls the schema back to the previous
version.
rake skyline:db:seed # Run all seed files in Skyline.root/db/
fixtures/**

I think this is due to the fact that I have skyline installed as a
gem:

$ rake gems
(in /Users/woods/src/git/...)
- [R] skylinecms
- [I] haml = 2.2.15
- [I] compass = 0.8.17
- [I] haml >= 2.2.0
- [R] hoptoad_notifier = 2.2.2
- [I] crack
- [I] annotate = 2.4.0
- [I] capistrano-helpers
- [I] capistrano >= 2.0.0
- [I] net-ssh >= 2.0.14
- [I] net-sftp >= 2.0.0
- [I] net-ssh >= 1.99.1
- [I] net-scp >= 1.0.0
- [I] net-ssh >= 1.99.1
- [I] net-ssh-gateway >= 1.0.0
- [I] net-ssh >= 1.99.1
- [I] highline
- [I] newrelic_rpm = 2.9.9

I = Installed
F = Frozen
R = Framework (loaded before rails starts)

And it looks like you have it installed as a plugin. I tried running
it as a vendored gem, and I could get the rake tasks included by
adding the following line to my Rakefile:

Dir["#{RAILS_ROOT}/vendor/gems/*/tasks/**/*.rake"].sort.each { |ext|
load ext }

But then I still didn't have any luck running the tests by hand as a
vendored gem.

I guess this brings up a good question: what is the preferred way to
run Skyline? Vendored gem, installed gem, or plugin? Are all three
methods recommended, or are some discouraged?

Thanks again!
Scott

Flurin Egger

unread,
May 26, 2010, 4:02:16 AM5/26/10
to skyli...@googlegroups.com
Hi Scott,

We are indeed only testing skyline when we are using it as a plugin.
It shouldn't be to hard to fix it so it will work in the gem too. I'll
look in to this in the near future (maybe you can create an issue on
github for this? That would be great!)

The recommended way to use Skyline is as a vendored gem (we prefer to
use bundler, but I saw there were some problems with newer versions of
bundler) or as a vendored plugin. It's fine to use the installed gem
in development though.

We're currently working on a new version that adress some of these
issues (bundler/running tests).

Regards,
Flurin

On May 20, 2010, at 19:55 , Scott Woods wrote:

> Hi Ronald,
>

Scott Woods

unread,
Jun 1, 2010, 11:06:42 AM6/1/10
to Skyline CMS
Great, thanks Flurin. We would be happy to help contribute to the
effort, both in terms of feedback and code. We're going to investigate
a bit further, and we'll contribute a description of the issue at the
very least, if not a fix.

That would be fantastic to see bundler in the main line of development
too -- that would ease some deployment issues for us.

Thank you!
Scott
Reply all
Reply to author
Forward
0 new messages