I got this working following the initial direction of essentially making an
AssetExampleGroup be:
> module RSpec::Rails
> module AssetExampleGroup
> extend ActiveSupport::Concern
> include RSpec::Rails::RailsExampleGroup
> include Capybara::DSL
> include Capybara::RSpecMatchers
>
> included do
> metadata[:type] = :asset
> end
> end
> end
adding
> config.include RSpec::Rails::AssetExampleGroup, :type => :asset,
> :example_group => {
> :file_path => config.escaped_path(%w[spec assets])
> }
and the doing a visit followed by looking at 'source' (not 'html').
The one problem I have which I've posted to StackExchange is how do I for the
visit to assets/application.js not use what is in tmp/cache? Right now, I just
manually remove tmp/cache before running the test.
On Jan 6, 2013, at 8:29 AM, Perry Smith wrote:
> I'm trying to write a sprocket engine and test it. This is just part of a
> bigger Rails 3.2.8 project.
>
> I've put the spec in a directory called spec/assets and I've tried to cobble
> an AssetExampleGroup but haven't got it yet.
>
> I want to do a get of /assets/whatever.xyz. I hooked up Capybara's "visit"
> but that appears to wrap the raw content with whatever is needed to make it a
> legal html document (a doctype, html, body, and p tags). I just want the raw
> content.
>
> If I add these: (essentially following what a ControllerExampleGroup does)
>
>> include RSpec::Rails::RailsExampleGroup
>> include ActionController::TestCase::Behavior
>> include RSpec::Rails::ViewRendering
>> include RSpec::Rails::Matchers::RedirectTo
>> include RSpec::Rails::Matchers::RenderTemplate
>> include RSpec::Rails::Matchers::RoutingMatchers
>> include Capybara::DSL
>> include Capybara::RSpecMatchers
>
>
> then it can't find request=
>
> I may be going down the wrong path completely so I thought I'd stop and ask.
>
> Thank you for any help,
> Perry
>
--
You received this message because you are subscribed to the Google Groups
"rspec" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit https://groups.google.com/groups/opt_out.