<commit_before>require 'spec_helper'

describe UsersController, :type => :api do

  render_views

  before :all do
    User.create(first_name: 'Grass', last_name: 'Hopper', email: '<EMAIL>', password: '<PASSWORD>', password_confirmation: '<PASSWORD>', role: 'master')
  end

  describe 'GET index' do

    it "returns list of users" do
      get :index, :format => :json
      expect(response.status).to eq 200
      expect(JSON.load(response.body)["users"][0]["email"]).to eq '<EMAIL>'
      expect(JSON.load(response.body)["users"][0]["first_name"]).to eq 'Grass'
      expect(JSON.load(response.body)["users"][0]["last_name"]).to eq 'Hopper'
      expect(JSON.load(response.body)["users"][0]["last_name"]).to eq 'Hopper'
    end


  end

  describe "GET show" do

    it "return specific user" do
      get :show, id: 1, format: :json
      expect(response.status).to eq 200
    end

  end
end<commit_msg>ADDED validation to role in users api<commit_after>require 'spec_helper'

describe UsersController, :type => :api do

  render_views

  before :all do
    User.create(first_name: 'Grass', last_name: 'Hopper', email: '<EMAIL>', password: '<PASSWORD>', password_confirmation: '<PASSWORD>', role: 'master')
  end

  describe 'GET index' do

    it "returns list of users" do
      get :index, :format => :json
      expect(response.status).to eq 200
      expect(JSON.load(response.body)["users"][0]["email"]).to eq '<EMAIL>'
      expect(JSON.load(response.body)["users"][0]["first_name"]).to eq 'Grass'
      expect(JSON.load(response.body)["users"][0]["last_name"]).to eq 'Hopper'
      expect(JSON.load(response.body)["users"][0]["role"]).to eq 'master'
    end


  end

  describe "GET show" do

    it "return specific user" do
      get :show, id: 1, format: :json
      expect(response.status).to eq 200
    end

  end
end
{'fraction_non_alphanumeric': 0.16239782016348775, 'fraction_numerical': 0.011989100817438692, 'mean_word_length': 3.8443271767810026, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4999792', 'n_tokens_mistral': 648, 'n_tokens_neox': 614, 'n_words': 157}