Question

I am creating my first ruby gem and have a method that parses a Savon::Response object which comes from a soap api. I want to test my parse method and to do this I figure the easiest way is to have a fixture and just pass it through the method. I am using rspec. Below is my code:

I am receiving a undefined method `fixtures' for # (NoMethodError)

  require 'spec_helper'

  describe Client do 

  fixtures :quotation_responses

  it "should parse a quotation response and return a tax rate" do
    Client.parse_tax_rate(quotation_responses(:qr)).first[:tax_rate].should eql 0.07
  end
end
Was it helpful?

Solution

Fixtures is part of the Ruby on Rails framework. There are a myriad of fixture replacement gems with Factory Girl being one of the more popular.

https://www.ruby-toolbox.com/categories/rails_fixture_replacement

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top