I'm having problems figuring out how to run the various tests for
extensions in Spree.
First off, I have never written or run any ruby/rails tests before, so
from a testing perspective I'm a total newbie so please be kind.
I have read through the docs on testing Spree found here:
http://edgeguides.spreecommerce.com/testing.html
The documentation seems to be directed at someone running with the
gem. I'm actually working with the latest edge code (in this case the
namespace branch) and can't figure out how to make the commands shown
in the documentation work from a clone of the repository.
The documentation really isn't very good at explaining how to test for
someone who is new to Ruby/Rails testing, and the normal Rails testing
docs that I find seem to be centered around testing the app rather
than the extensions.
In the section "Testing Standalone Extensions" it says to:
a) spree extension foofah
b) rake test_app
c) bundle exec rspec spec
It doesn't say anything about the relative directory that you are
running these commands from. The first command gives me an error
about not being able to find Spree. So how do I tell it to use my
cloned copy?
If I first generate a generic (rails new appname) app and then add
Spree to the Gemfile, and then run: "bundle exec spree extension
foofah" I get an extension created inside the main app directory as
expected. Of course this is counter intuitive since step (b) says
that I'm creating a test app, so why did I need to create an
additional app?
But then if I try step (b) from the same main app directory I get:
rake aborted!
Don't know how to build task 'test_app'
If I run command (b) from inside the spree_foofah extension directory
then I get:
no such file to load --
../../spree_master_namespaced/lib/generators/spree/test_app_generator
The path to Spree in the above error is correct, but there is no
/lib/generators/spree/test_app_generator.
Searching through the Spree code I can't find a test_app_generator
file/folder anywhere.
So what am I missing?
I figure it's long past time that I start creating tests for my
extensions, but I can't even figure out how to properly run the tests
for the existing official extensions, much less create and run my own.
If somebody would be so kind as to give me step by step instruction
starting from an empty folder on the filesystem to being able to test
the spree_store_credits extension
(https://github.com/spree/spree_store_credits), or any other official
extension I would REALLY appreciate it.
I figure once I can figure out how to do it with one of the official
extensions then I can figure out how to do it for my own.
By the way, I know that the spree_store_credits extension won't work
with the namespace branch of Spree. That's the point. I'm using that
extension, and I want to get all the extensions that I'm using
working with the namespace branch. I want to be able to run the tests
to ensure that I have all the pieces working properly before I submit
any pull requests.
Thanks in advance,
Chris
> Gemfile, gemspec
> Rakefile (you might want to comment-out Cucumber-related stuff if you'll be
> writing only specs)
> spec/spec_helper.rb
I'm still a long way from being able to run the tests though so I'm
looking forward to your writeup.
How is anyone from the core Spree team testing the official extensions
against the namespaced branch?
For that matter, how are you even testing the namespaced branch itself?
Thanks,
Chris
How is anyone from the core Spree team testing the official extensions
against the namespaced branch?
For that matter, how are you even testing the namespaced branch itself?
--
You received this message because you are subscribed to the Google Groups "Spree" group.
To post to this group, send email to spree...@googlegroups.com.
To unsubscribe from this group, send email to spree-user+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/spree-user?hl=en.
I think I have figured out how to test the individual spree portions
now (core, auth, etc). I thought they could be done from the top
spree folder, but apparently I need to be inside each of the
individual section folders to run the tests. At least that's the only
way I can seem to get them to run. These are the kinds of details
that seem to be missing from the documentation. Part of the problem
is with the wording on the documentation page:
[quote]
Spree consists of several different gems (see the Source Code Guide
for more details.) Each of these gems has its own test suite which can
be found in the spec directory. Since these gems are also Rails
engines, they can’t really be tested in complete isolation – they need
to be tested within the context of a Rails application.
[/quote]
So, let's step back one step then. How do I test ANY official
extension using the master branch of Spree?
Because when I try with the spree_store_credits extension
(https://github.com/spree/spree_store_credits) the steps listed here
don't seem to work.
http://edgeguides.spreecommerce.com/testing.html
I can't be the only one that can't seem to figure out how to do this.
Of course this is exactly why I don't currently have any tests. I'm
always under the gun to get the actual code written and can't spend
weeks trying to figure out how to make the testing framework
functional.
I've also tried with Tomash's extensions and what I get is:
spree-homepage$ bundle exec rake test_app
You cannot specify the same gem twice with different version
requirements. You specified: rspec-rails (= 2.6.1) and rspec-rails (>=
0)
spree-homepager$ bundle exec rspec spec
You cannot specify the same gem twice with different version
requirements. You specified: rspec-rails (= 2.6.1) and rspec-rails (>=
0)
I'm sure that I am just missing some little thing that once I figure
it out I'll have no clue why it was so hard, but I'm obviously blind
or stupid or both, because I can't seem to figure it out.
Any help is truly appreciated.
Chris
Have a safe trip.
Chris
I've also tried with Tomash's extensions and what I get is:
spree-homepage$ bundle exec rake test_app
You cannot specify the same gem twice with different version
requirements. You specified: rspec-rails (= 2.6.1) and rspec-rails (>=
0)
spree-homepager$ bundle exec rspec spec
You cannot specify the same gem twice with different version
requirements. You specified: rspec-rails (= 2.6.1) and rspec-rails (>=
0)I'm sure that I am just missing some little thing that once I figure
it out I'll have no clue why it was so hard, but I'm obviously blind
or stupid or both, because I can't seem to figure it out.
--
You received this message because you are subscribed to the Google Groups "Spree" group.
To view this discussion on the web visit https://groups.google.com/d/msg/spree-user/-/EVJeuzNGsXwJ.
So what do you do to test the extensions against the latest Spree code
before an official gem is built? Or does that not happen? Do you
just build and install a local gem (I'm not exactly sure how to do
that, but I seem to remember that it's possible)?
I played with the SPREE_PATH environment variable too, but it still
wasn't working. So why exactly can it be run from a gem but not from
the cloned copy? That doesn't really make sense to me.
Old testing method vs. new testing method. Rspec, cucumber,
....(insert your favorite test env here)..., it seems like the
favorite way of testing changes even faster than the Spree code
itself, which already is running at a breakneck speed.
So if I understand it correctly:
1) All the official extensions are currently testing with a method
that is going away in the near future, so don't use them as an
example.
2) The latest edge code (the namespace branch) can only be tested via
the individual components (core, auth, promo, etc).
I've got a ton of extensions to update to work with the namespace
changes, so once Ryan said he was ready to make the merge and asked
people to play around with it I figured it was a good time to start
making the changes. I knew it wasn't going to be pain free, but I did
think running tests against it would be easier.
My personal project has gotten so big that every time Spree is updated
it's a major undertaking to make sure everything is still working.
With as big a change as the namespacing is and the amount of work it's
going to take to update all my code I figured it was as good of a time
as any to start writing some tests.
At this point I figure I'll just hold off until everything settles way
down before dealing with the tests. No point in writing a bunch of
tests against the current Spree gem when they are just going to all
break anyway with the namespace changes.
Chris
Thanks again,
Chris
> --
> You received this message because you are subscribed to the Google Groups
> "Spree" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/spree-user/-/Jc06uLzVP1YJ.