Skip to content

Commit

Permalink
Fix failing tests resulting of deleting old table view. #379
Browse files Browse the repository at this point in the history
  • Loading branch information
emanuel.metzenthin committed Jan 19, 2018
1 parent 6625ac4 commit cbb6a42
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 32 deletions.
4 changes: 2 additions & 2 deletions spec/features/team/index_team_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
visit teams_path
end

it "should have a select box to filter teams" do
it "should have team tiles" do
visit teams_path
expect(page).to have_select('filter')
expect(page).to have_css('img')
end

it "should only show teams current user is member of if filter is set" do
Expand Down
37 changes: 7 additions & 30 deletions spec/views/teams/index.html.erb_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,48 +18,25 @@

it "doesn't render the new button when not signed in" do
render
expect(rendered).to_not have_selector(:link_or_button, t('helpers.links.new'))
expect(rendered).to_not have_selector(:link_or_button, t('teams.index.create_team'))
end

it "doesn't render the edit button when not signed in" do
render
expect(rendered).to_not have_selector(:link_or_button, t('helpers.links.edit'))
end

it "doesn't render the delete button when not signed in" do
render
expect(rendered).to_not have_selector(:link_or_button, t('helpers.links.destroy'))
end

it "doesn't render the edit button when signed in and you dont have a team" do
it "show my teams if the users has teams" do
sign_in @user
@user.teams.push @teams[0]
render
expect(rendered).to_not have_selector(:link_or_button, t('helpers.links.edit'))
expect(rendered).to have_text(t('teams.index.my_teams'))
end

it "doesn't render the delete button when signed in and you dont have a team" do
it "show my teams if the users has teams" do
sign_in @user
render
expect(rendered).to_not have_selector(:link_or_button, t('helpers.links.destroy'))
expect(rendered).to_not have_text(t('teams.index.my_teams'))
end

it "renders the new button when signed in" do
sign_in @user
render
expect(rendered).to have_selector(:link_or_button, t('helpers.links.new'))
end

it "renders the edit button when signed in and you are an admin" do
sign_in @admin
render
expect(rendered).to have_selector(:link_or_button, t('helpers.links.edit'))
expect(rendered).to have_selector(:link_or_button, t('teams.index.create_team'))
end

it "renders the delete button when signed in and you are an admin" do
sign_in @admin
render
expect(rendered).to have_selector(:link_or_button, t('helpers.links.destroy'))
end


end

0 comments on commit cbb6a42

Please sign in to comment.