Skip to content

Instantly share code, notes, and snippets.

@myobie
Created May 20, 2014 09:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save myobie/bca01fe59977a66ef413 to your computer and use it in GitHub Desktop.
Save myobie/bca01fe59977a66ef413 to your computer and use it in GitHub Desktop.
require 'spec_helper'
describe DiscussionsController do
before { stub_current_user }
describe "index" do
context "(with a project and some discussions)" do
before do
@project = create :project, owner: current_user, member_ids: [current_user.id]
@discussions = 3.times.map do
create :discussion, project: @project
end
end
describe "returns a list of discussions for the project" do
before { get :index, project_id: @project.id }
it { expect(response).to be_success }
it { expect(json_response.length).to eq(3) }
it "and are the type discussion" do
expect(json_response.first["type"]).to eq("discussion")
end
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment