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

specs integration #16

Open
costa opened this issue Jan 15, 2014 · 6 comments
Open

specs integration #16

costa opened this issue Jan 15, 2014 · 6 comments

Comments

@costa
Copy link

costa commented Jan 15, 2014

I would like to use my mail preview code in my specs suite; will be grateful for any ideas on doing so — or substantial reasons not to.

@costa
Copy link
Author

costa commented Jan 15, 2014

To be clear, I've implemented a simple plain ruby class specs for this (and they work fine), I just think this — or a more sophisticated technique — should be mentioned in Readme.

@ilyakatz
Copy link

@costa what are you planning to test? do you want an integration test that checks that email_preview works correctly in your setup?

@costa
Copy link
Author

costa commented Jan 15, 2014

@ilyakatz Well it's a kinda "free" mail views test.

@ilyakatz
Copy link

@costa sorry, I don't understand. Can you give an example please?

@wireframe
Copy link
Owner

@costa can you share what your plain ruby class spec looks like? I'm not following what you're looking for and seeing a first-pass solution would be helpful to see what could be integrated into the core gem.

@costa
Copy link
Author

costa commented Jan 15, 2014

I've just come up with a basic and simplistic outfit:

spec/views/mail_spec.rb:

require 'spec_helper'

describe MailPreview do
  MailPreview.new.public_methods(false).each do |e|
    example_ok e
  end
end

Plus:

class RSpec::Core::ExampleGroup
  def self.example_ok(e)
    example "##{e}" do
      subject.send(e).should_not be_blank
    end
  end
end

p.s. MailPreview is my MailView subclass here, of course, and the goal is to see it renders with no exceptions as a bare minimum (which is not totally trivial, if you mind i18n exceptions etc).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants