Coder Social home page Coder Social logo

Comments (8)

felipeelias avatar felipeelias commented on June 19, 2024

This seems a good idea. We should provide some test helpers, for sure.

But, by adding those test files to the gemspec wouldn't it require you to use FactoryGirl too? I mean, it does not seem a huge problem but maybe not everyone uses it.

from doorkeeper.

miyagawa avatar miyagawa commented on June 19, 2024

I understand the concern about the FactoryGirl, but i guess you can just ship it as it is and think about using other fixture frameworks other than factory_girl later?

Speaking of the dependencies, we've found that using Capybara for non-HTML based API testing gets a bit awkward as you need POSTing non-form data and sending request methods like DELETE or PUT, and that actually the developers do not recommend it. i.e. http://elabs.se/blog/34-capybara-and-testing-apis

I think these request spec helpers can be rewritten to use RackTest layer directly rather than mangling with Capybara's page.driver etc.

from doorkeeper.

felipeelias avatar felipeelias commented on June 19, 2024

Added to master.

Thanks for the tip regarding the specs, it makes much more sense. I'm already updating some of them.

from doorkeeper.

jormon avatar jormon commented on June 19, 2024

hey all, i'd really like to be able to use the factories in an application i'm building that uses doorkeeper, but i can't get the factories properly included. i've tried require 'doorkeeper/spec/factories/application' in my spec_helper.rb's RSpec.config block, but it errors out, not finding/loading the file... @miyagawa can you share how you did this above?

running with rails 3.8, rspec 2.11, doorkeeper 0.6.4

from doorkeeper.

miyagawa avatar miyagawa commented on June 19, 2024

@jormon I used to do something like below in my spec_helper:

doorkeeper_path = Gem.loaded_specs.find {|key, spec| key == 'doorkeeper'}.last.full_gem_path

%w(support/helpers factories).each do |helper|
  Dir.glob(doorkeeper_path + "/spec/#{helper}/*.rb").each do |file|
    require file.sub(/\.rb$/, '')
  end
end

but ended up copy-pasting the relevant factory and helper methods into our own managed files. It's arguably not ideal but works for us.

from doorkeeper.

jormon avatar jormon commented on June 19, 2024

I ended up with this spectacular ugliness before I saw your reply :)

Dir["#{ENV['GEM_HOME']}/gems/doorkeeper*/spec/factories/*.rb"].each { |f| require f }

I think I will try and make a real patch to address this...

from doorkeeper.

jormon avatar jormon commented on June 19, 2024

09cb679 breaks this (in 2.1.4+) if you have your own user factory

from doorkeeper.

jormon avatar jormon commented on June 19, 2024

fixed in v4.2.0 which includes work done in #871

from doorkeeper.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.