ninitialized constant Pickle::Adapter::DataMapper

20 views
Skip to first unread message

Aleksander Dąbrowski

unread,
Aug 23, 2010, 2:43:00 PM8/23/10
to pickle
Hi,

I'm writing a little application in Sinatra and Datamapper, and I'm
using Cucumber and Capybara. I wanted to use pickle, so I added file
at support/pickle.rb with following content:

require 'pickle/world'

Pickle.configure do |config|
config.adapters = [ DataMapper::Resource]
end

Unfortunately i got this error:
uninitialized constant Pickle::Adapter::DataMapper
/Library/Ruby/Gems/1.8/gems/activesupport-2.3.8/lib/active_support/
dependencies.rb:105:in `const_missing'
/Library/Ruby/Gems/1.8/gems/activesupport-2.3.8/lib/active_support/
inflector.rb:364:in `constantize'
/Library/Ruby/Gems/1.8/gems/activesupport-2.3.8/lib/active_support/
inflector.rb:363:in `each'
/Library/Ruby/Gems/1.8/gems/activesupport-2.3.8/lib/active_support/
inflector.rb:363:in `constantize'
/Library/Ruby/Gems/1.8/gems/activesupport-2.3.8/lib/active_support/
core_ext/string/inflections.rb:162:in `constantize'
/Library/Ruby/Gems/1.8/gems/pickle-0.4.2/lib/pickle/config.rb:18:in
`adapter_classes'
/Library/Ruby/Gems/1.8/gems/pickle-0.4.2/lib/pickle/config.rb:18:in
`map'
/Library/Ruby/Gems/1.8/gems/pickle-0.4.2/lib/pickle/config.rb:18:in
`adapter_classes'
/Library/Ruby/Gems/1.8/gems/pickle-0.4.2/lib/pickle/config.rb:22:in
`factories'
/Library/Ruby/Gems/1.8/gems/pickle-0.4.2/lib/pickle/parser/matchers.rb:
41:in `match_factory'
/Library/Ruby/Gems/1.8/gems/pickle-0.4.2/lib/pickle/parser/matchers.rb:
49:in `match_indexed_model'
/Library/Ruby/Gems/1.8/gems/pickle-0.4.2/lib/pickle/parser/matchers.rb:
57:in `match_model'
(eval):2:in `capture_model'
/Library/Ruby/Gems/1.8/gems/pickle-0.4.2/lib/pickle/world.rb:14:in
`__send__'
/Library/Ruby/Gems/1.8/gems/pickle-0.4.2/lib/pickle/world.rb:14:in
`capture_model'
/Users/aleks/kumulator/sinatra-pong/features/step_definitions/
pickle_steps.rb:4
/Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in
`gem_original_require'
/Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require'
/Library/Ruby/Gems/1.8/gems/activesupport-2.3.8/lib/active_support/
dependencies.rb:156:in `require'
/Library/Ruby/Gems/1.8/gems/activesupport-2.3.8/lib/active_support/
dependencies.rb:521:in `new_constants_in'
/Library/Ruby/Gems/1.8/gems/activesupport-2.3.8/lib/active_support/
dependencies.rb:156:in `require'
/Library/Ruby/Gems/1.8/gems/cucumber-0.8.5/bin/../lib/cucumber/
rb_support/rb_language.rb:141:in `load_code_file'
/Library/Ruby/Gems/1.8/gems/cucumber-0.8.5/bin/../lib/cucumber/
step_mother.rb:108:in `load_code_file'
/Library/Ruby/Gems/1.8/gems/cucumber-0.8.5/bin/../lib/cucumber/
step_mother.rb:100:in `load_code_files'
/Library/Ruby/Gems/1.8/gems/cucumber-0.8.5/bin/../lib/cucumber/
step_mother.rb:99:in `each'
/Library/Ruby/Gems/1.8/gems/cucumber-0.8.5/bin/../lib/cucumber/
step_mother.rb:99:in `load_code_files'
/Library/Ruby/Gems/1.8/gems/cucumber-0.8.5/bin/../lib/cucumber/cli/
main.rb:56:in `execute!'
/Library/Ruby/Gems/1.8/gems/cucumber-0.8.5/bin/../lib/cucumber/cli/
main.rb:25:in `execute'
/Library/Ruby/Gems/1.8/gems/cucumber-0.8.5/bin/cucumber:8
/usr/bin/cucumber:19:in `load'
/usr/bin/cucumber:19

I also tried to do:

config.adapters = [ :data_mapper ]

But the result was the same.

My application is here: http://github.com/tjeden/sinatra-pong/tree/pickle

What I am doing wrong?

Regards,
Aleksander Dąbrowski

Ian White

unread,
Aug 23, 2010, 3:02:36 PM8/23/10
to pickle-...@googlegroups.com
Hi there,

In 0.4, the adapters setting is for your factory adapters (ie. machinist or similar), and you need to provide a class that is an adapter (not an ORM class)

But pickle should work for you without any config, did you try it without adding the adapter config line?

If you are getting errors without any extra config, then try this before Pickle.config:

require 'pickle/adapters/data_mapper'

Let me know how you get.

Cheers,
Ian

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

Aleksander Dąbrowski

unread,
Aug 31, 2010, 5:38:42 PM8/31/10
to pickle
Hi,

It helped, thanks.
require 'pickle/world'
did the job.

But now I have another problem. When I run me scenario allone i.e.:
cucumber features/report_match.feature
It works well.

But when I run all scenarios with
cucubmer features I got:
Given a dm_user "Jack" exists with email: "ja...@example.com" #
features/step_definitions/pickle_steps.rb:4
stack level too deep (SystemStackError)
./features/step_definitions/pickle_steps.rb:5:in `/^((?:(?:)|(?:
(?:a|an|another|the|that) )?(?:(?:(?:(?:first|last|(?:\d+(?:st|nd|rd|
th))) )?(?:dm[_ ]user))|(?:(?:dm[_ ]user)(?::? "(?:[^\"]|\.)*")))))
exists?(?: with ((?:(?:\w+: (?:(?:(?:)|(?:(?:a|an|another|the|that) )?
(?:(?:(?:(?:first|last|(?:\d+(?:st|nd|rd|th))) )?(?:dm[_ ]user))|(?:
(?:dm[_ ]user)(?::? "(?:[^\"]|\.)*"))))|(?:"(?:[^\"]|\.)*"|nil|true|
false|[+-]?[0-9_]+(?:\.\d+)?))), )*(?:\w+: (?:(?:(?:)|(?:(?:a|an|
another|the|that) )?(?:(?:(?:(?:first|last|(?:\d+(?:st|nd|rd|th))) )?
(?:dm[_ ]user))|(?:(?:dm[_ ]user)(?::? "(?:[^\"]|\.)*"))))|(?:"(?:[^
\"]|\.)*"|nil|true|false|[+-]?[0-9_]+(?:\.\d+)?)))))?$/'
features/report_match.feature:8:in `Given a dm_user "Jack"
exists with email: "ja...@example.com"'

I'm using http://github.com/maxjustus/sinatra-authentication, with
datamapper, maybe it causes the problem?

Ian White

unread,
Sep 1, 2010, 6:15:09 AM9/1/10
to pickle-...@googlegroups.com
Hi,

Not sure what's going on there, if it's working with one scenario, I'd expect it to work with many.

Could you push your code to a branch, or a gist, for me to take a gander?

Cheers,
Ian

Aleksander Dąbrowski

unread,
Sep 1, 2010, 5:20:38 PM9/1/10
to pickle
Hi,

This is my branch of my application with pickle

http://github.com/tjeden/sinatra-pong/tree/pickle

Regards
Olek

On Sep 1, 12:15 pm, Ian White <ian.w.wh...@gmail.com> wrote:
> Hi,
>
> Not sure what's going on there, if it's working with one scenario, I'd expect it to work with many.
>
> Could you push your code to a branch, or a gist, for me to take a gander?
>
> Cheers,
> Ian
>
> On 31 Aug 2010, at 22:38, Aleksander Dąbrowski wrote:
>
>
>
> > Hi,
>
> > It helped, thanks.
> > require 'pickle/world'
> > did the job.
>
> > But now I have another problem. When I run me scenario allone i.e.:
> > cucumber features/report_match.feature
> > It works well.
>
> > But when I run all scenarios with
> > cucubmer features I got:
> >    Given a dm_user "Jack" exists with email: "j...@example.com"     #
> > features/step_definitions/pickle_steps.rb:4
> >      stack level too deep (SystemStackError)
> >      ./features/step_definitions/pickle_steps.rb:5:in `/^((?:(?:)|(?:
> > (?:a|an|another|the|that) )?(?:(?:(?:(?:first|last|(?:\d+(?:st|nd|rd|
> > th))) )?(?:dm[_ ]user))|(?:(?:dm[_ ]user)(?::? "(?:[^\"]|\.)*")))))
> > exists?(?: with ((?:(?:\w+: (?:(?:(?:)|(?:(?:a|an|another|the|that) )?
> > (?:(?:(?:(?:first|last|(?:\d+(?:st|nd|rd|th))) )?(?:dm[_ ]user))|(?:
> > (?:dm[_ ]user)(?::? "(?:[^\"]|\.)*"))))|(?:"(?:[^\"]|\.)*"|nil|true|
> > false|[+-]?[0-9_]+(?:\.\d+)?))), )*(?:\w+: (?:(?:(?:)|(?:(?:a|an|
> > another|the|that) )?(?:(?:(?:(?:first|last|(?:\d+(?:st|nd|rd|th))) )?
> > (?:dm[_ ]user))|(?:(?:dm[_ ]user)(?::? "(?:[^\"]|\.)*"))))|(?:"(?:[^
> > \"]|\.)*"|nil|true|false|[+-]?[0-9_]+(?:\.\d+)?)))))?$/'
> >      features/report_match.feature:8:in `Given a dm_user "Jack"
> > exists with email: "j...@example.com"'
>
> > I'm usinghttp://github.com/maxjustus/sinatra-authentication, with
Reply all
Reply to author
Forward
0 new messages