Remarkable w/ Rails 3 and Rspec 2

172 views
Skip to first unread message

Josep Mª Bach Ramírez

unread,
Mar 16, 2010, 10:22:22 AM3/16/10
to Remarkable
Hi there!
I was wondering whether are there any plans towards compatibility for
using remarkable in rails 3/rspec 2 apps. For now it just won't even
load:

/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.0.beta/lib/
active_support/dependencies.rb:456:in `load_missing_constant':
uninitialized constant ActionController::StatusCodes (NameError)
from /usr/lib/ruby/gems/1.8/gems/activesupport-3.0.0.beta/lib/
active_support/dependencies.rb:91:in `const_missing'
from /usr/lib/ruby/gems/1.8/gems/remarkable_rails-3.1.13/lib/
remarkable_rails/action_controller/matchers/redirect_to_matcher.rb:5
from /usr/lib/ruby/gems/1.8/gems/activesupport-3.0.0.beta/lib/
active_support/dependencies.rb:167:in `require'
from /usr/lib/ruby/gems/1.8/gems/activesupport-3.0.0.beta/lib/
active_support/dependencies.rb:167:in `require'
from /usr/lib/ruby/gems/1.8/gems/activesupport-3.0.0.beta/lib/
active_support/dependencies.rb:537:in `new_constants_in'
from /usr/lib/ruby/gems/1.8/gems/activesupport-3.0.0.beta/lib/
active_support/dependencies.rb:167:in `require'
from /usr/lib/ruby/gems/1.8/gems/remarkable_rails-3.1.13/lib/
remarkable_rails/action_controller.rb:12
from /usr/lib/ruby/gems/1.8/gems/remarkable_rails-3.1.13/lib/
remarkable_rails/action_controller.rb:11:in `each'
from /usr/lib/ruby/gems/1.8/gems/remarkable_rails-3.1.13/lib/
remarkable_rails/action_controller.rb:11
from /usr/lib/ruby/gems/1.8/gems/activesupport-3.0.0.beta/lib/
active_support/dependencies.rb:167:in `require'
from /usr/lib/ruby/gems/1.8/gems/activesupport-3.0.0.beta/lib/
active_support/dependencies.rb:167:in `require'
from /usr/lib/ruby/gems/1.8/gems/activesupport-3.0.0.beta/lib/
active_support/dependencies.rb:537:in `new_constants_in'
from /usr/lib/ruby/gems/1.8/gems/activesupport-3.0.0.beta/lib/
active_support/dependencies.rb:167:in `require'
from /usr/lib/ruby/gems/1.8/gems/remarkable_rails-3.1.13/lib/
remarkable_rails.rb:26

How could this be fixed?

José Valim

unread,
Mar 16, 2010, 10:25:09 AM3/16/10
to Remarkable
That's expected. Nobody worked so far in having Remarkable compatible
with Rails 3 neither Rspec 2.
Unfortunately, it's not under my radar.

On Mar 16, 3:22 pm, Josep Mª Bach Ramírez <josep.m.b...@gmail.com>
wrote:

Carlos Brando

unread,
Mar 16, 2010, 11:32:50 AM3/16/10
to remarka...@googlegroups.com
I known some people who are working on it, but we are waiting for RSpec 2 out first.


2010/3/16 Josep Mª Bach Ramírez <josep....@gmail.com>

--
You received this message because you are subscribed to the Google Groups "Remarkable" group.
To post to this group, send email to remarka...@googlegroups.com.
To unsubscribe from this group, send email to remarkable-co...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/remarkable-core?hl=en.


Ho-Sheng Hsiao

unread,
Apr 15, 2010, 6:19:16 PM4/15/10
to Remarkable

Is there anything definitive on this? I saw the issue on the gitub:
http://github.com/carlosbrando/remarkable/issues/#list calling for
volunteers.

I have a project at work that needs it. I don't want to step on other
people's work. I do need this fairly soon, so I can spend the next
couple days or week or so working on if it is going to be a weekend
project for others.

Just a cursory glance at remarkable_activerecord so far: one big thing
is that it needs to patch into Rspec::Core::<something> rather than
Spec::Matchers. I haven't looked at remarkable_rails yet.

Let me know.

Ho-Sheng Hsiao

On Mar 16, 11:32 am, Carlos Brando <eduardobra...@gmail.com> wrote:
> I known some people who are working on it, but we are waiting for RSpec 2
> out first.
>
> 2010/3/16 Josep Mª Bach Ramírez <josep.m.b...@gmail.com>
> > remarkable-co...@googlegroups.com<remarkable-core%2Bunsubscribe@ googlegroups.com>
> > .

Carlos Brando

unread,
Apr 16, 2010, 9:55:28 AM4/16/10
to remarka...@googlegroups.com
There is nothing definite yet. Actually I'm looking for someone to
take over the project development. If you wish, you can contact this
interested people and organize this.

Ho-Sheng Hsiao

unread,
Apr 16, 2010, 10:29:16 AM4/16/10
to Remarkable

Ok. Sure, send them along. I've got a Remarkable-core more or less
working with Rspec2, though I didn't write it to be backwards
compatible. So if I take it over, I'd release a Remarkable 4.0 that is
not backwards compatible with Rspec1. Anyone else interested in taking
over development as far as Rspec1/Rails2 goes? The project I'm going
to use this on is all Rails3.

Ho-Sheng Hsiao


On Apr 16, 9:55 am, Carlos Brando <eduardobra...@gmail.com> wrote:
> There is nothing definite yet. Actually I'm looking for someone to
> take over the project development. If you wish, you can contact this
> interested people and organize this.
>
>
>
>
>
> On Thu, Apr 15, 2010 at 7:19 PM, Ho-Sheng Hsiao <hosheng.hs...@gmail.com> wrote:
>
> > Is there anything definitive on this? I saw the issue on the gitub:
> >http://github.com/carlosbrando/remarkable/issues/#listcalling for
> > For more options, visit this group athttp://groups.google.com/group/remarkable-core?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups "Remarkable" group.
> To post to this group, send email to remarka...@googlegroups.com.
> To unsubscribe from this group, send email to remarkable-co...@googlegroups.com.
> For more options, visit this group athttp://groups.google.com/group/remarkable-core?hl=en.

Ho-Sheng Hsiao

unread,
Apr 16, 2010, 10:49:33 AM4/16/10
to Remarkable
So for those who are interested, this is what I've pushed up to the
rspec2 branch on http://github.com/hosh/remarkable

Caveats:
- Targets Rspec 2 beta6
- Remarkable::Pending taken out -- rspec 2 uses micronaut metadata, so
stuff works with pending do end blocks
- Disabled examples are temporarily pending. I may have to talk to the
rspec guys about adding in runner hooks to get this to work
- Rspec2 uses Rspec:: namespace instead of Spec:: namespace, so this
breaks a lot of things. The biggest thing this breaks is the I18n
support. All YAML files referencing specs: will have to be changed
over to rspec:

There are two failing tests that I ran into last night, maybe a
longtime Remarkable dev can help with this:

hhh@sparkfly-rails3 ~/work/gems/remarkable/remarkable $ rake spec
(in /home/hhh/work/gems/remarkable/remarkable)
........................................*.....***...*..F.......F.........

1) Remarkable::Base should store spec instance binding
Failure/Error:
matcher.instance_variable_get('@spec').class.ancestors.should
include(Rspec::Core::ExampleGroup)
expected [Rspec::Core::ExampleGroup::Nested_6] to include
Rspec::Core::ExampleGroup
# ./spec/base_spec.rb:28
# /usr/lib64/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
`inject'
# ./spec/dsl/assertions_spec.rb:3

2) Remarkable::Matchers should not include modules twice
Failure/Error:
meta.should_receive(:ancestors).twice.and_return([Remarkable::Macros])
(<#<Class:#<Class:0x7f463a3c9df8>> (class)>).ancestors(any args)
expected: 2 times
received: 1 time
# ./spec/matchers_spec.rb:43
# /usr/lib64/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
`inject'
# ./spec/dsl/assertions_spec.rb:3


Finished in 0.0398 seconds
73 examples, 2 failures, 5 pending

Pending:
Remarkable::I18n não deve conter os valores fornecidos
# ./spec/i18n_spec.rb:39
Remarkable::Macros with disabled examples single contain
# ./spec/macros_spec.rb:15
Remarkable::Macros with disabled examples should contain the given
values
# ./spec/macros_spec.rb:16
Remarkable::Macros with disabled examples should not contain the
given values
# ./spec/macros_spec.rb:17
Remarkable pending examples pending examples
# ./spec/pending_spec.rb:19
rake aborted!
Command /usr/bin/ruby18 -Ilib -Ispec "./spec/dsl/assertions_spec.rb"
"./spec/dsl/optionals_spec.rb" "./spec/i18n_spec.rb" "./spec/
macros_spec.rb" "./spec/pending_spec.rb" "./spec/base_spec.rb" "./spec/
matchers_spec.rb" "./spec/messages_spec.rb" failed


(1) I am not sure what the intent of this example is.

(2) Since Pending was taken out, the spec was changed to only detect a
single inherited module. However, I'm not entirely sure why the
example would say it should only be included twice.

Also: if anyone has a stake in Remarkable for Rspec 2, please speak up
now. As I mentioned in my earlier post, I have a need and it is part
of my paid work so given a vacuum, I'll write it to suit my needs. And
right now, it does not include any backwards compatibility (besides
which, rspec2 is not drop-in backwards compatible with rspec1).

Ho-Sheng Hsiao

Ho-Sheng Hsiao

unread,
Apr 16, 2010, 5:54:29 PM4/16/10
to Remarkable

Update on rspec2 branch:

I worked on Remarkable::ActiveRecord for ActiveRecord3. I fixed a
number of deprecations, including human_name, named_scope, etc.

The big blocker right now is named_scope options.There is no longer a
named scope class and metadata about what is being scoped can only be
captured by pulling the Binding from anonymous function when scope is
first called, and what I have is only partially working.

I'm considering submitting a patch to Rails 3 so the scope options can
be queried.

Ho-Sheng Hsiao

unread,
Apr 19, 2010, 3:01:22 PM4/19/10
to Remarkable

Update:

So how much do people care about I18n error messages?

From: http://github.com/svenfuchs/activemodel-error

> Rails 2.3.5 introduced support for lazy translations of ActiveRecord validation messages. This enabled various features that are
> required when you need consistent I18n support for these messages.

> These changes never got ported to ActiveModel and ActiveRecord 3.0.0beta1 is based on ActiveModel. So Rails 3.0.0.beta1
> does not include the changes either. Thus Rails 3 was forced to either break backwards compatibility for either ActiveRecord or
> ActiveModel. Because the implementation of mentioned changes in ActiveRecord 2.3.5 was kind of flaky anyway (at that point
> backwards compatibility alread had to be taken into account) the former option was chosen.

> So instead of trying to fit these changes into ActiveModel we’ve gone back to the drawing board and came up with a fresh and
> clean implementation of what surfaced as relevant features in our previous attemps. This situation now allows us to (again)
> experiment with features and implementations way more freely, check out concurring implementations and possibly cherry-pick
> the best of breed for re-inclusion into Rails.

So basically, I'm contemplating disabling the examples and that part
of the code for now and getting a working subset before circling back
around to this. i18n validations messages is not important to me,
though it seems to be important for others.

Feedback is appreciated.

Ho-Sheng Hsiao
http://hosheng.blogspot.com

Ho-Sheng Hsiao

unread,
Apr 19, 2010, 11:40:04 PM4/19/10
to Remarkable

Update to rspec2:

- Named scope matches against Arel objects (using the == method
provided by Arel)
- Named scope matchers currently uses .to_sql to generate the message.
This is intended as temporary. The goal is to get most of this ported
over before coming up with a better solution.
- Added new Remarkable::ActiveModel and culled out the ActiveModel-
specific matchers
- Failing tests due to i18n validations in Remarkable::ActiveRecord.
Still need to figure this out.

TODO:
- Cut out the ActiveRecord macros and matchers that are already tested
with Remarkable::ActiveModel
- Add macros for ActiveModel lints (Probably post-port) so you can
rspec .to_model compliance
- Add macros for ActiveModel::Serializations
- Add loading ActiveModel matchers in Remarkable::Rails
- Figure out a way to pretty-print Arel objects
- Fix two failing examples in remarkable-core

Ho-Sheng Hsiao
http://blogspot.hosheng.hsiao

Ho-Sheng Hsiao

unread,
Apr 21, 2010, 9:26:02 PM4/21/10
to Remarkable

Update to rspec2

- All tests passed with the following caveats
- subject_attribute was cut out
- shorthand for specifying subject_attribute in describe block was
cut out
- (This needs to be considered in context of the new metadata
functionality in Rspec2)

I took a brief look at Remarkable::Rails and it looks depressing to
me, since it would require dealing with Rspec2, Rspec-rails2 *and* the
whole refactored ActiveController stuff.

So for tomorrow, I'm going to get an alpha1 of remarkable (core),
remarkable_activemodel, and remarkable_activerecord and figure out a
way to package it so when you bundle it, it will come up without
having to load up remarkable_rails. It would also meet most of my
needs for the moment.

So all you folks who put your names in the hat: I'm calling that in to
work on remarkable-rails :-)

When github straightens out the issue tracker with remarkable/
remarkable, I'll add in some other side items for anyone that wants to
pick them up.

Food for discussion:

With regards to Remarkable::Rails, it may be more interesting to do
what I plan to do with Remarkable::ActiveModel -- that is, having
macros that test for compliance with the public APIs. I think that
would be *much* more useful than a straight-up replacement for shoulda
integration macros. The redirect_to macro, for example, would
essentially check the outgoing Rack response, and it would mean you
can test in-route redirect_to without necessarily having to set up
controllers.

Maybe set aside a remarkable_rack for macros that lets you test rack
middleware and rack endpoints, then build the remarkable_rails on top
of that.

The more I think about it, the more I like the idea. You would be able
to test Sinatra apps this way, whether they are embedded inside Rails
or not.

Then the rest of it would be macros that tests for compliance with
ActionController, so when it comes time to roll your own, you can
verify that they are properly responding to the right API calls.

Ho-Sheng Hsiao
http://hosheng.blogspot.com

Carlos Brando

unread,
Apr 22, 2010, 9:54:58 AM4/22/10
to remarka...@googlegroups.com
Very good.
Reply all
Reply to author
Forward
0 new messages