Sha256: e908330d8a6c2f9bc69aa51d43672072bd186c47c6889bec62aa5cf0106c07a5
Contents?: true
Size: 1.02 KB
Versions: 28
Compression:
Stored size: 1.02 KB
Contents
require 'spec_helper' describe DiscussionsController, organization_workspace: :test do let(:user) { create(:user) } let(:exercise) { create(:exercise) } let(:exercise_params) { {debatable_class: 'Exercise', exercise_id: exercise.id} } before { set_current_user! user } before { Organization.current.tap { |it| it.forum_enabled = true }.save! } describe 'post' do before { allow_any_instance_of(DiscussionsController).to receive(:discussion_params).and_return title: 'A title' } before { post :create, params: exercise_params } it { expect(response.status).to eq 302 } it { expect(exercise.discussions.size).to eq 1 } it { expect(user.discussions.size).to eq 1 } it { expect(user.watched_discussions.size).to eq 1 } describe 'deleting exercises does delete all discussions' do before { @discussion_id = exercise.discussions.first.id } before { exercise.destroy } it { expect { Discussion.find(@discussion_id) }.to raise_exception(ActiveRecord::RecordNotFound) } end end end
Version data entries
28 entries across 28 versions & 1 rubygems