Fix test [SCI-3881]

This commit is contained in:
Oleksii Kriuchykhin 2019-09-16 13:03:41 +02:00
parent 3509543e7b
commit 0475394b08
5 changed files with 112 additions and 22 deletions

View file

@ -1,12 +1,12 @@
GIT GIT
remote: https://github.com/biosistemika/canaid remote: https://github.com/biosistemika/canaid
revision: 8c87ae49648f4ca2c37313b0d9b9c561a10a71a2 revision: 2ac3004d728adbf1be7f4271689b83464f612b23
branch: rails_6 branch: rails_6
specs: specs:
canaid (1.0.4) canaid (1.0.4)
devise (~> 4.6.2) devise (>= 3.4.1)
docile (>= 1.1.0) docile (>= 1.1.0)
rails (~> 5.2.3) rails (>= 4)
GIT GIT
remote: https://github.com/biosistemika/jquery-scrollto-rails remote: https://github.com/biosistemika/jquery-scrollto-rails

View file

@ -44,11 +44,8 @@ COMMENT ON EXTENSION pg_trgm IS 'text similarity measurement and index searching
CREATE FUNCTION public.trim_html_tags(input text, OUT output text) RETURNS text CREATE FUNCTION public.trim_html_tags(input text, OUT output text) RETURNS text
LANGUAGE sql LANGUAGE sql
AS $$ AS $$
SELECT regexp_replace(input, SELECT regexp_replace(input, E'<[^>]*>', '', 'g');
E'<[^>]*>|\\[#.*\\]|\\[@.*\\]', $$;
'',
'g');
$$;
SET default_tablespace = ''; SET default_tablespace = '';
@ -1088,7 +1085,8 @@ CREATE TABLE public.repositories (
name character varying, name character varying,
created_at timestamp without time zone, created_at timestamp without time zone,
updated_at timestamp without time zone, updated_at timestamp without time zone,
discarded_at timestamp without time zone discarded_at timestamp without time zone,
permission_level integer DEFAULT 0 NOT NULL
); );
@ -1992,6 +1990,39 @@ CREATE SEQUENCE public.tags_id_seq
ALTER SEQUENCE public.tags_id_seq OWNED BY public.tags.id; ALTER SEQUENCE public.tags_id_seq OWNED BY public.tags.id;
--
-- Name: team_repositories; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.team_repositories (
id bigint NOT NULL,
team_id bigint,
repository_id bigint,
permission_level integer DEFAULT 0 NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL
);
--
-- Name: team_repositories_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public.team_repositories_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: team_repositories_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public.team_repositories_id_seq OWNED BY public.team_repositories.id;
-- --
-- Name: teams_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- Name: teams_id_seq; Type: SEQUENCE; Schema: public; Owner: -
-- --
@ -2903,6 +2934,13 @@ ALTER TABLE ONLY public.tables ALTER COLUMN id SET DEFAULT nextval('public.table
ALTER TABLE ONLY public.tags ALTER COLUMN id SET DEFAULT nextval('public.tags_id_seq'::regclass); ALTER TABLE ONLY public.tags ALTER COLUMN id SET DEFAULT nextval('public.tags_id_seq'::regclass);
--
-- Name: team_repositories id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.team_repositories ALTER COLUMN id SET DEFAULT nextval('public.team_repositories_id_seq'::regclass);
-- --
-- Name: teams id; Type: DEFAULT; Schema: public; Owner: - -- Name: teams id; Type: DEFAULT; Schema: public; Owner: -
-- --
@ -3455,6 +3493,14 @@ ALTER TABLE ONLY public.tags
ADD CONSTRAINT tags_pkey PRIMARY KEY (id); ADD CONSTRAINT tags_pkey PRIMARY KEY (id);
--
-- Name: team_repositories team_repositories_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.team_repositories
ADD CONSTRAINT team_repositories_pkey PRIMARY KEY (id);
-- --
-- Name: teams teams_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- Name: teams teams_pkey; Type: CONSTRAINT; Schema: public; Owner: -
-- --
@ -4325,6 +4371,13 @@ CREATE INDEX index_reports_on_user_id ON public.reports USING btree (user_id);
CREATE INDEX index_repositories_on_discarded_at ON public.repositories USING btree (discarded_at); CREATE INDEX index_repositories_on_discarded_at ON public.repositories USING btree (discarded_at);
--
-- Name: index_repositories_on_permission_level; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX index_repositories_on_permission_level ON public.repositories USING btree (permission_level);
-- --
-- Name: index_repositories_on_team_id; Type: INDEX; Schema: public; Owner: - -- Name: index_repositories_on_team_id; Type: INDEX; Schema: public; Owner: -
-- --
@ -4864,6 +4917,34 @@ CREATE INDEX index_tags_on_name ON public.tags USING gin (public.trim_html_tags(
CREATE INDEX index_tags_on_project_id ON public.tags USING btree (project_id); CREATE INDEX index_tags_on_project_id ON public.tags USING btree (project_id);
--
-- Name: index_team_repositories_on_permission_level; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX index_team_repositories_on_permission_level ON public.team_repositories USING btree (permission_level);
--
-- Name: index_team_repositories_on_repository_id; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX index_team_repositories_on_repository_id ON public.team_repositories USING btree (repository_id);
--
-- Name: index_team_repositories_on_team_id; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX index_team_repositories_on_team_id ON public.team_repositories USING btree (team_id);
--
-- Name: index_team_repositories_on_team_id_and_repository_id; Type: INDEX; Schema: public; Owner: -
--
CREATE UNIQUE INDEX index_team_repositories_on_team_id_and_repository_id ON public.team_repositories USING btree (team_id, repository_id);
-- --
-- Name: index_teams_on_created_by_id; Type: INDEX; Schema: public; Owner: - -- Name: index_teams_on_created_by_id; Type: INDEX; Schema: public; Owner: -
-- --
@ -5223,6 +5304,14 @@ ALTER TABLE ONLY public.tables
ADD CONSTRAINT fk_rails_147b6eced4 FOREIGN KEY (last_modified_by_id) REFERENCES public.users(id); ADD CONSTRAINT fk_rails_147b6eced4 FOREIGN KEY (last_modified_by_id) REFERENCES public.users(id);
--
-- Name: team_repositories fk_rails_15daa6a6bf; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.team_repositories
ADD CONSTRAINT fk_rails_15daa6a6bf FOREIGN KEY (repository_id) REFERENCES public.repositories(id);
-- --
-- Name: zip_exports fk_rails_1952fc2261; Type: FK CONSTRAINT; Schema: public; Owner: - -- Name: zip_exports fk_rails_1952fc2261; Type: FK CONSTRAINT; Schema: public; Owner: -
-- --
@ -6247,6 +6336,14 @@ ALTER TABLE ONLY public.tags
ADD CONSTRAINT fk_rails_f95c7c81ac FOREIGN KEY (last_modified_by_id) REFERENCES public.users(id); ADD CONSTRAINT fk_rails_f95c7c81ac FOREIGN KEY (last_modified_by_id) REFERENCES public.users(id);
--
-- Name: team_repositories fk_rails_f99472b670; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.team_repositories
ADD CONSTRAINT fk_rails_f99472b670 FOREIGN KEY (team_id) REFERENCES public.teams(id);
-- --
-- Name: sample_groups fk_rails_fc2ab1a001; Type: FK CONSTRAINT; Schema: public; Owner: - -- Name: sample_groups fk_rails_fc2ab1a001; Type: FK CONSTRAINT; Schema: public; Owner: -
-- --
@ -6433,6 +6530,11 @@ INSERT INTO "schema_migrations" (version) VALUES
('20190520135317'), ('20190520135317'),
('20190613094834'), ('20190613094834'),
('20190613134100'), ('20190613134100'),
('20190711125513'),
('20190715150326'),
('20190812065432'),
('20190812072649'),
('20190830141257'),
('20190910125740'); ('20190910125740');

View file

@ -90,18 +90,6 @@ describe ProjectsController, type: :controller do
end end
end end
describe '#archive' do
context 'in JSON format' do
let(:params) { { team: team.id, sort: 'atoz' } }
it 'returns success response' do
get :archive, params: params, format: :json
expect(response).to have_http_status(:success)
expect(response.media_type).to eq 'application/json'
end
end
end
describe 'POST create' do describe 'POST create' do
context 'in JSON format' do context 'in JSON format' do
let(:params) do let(:params) do

View file

@ -2,7 +2,6 @@
FactoryBot.define do FactoryBot.define do
factory :team_repository do factory :team_repository do
team
repository repository
trait :read do trait :read do
permission_level { :shared_read } permission_level { :shared_read }

View file

@ -6,6 +6,7 @@ describe TeamRepository, type: :model do
let(:team_repository) { build :team_repository, :read } let(:team_repository) { build :team_repository, :read }
it 'is valid' do it 'is valid' do
team_repository.team = create :team
expect(team_repository).to be_valid expect(team_repository).to be_valid
end end