1
이것은 초보자 문제처럼 보일지 모르지만 난처한 상황입니다. 나는 간단한 Ruby 여유 서비스를 만들기 위해 노력하고 있으며 RSpec을 사용하여 몇 가지 단위 테스트를 구성하고 있습니다. 나는이 이상한 문제에 부딪 쳤고 나는 무슨 일이 일어나는지 볼 수 없다.TypeError : 싱글 튼 (RSpec)을 정의 할 수 없습니다.
RSpec.describe SlackService do
let(:token) { 'BOT-TOKEN' }
subject do
SlackService.new(token)
end
describe '#channel_list' do
context 'get channels' do
let(:client) { instance_double(Slack::Web::Client) }
before(:each) do
allow(:subject).to receive(:client) { client }
@result = subject.channel_list
end
it { expect(@result).to eq [] }
end
end
end
내가 rspec
를 실행할 때 내가 오류 사람이 더 많은 정보를 필요로하는 경우 편집 것인가
Failures:
1) SlackService#channel_list get channels
Failure/Error: allow(:subject).to receive(:client) { instance_double(Slack::Web::Client) }
TypeError:
can't define singleton
# ./spec/slack_service_spec.rb:12:in `block (4 levels) in <top (required)>'
입니다. 이 오류가 무엇을 의미합니까? 내가 상관없이 그것을 없앨 수는 없다.
아, 참으로. 그것을 놓쳤습니다. –
그건 까다 롭습니다. 나는 그 전에 그것을 만났다. :디 –