lundi 31 août 2015

Rspec rails unit test - Ruby on rails

I have this code for unit test:

require 'rails_helper'
require 'fetch_controller'

   RSpec.describe FetchController, type: :controller do
   it "parse base 64 url" do
     result = FetchController.parse_urls('aHR0cDovL3d3dy5nb29nbGUuY29t')

    expect(result[0]).to eq('http://www.google.com')

   end
 end

and I want to test parse_urls method that in fetch_controller:

class FetchController < ApplicationController
...
  def parse_urls(base)
  Base64.decode64(base).split(',')
end

But when i'm trying to run it I get an error ": in `require': cannot load such file -- fetch_controller (LoadError)"

Thanks for any help, Yoel

Aucun commentaire:

Enregistrer un commentaire