Sha256: f9c97a5feb89c5c7c6987f15ecdb61adcbf4cafa7abe9db8488d402dc4f22e69

Contents?: true

Size: 1.01 KB

Versions: 7

Compression:

Stored size: 1.01 KB

Contents

require "rails_helper"

describe "list users" do
  let!(:ike) { FactoryGirl.create(:user, name: "Ike", email: 'ike@email.com') }
  let!(:mou) { FactoryGirl.create(:user, name: "Mou", email: 'mou@email.com') }

  describe "Users should visualize users that belongs to his group" do
    subject!(:current_user) { FactoryGirl.create(:user) }
    let!(:group) { FactoryGirl.create(:group, users: [current_user, ike]) }

    before do
      setup_authorization(current_user, "curupira/users", "index")
      login(current_user)

      visit "/users"
    end

    it "just visualize users that belongs to his group" do
      expect(page).to     have_content("Ike")
      expect(page).to_not have_content("Mou")
    end
  end

  describe "Admin should visualize all users" do
    subject!(:admin) { FactoryGirl.create(:user, admin: true) }

    before do
      login(admin)

      visit "/users"
    end

    it "visualize all users" do
      expect(page).to have_content("Ike")
      expect(page).to have_content("Mou")
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
curupira-0.1.7 spec/features/list_users_spec.rb
curupira-0.1.6 spec/features/list_users_spec.rb
curupira-0.1.4 spec/features/list_users_spec.rb
curupira-0.1.3 spec/features/list_users_spec.rb
curupira-0.1.2 spec/features/list_users_spec.rb
curupira-0.1.1 spec/features/list_users_spec.rb
curupira-0.1.0 spec/features/list_users_spec.rb