Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

preprocessing examples (and metadata) #969

Closed
rweng opened this issue Jul 9, 2013 · 10 comments
Closed

preprocessing examples (and metadata) #969

rweng opened this issue Jul 9, 2013 · 10 comments
Milestone

Comments

@rweng
Copy link

@rweng rweng commented Jul 9, 2013

Hi,

https://github.com/sauce-labs/sauce_ruby requires everything annotated with :js to be annotated with :sauce => true too if it should run on saucelabs. Now I wonder if I can preprocess examples and add the sauce: true if :js is set.

I had a similar issue that was regarding preprocessing (#948). It was labeled rspec-3, so maybe what I am looking for now is also rspec-3. Is there a planned timeline for this?

Thanks,
Robin

@JonRowe
Copy link
Member

@JonRowe JonRowe commented Jul 11, 2013

Tagging mostly means we're just not going to look at it until RSpec 3, not that we've planned it, in any case your previous suggestion in #948 is already doable, which leads me to maybe think something along these lines is possible.

So could you try something for me? Does this pull in the sauce labs code for js tags? (Although I'd imagine it will only run the tests tagged with js)

config.filter_run_including js: -> value, metadata { metadata[:sauce] = metadata[:js] }
@cupakromer
Copy link
Member

@cupakromer cupakromer commented Jul 11, 2013

This should be possible when your module is included:

module Super
  module Awesome
    def self.included(klass)
      klass.class_exec do
        metadata[:awesome] = :super
      end
    end
  end
end

RSpec.configure do |c|
  c.include Super::Awesome, js: true    # Adds awesome: :true
end

Or if you use ActiveSupport::Concern:

module Super
  module Awesome
    extend ActiveSupport::Concern

    included do
      metadata[:awesome] = :super
    end
  end
end
@JonRowe
Copy link
Member

@JonRowe JonRowe commented Jul 11, 2013

You can try @cupakromer's suggestion, but I'm not convinced that will trigger the code inclusion you want here, incidentally you could also ask sauce labs to allow you to customise which tag is required :p

(Also please don't use ActiveSupport::Concern for things like this.)

@cupakromer
Copy link
Member

@cupakromer cupakromer commented Jul 11, 2013

😝 🙈 I only added the AS::Concern as an example of how it could be added in to an already larger module using it, wasn't advocating it's use for this sole purpose.

@JonRowe
Copy link
Member

@JonRowe JonRowe commented Jul 12, 2013

We get enough bug reports that are due to Rails as is without adding AS::Concern into the mix.

@mikegee
Copy link

@mikegee mikegee commented Aug 28, 2013

@rweng Do you have any results to report back from trying the suggestions?

@rweng
Copy link
Author

@rweng rweng commented Aug 28, 2013

@mikegee nope, we paused the saucelabs integration brauch and shifted focus. It's still on the roadmap though.

@xaviershay
Copy link
Member

@xaviershay xaviershay commented Dec 7, 2013

Is this still an issue with RSpec 3?

@myronmarston
Copy link
Member

@myronmarston myronmarston commented Dec 7, 2013

Is this still an issue with RSpec 3?

We haven't done anything to address this yet.

@rweng -- do you have an example of what kind of preprocessing API you would like?

@rweng
Copy link
Author

@rweng rweng commented Dec 11, 2013

I am not really into the matter anymore. What I think would be nice is being able to access the tests directly, reading their metadata, title, group etc and enabling/disabling them based that.

myronmarston added a commit that referenced this issue Apr 22, 2014
Fixes #969 and supercedes #1089.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

6 participants