Sha256: 8a940bc75e0118c3b2b39fd2705b9ef52f058d43afcc3c7027e2f09fb8c7b567

Contents?: true

Size: 856 Bytes

Versions: 6

Compression:

Stored size: 856 Bytes

Contents

require 'spec_helper'

RSpec.describe CmQuiz::Review::CreateIdea do
  describe '#perform' do
    let(:mock_idea) do
      {
        content: 'test-content',
        impact: 7,
        ease: 8,
        confidence: 9,
        average_score: 8.0
      }
    end
    let!(:project_api) do
      api = double
      allow(api).to receive(:request) do |verb, path, opts|
        double(success?: true, body: mock_idea.to_json, code: 200)
      end
      api
    end
    let(:service) do
      CmQuiz::Review::CreateIdea.new({
        project_api: project_api
      })
    end
    before :each do
      factory = double(create: ['jwt', 'refresh_token'])
      allow(CmQuiz::Factory::User).to receive(:new).and_return(factory)
    end

    it "should pass test" do
      test_result = service.perform

      assert_test_case(service, test_result)
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
cm_quiz-0.0.8 spec/lib/cm_quiz/review/create_idea_spec.rb
cm_quiz-0.0.7 spec/lib/cm_quiz/review/create_idea_spec.rb
cm_quiz-0.0.6 spec/lib/cm_quiz/review/create_idea_spec.rb
cm_quiz-0.0.5 spec/lib/cm_quiz/review/create_idea_spec.rb
cm_quiz-0.0.4 spec/lib/cm_quiz/review/create_idea_spec.rb
cm_quiz-0.0.3 spec/lib/cm_quiz/review/create_idea_spec.rb