jdtornow / challah

User authorization and session management in Rails.
MIT License
18 stars 7 forks source link

Add RSpec support #5

Closed philtr closed 11 years ago

philtr commented 11 years ago

Not ready for merge. Adds configuration to allow the helpers to be used in RSpec. Separates into a few files:

lib/challah/test/helpers  # The helper methods
lib/challah/test/unit     # Test::Unit integrations
lib/challah/test/rspec    # RSpec integrations

One thing that stands out as odd to me is this bit:

if defined?(RSpec)
  require 'challah/test/rspec'
end

But alas, this is how thoughtbot does it with shoulda. If you can think of a better way I'm open to ideas.

By the way, all the current tests pass, but I am at a bit of a loss as for where to start testing the RSpec stuff. Maybe I will look at shoulda-matchers and see how they do it.

I'd love to hear your feedback on this feature.

philtr commented 11 years ago

And it won't hurt my feelings if you decide you don't want to support RSpec :)

jdtornow commented 11 years ago

I think this is a great idea. There's no reason why it shouldn't work with Rspec so people can use it in their own apps.

Let me know when you're happy with it and I'll merge it in.

philtr commented 11 years ago

I feel like I can't properly test this by mocking the RSpec module. Would you have any qualms with adding RSpec as a development dependency?

philtr commented 11 years ago

Are you testing the test integration libs? If not, then this is ready if you're happy with it.

jdtornow commented 11 years ago

Now that I look through this, I don't think we are doing anything to test the testing libraries. Which is fine by me really.

I'll merge this in shortly. Thanks!