source stringclasses 1
value | repo stringlengths 5 63 | repo_url stringlengths 24 82 | path stringlengths 5 167 | language stringclasses 1
value | license stringclasses 5
values | stars int64 10 51.4k | ref stringclasses 23
values | size_bytes int64 200 258k | text stringlengths 137 258k |
|---|---|---|---|---|---|---|---|---|---|
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/spec/support/shared_examples/exportable_shared.rb | Ruby | apache-2.0 | 214 | main | 848 | shared_examples_for "exportable" do
context "as CSV" do
require "csv"
let!(:model) { described_class }
let!(:exportable_thing) { FactoryBot.create(model.to_s.underscore.to_sym) }
let!(:export_output) { model.as_csv }
let!(:reparsed_csv) { CSV.parse export_output }
it "has two rows" do
e... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/spec/support/shared_examples/badgeable_shared.rb | Ruby | apache-2.0 | 214 | main | 1,072 | class BadgeableThing
include Badgeable
attr_accessor :badges_mask
def initialize
@badges_mask = 0
end
end
shared_examples "a badgeable thing" do
it "has a badges_mask to remember badges assigned" do
expect(subject.badges_mask.class).to eq(Integer)
end
context "has badgeable methods" do
badge... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/spec/support/shared_examples/community_stats.rb | Ruby | apache-2.0 | 214 | main | 910 | # shared_examples "community stats" do
shared_examples_for "community stats" do |template|
it "displays cookbooks and chefs as singular if there is only 1" do
assign(:cookbook_count, 1)
assign(:user_count, 1)
render template: template
expect(rendered).to match(%r{1 Cookbook</span>})
expect(rendere... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/spec/support/shared_examples/v1_controller_shared.rb | Ruby | apache-2.0 | 214 | main | 803 | shared_examples "an API v1 controller" do
context "#item_limit" do
it "knows the API item limit" do
subject.respond_to?(:item_limit)
end
it "determines the API item limit from an environment variable" do
expect(ENV).to receive(:[]).with("API_ITEM_LIMIT").and_return(9999)
expect(subject.... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/spec/controllers/irc_logs_controller_spec.rb | Ruby | apache-2.0 | 214 | main | 1,214 | require "spec_helper"
describe IrcLogsController do
describe "GET #index" do
it "redirects to the botbot dashboard" do
get :index
expect(response).to redirect_to("https://botbot.me/freenode/chef/")
end
end
describe "GET #show" do
let(:botbot_base_url) { "https://botbot.me/freenode/" }
... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/spec/controllers/email_preferences_controller_spec.rb | Ruby | apache-2.0 | 214 | main | 710 | require "spec_helper"
describe EmailPreferencesController do
let(:email_preference) { create(:email_preference) }
describe "GET /unsubscribe/:token" do
it "should succeed" do
get :unsubscribe, params: { token: email_preference }
expect(response).to be_successful
end
it "should 404 if the ... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/spec/controllers/pages_controller_spec.rb | Ruby | apache-2.0 | 214 | main | 1,780 | require "spec_helper"
describe PagesController do
let(:user) { create(:user) }
describe "GET #welcome" do
context "user is not signed in" do
it "responds with a 200" do
get :welcome
expect(response.status.to_i).to eql(200)
end
it "sends cookbook count to the view" do
... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/spec/controllers/transfer_ownership_controller_spec.rb | Ruby | apache-2.0 | 214 | main | 3,899 | require "spec_helper"
describe TransferOwnershipController do
describe "PUT #transfer" do
let(:cookbook) { create(:cookbook) }
let(:new_owner) { create(:user) }
before do
cookbook_collection = double("cookbook_collection", first!: cookbook)
allow(Cookbook).to receive(:with_name) { cookbook_c... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/spec/controllers/cookbooks_controller_spec.rb | Ruby | apache-2.0 | 214 | main | 27,511 | require "spec_helper"
require "webmock/rspec"
describe CookbooksController do
describe "GET #index" do
context "there are no parameters" do
let!(:postgresql) { create(:cookbook, name: "postgresql") }
let!(:mysql) { create(:cookbook, name: "mysql") }
let!(:dep_cookbook) { create(:cookbook, name:... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/spec/controllers/sessions_controller_spec.rb | Ruby | apache-2.0 | 214 | main | 1,471 | require "spec_helper"
describe SessionsController do
describe "POST #create" do
let(:auth_hash) { OmniAuth.config.mock_auth[:chef_oauth2] }
before do
allow(User).to receive(:find_or_create_from_chef_oauth).and_return(double(id: 1, name: "John Doe"))
request.env["omniauth.auth"] = auth_hash
e... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/spec/controllers/group_members_controller_spec.rb | Ruby | apache-2.0 | 214 | main | 10,557 | require "spec_helper"
describe GroupMembersController do
describe "POST #make_group_admin" do
let(:group_member) { create(:group_member) }
let(:group) { group_member.group }
let(:group_members) { group_member.group.group_members }
let(:group_members_query_result) { group_member.group.group_members.wh... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/spec/controllers/profile_controller_spec.rb | Ruby | apache-2.0 | 214 | main | 2,870 | require "spec_helper"
describe ProfileController do
let(:user) { create(:user) }
describe "PATCH #update" do
context "user is authenticated" do
before { sign_in user }
it "updates the user" do
patch :update, params: { user: {
first_name: "Bob",
last_name: "Loblaw",
... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/spec/controllers/tools_controller_spec.rb | Ruby | apache-2.0 | 214 | main | 7,117 | require "spec_helper"
describe ToolsController do
describe "GET #index" do
it "responds with a 200" do
get :index
expect(response.status.to_i).to eql(200)
end
it "assigns tools" do
get :index
expect(assigns(:tools)).to_not be_nil
end
it "only displays tools of a certai... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/spec/controllers/users_controller_spec.rb | Ruby | apache-2.0 | 214 | main | 4,152 | require "spec_helper"
describe UsersController do
let(:user) { create(:user) }
describe "GET #show" do
it "assigns a user" do
get :show, params: { id: user.username }
expect(assigns[:user]).to eql(user)
end
it "assigns cookbooks" do
get :show, params: { id: user.username }
e... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/spec/controllers/cookbook_versions_controller_spec.rb | Ruby | apache-2.0 | 214 | main | 4,540 | require "spec_helper"
describe CookbookVersionsController do
describe "#download" do
let(:cookbook) { create(:cookbook) }
let(:version) { create(:cookbook_version, cookbook: cookbook) }
let(:user) { create(:user) }
before { sign_in user }
it "302s to the latest cookbook version file" do
ge... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/spec/controllers/accounts_controller_spec.rb | Ruby | apache-2.0 | 214 | main | 1,174 | require "spec_helper"
describe AccountsController do
let(:user) { create(:user) }
before { sign_in user }
describe "POST #create" do
before do
request.env["omniauth.auth"] = OmniAuth.config.mock_auth[:github]
end
it "creates a new account for a user" do
expect do
post :create, p... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/spec/controllers/collaborators_controller_spec.rb | Ruby | apache-2.0 | 214 | main | 9,692 | require "spec_helper"
describe CollaboratorsController do
let!(:fanny) { create(:user, first_name: "Fanny") }
let!(:hank) { create(:user, first_name: "Hank") }
let!(:hanky) { create(:user, first_name: "Hanky") }
let!(:cookbook) { create(:cookbook, owner: fanny) }
let!(:existing_collaborator) { create(:user, ... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/spec/controllers/application_controller_spec.rb | Ruby | apache-2.0 | 214 | main | 1,648 | require "spec_helper"
describe ApplicationController do
it { should be_a(Supermarket::Authorization) }
it { should be_a(Supermarket::LocationStorage) }
describe "a controller which responds to specific formats" do
controller do
def index
respond_to do |format|
format.json do
... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/spec/controllers/groups_controller_spec.rb | Ruby | apache-2.0 | 214 | main | 5,759 | require "spec_helper"
describe GroupsController do
before do
Feature.activate(:collaborator_groups)
end
describe "GET #index" do
let(:group1) { create(:group) }
let(:group2) { create(:group) }
before do
expect(Group.all).to include(group1, group2)
end
it "assigns groups" do
... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/spec/controllers/api/v1/metrics_controller_spec.rb | Ruby | apache-2.0 | 214 | main | 249 | require "spec_helper"
describe Api::V1::MetricsController do
describe "#show" do
it "retrieves metrics" do
get :show, format: :json
expect(response).to be_successful
expect(assigns(:metrics)).to_not be_nil
end
end
end |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/spec/controllers/api/v1/quality_metrics_controller_spec.rb | Ruby | apache-2.0 | 214 | main | 17,803 | require "spec_helper"
describe Api::V1::QualityMetricsController do
describe "#create_metric (private)" do
let(:version) { create :cookbook_version }
let(:metric) { create :cookstyle_metric }
it "creates a metric result for a cookbook version" do
new_result = subject.send(:create_metric, version, ... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/spec/controllers/api/v1/tools_controller_spec.rb | Ruby | apache-2.0 | 214 | main | 5,439 | require "spec_helper"
describe Api::V1::ToolsController do
it_behaves_like "an API v1 controller"
describe "#index" do
let!(:metal) do
create(:tool, name: "metal")
end
let!(:berkshelf) do
create(:tool, name: "berkshelf")
end
before :each do
ENV["API_ITEM_LIMIT"] = "0"
e... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/spec/controllers/api/v1/users_controller_spec.rb | Ruby | apache-2.0 | 214 | main | 5,133 | require "spec_helper"
describe Api::V1::UsersController do
let!(:user) { create(:user) }
let!(:redis_test) do
create(:cookbook, name: "redis_test", owner: user)
end
let!(:macand) do
create(:cookbook, name: "macand", owner: user)
end
let!(:zeromq) { create(:cookbook, name: "zeromq") }
let!(:app... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/spec/controllers/api/v1/cookbook_uploads_controller_spec.rb | Ruby | apache-2.0 | 214 | main | 11,049 | require "spec_helper"
describe Api::V1::CookbookUploadsController do
describe "#create" do
context "when the upload succeeds" do
let(:user) { create(:user) }
before do
allow(subject).to receive(:authenticate_user!) { true }
allow(subject).to receive(:current_user) { user }
al... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/spec/controllers/api/v1/cookbooks_controller_spec.rb | Ruby | apache-2.0 | 214 | main | 8,683 | require "spec_helper"
describe Api::V1::CookbooksController do
let!(:clive) { create(:user) }
let!(:slow_cooking) do
create(:cookbook, name: "slow_cooking", web_download_count: 12, api_download_count: 15)
end
let!(:sashimi) do
create(:cookbook, name: "sashimi", web_download_count: 11, api_download_cou... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/spec/controllers/api/v1/cookbook_versions_controller_spec.rb | Ruby | apache-2.0 | 214 | main | 3,307 | require "spec_helper"
describe Api::V1::CookbookVersionsController do
describe "#show" do
let!(:redis) { create(:cookbook, name: "redis") }
let!(:redis_0_1_2) do
create(:cookbook_version, cookbook: redis, version: "0.1.2")
end
let!(:redis_1_0_0) do
create(:cookbook_version, cookbook: re... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/spec/controllers/concerns/collaborator_processing_spec.rb | Ruby | apache-2.0 | 214 | main | 9,870 | require "spec_helper"
class FakesController < ApplicationController
include CollaboratorProcessing
end
describe FakesController do
let!(:fanny) { create(:user, first_name: "Fanny") }
let!(:cookbook) { create(:cookbook, owner: fanny) }
let(:user1) { create(:user) }
let(:user2) { create(:user) }
let(:user3... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/spec/api/cookbook_search_spec.rb | Ruby | apache-2.0 | 214 | main | 1,393 | require "spec_helper"
describe "GET /api/v1/search" do
let(:user) { create(:user) }
let(:redis_test_signature) do
{
"cookbook_name" => "redis-test",
"cookbook_description" => "Installs/Configures redis-test",
"cookbook" => "http://www.example.com/api/v1/cookbooks/redis-test",
"cookbook... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/spec/api/user_show_spec.rb | Ruby | apache-2.0 | 214 | main | 3,098 | require "spec_helper"
describe "GET /api/v1/users/:user" do
context "when the user exists" do
let!(:user) do
create(
:user,
first_name: "Fanny",
last_name: "McNanny",
company: "Fanny Pack",
twitter_username: "fanny",
slack_username: "fanny",
chef_acco... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/spec/api/cookbook_version_spec.rb | Ruby | apache-2.0 | 214 | main | 5,274 | require "spec_helper"
describe "GET /api/v1/cookbooks/:cookbook/versions/:version" do
context "for a cookbook that exists" do
before do
user = create(:user)
share_cookbook("redis-test", user, custom_metadata: { version: "0.1.0" })
share_cookbook("redis-test", user, custom_metadata: { version: ... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/spec/api/cookbook_destroy_spec.rb | Ruby | apache-2.0 | 214 | main | 1,560 | require "spec_helper"
describe "DELETE /api/v1/cookbooks/:cookbook" do
let(:user) { create(:user) }
let(:cookbook_metadata_signature) do
{
"name" => "redis-test",
"maintainer" => user.username,
"external_url" => nil,
"source_url" => nil,
"issues_url" => nil,
"description" =... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/spec/api/cookbook_show_spec.rb | Ruby | apache-2.0 | 214 | main | 1,527 | require "spec_helper"
describe "GET /api/v1/cookbooks/:cookbook" do
context "when the cookbook exists" do
let(:user) { create(:user) }
let(:cookbook_signature) do
{
"name" => "redis-test",
"category" => "Other",
"maintainer" => user.username,
"latest_version" => "http:/... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/spec/api/universe_spec.rb | Ruby | apache-2.0 | 214 | main | 4,012 | require "spec_helper"
describe "GET /universe" do
let(:redis) { create(:cookbook, name: "redis") }
let(:apt) { create(:cookbook, name: "apt") }
let(:narf) { create(:cookbook, name: "narf") }
let(:tarball) do
File.open("spec/support/cookbook_fixtures/redis-test-v1.tgz")
end
let!(:redis_version1) do
... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/spec/api/tools_search_spec.rb | Ruby | apache-2.0 | 214 | main | 1,825 | require "spec_helper"
describe "GET /api/v1/tools/search" do
let!(:berkshelf) { create(:tool, name: "berkshelf") }
let!(:berkshelf_2) { create(:tool, name: "berkshelf-2") }
it "returns a 200" do
get "/api/v1/tools-search"
expect(response.status.to_i).to eql(200)
end
it "returns tools that match th... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/spec/api/status_spec.rb | Ruby | apache-2.0 | 214 | main | 254 | require "spec_helper"
describe "GET /status" do
it "returns a 200" do
get "/status"
expect(response.status.to_i).to eql(200)
end
it "returns a status ok" do
get "/status"
expect(json_body).to include("status" => "ok")
end
end |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/spec/api/tools_index_spec.rb | Ruby | apache-2.0 | 214 | main | 1,187 | require "spec_helper"
describe "GET /api/v1/tools" do
it "returns a 200" do
get "/api/v1/tools"
expect(response.status.to_i).to eql(200)
end
context "when there are no tools" do
it "returns an empty JSON template" do
get "/api/v1/tools"
expect(json_body["start"]).to eql(0)
expect... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/spec/api/cookbook_evaluation_results_spec.rb | Ruby | apache-2.0 | 214 | main | 646 | require "spec_helper"
describe "POST /api/v1/cookbook_evalution_results" do
let(:cookbook) { create(:cookbook) }
let(:cookbook_version) { create(:cookbook_version, cookbook: cookbook) }
context "with the correct spelling" do
it "returns a 200" do
post "/api/v1/cookbook-versions/cookstyle_evaluation",
... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/spec/api/cookbooks_root_spec.rb | Ruby | apache-2.0 | 214 | main | 2,371 | require "spec_helper"
describe "GET /api/v1/cookbooks" do
it "returns a 200" do
get "/api/v1/cookbooks"
expect(response.status.to_i).to eql(200)
end
context "when there are no cookbooks" do
it "returns an empty JSON template" do
get "/api/v1/cookbooks"
expect(json_body["start"]).to eql... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/spec/api/cookbook_create_spec.rb | Ruby | apache-2.0 | 214 | main | 3,753 | require "spec_helper"
describe "POST /api/v1/cookbooks" do
let(:user) { create(:user) }
shared_context "invalid cookbook" do
it "returns a 400" do
expect(response.status.to_i).to eql(400)
end
it "returns an error code" do
expect(json_body["error_code"]).to_not be_nil
end
it "retu... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/spec/api/tool_show_spec.rb | Ruby | apache-2.0 | 214 | main | 996 | require "spec_helper"
describe "GET /api/v1/tools/:tool" do
context "when the tool exists" do
let(:tool) { create(:tool) }
let(:tool_signature) do
{
"name" => tool.name,
"slug" => tool.slug,
"type" => tool.type,
"source_url" => tool.source_url,
"description" => ... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/spec/api/cookbook_version_destroy_spec.rb | Ruby | apache-2.0 | 214 | main | 1,958 | require "spec_helper"
describe "DELETE /api/v1/cookbooks/:cookbook/versions/:version" do
let(:user) { create(:user) }
context "from the cookbook owner" do
before do
share_cookbook("redis-test", user, custom_metadata: { version: "1.1.0" })
share_cookbook("redis-test", user, custom_metadata: { versi... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/spec/api/cookbook_contingent_spec.rb | Ruby | apache-2.0 | 214 | main | 1,174 | require "spec_helper"
describe "GET /api/v1/cookbooks/:cookbook/contingent" do
context "when the cookbook exists" do
let(:apt) { create(:cookbook, name: "apt") }
let(:nginx) { create(:cookbook, name: "nginx") }
let(:apache) { create(:cookbook, name: "apache") }
before do
create(:cookbook_depen... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/spec/views/api/v1/cookbooks/index.json.jbuilder_spec.rb | Ruby | apache-2.0 | 214 | main | 1,007 | require "spec_helper"
describe "api/v1/cookbooks/index" do
it "displays the starting offset" do
assign(:start, 0)
render
expect(json_body["start"]).to eql(0)
end
it "displays the total number of cookbooks" do
assign(:total, 9001)
render
expect(json_body["total"]).to eql(9001)
end
... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/spec/views/api/v1/cookbooks/search.json.jbuilder_spec.rb | Ruby | apache-2.0 | 214 | main | 880 | require "spec_helper"
describe "api/v1/cookbooks/search" do
let(:cookbook_record) { create(:cookbook, name: "redis") }
before do
assign(:total, 1)
assign(:results, [cookbook_record])
assign(:start, 1)
end
it "displays the total number of results" do
render
total = json_body["total"]
... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/spec/views/api/v1/cookbooks/show.json.jbuilder_spec.rb | Ruby | apache-2.0 | 214 | main | 3,675 | require "spec_helper"
describe "api/v1/cookbooks/show" do
let!(:cookbook) do
create(
:cookbook,
name: "redis",
source_url: "http://example.com",
issues_url: "http://example.com",
deprecated: true,
replacement: create(:cookbook),
web_download_count: 2,
api_download_... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/spec/views/api/v1/users/show.json.jbuilder_spec.rb | Ruby | apache-2.0 | 214 | main | 3,736 | require "spec_helper"
describe "api/v1/users/show" do
let!(:user) do
create(
:user,
first_name: "Fanny",
last_name: "McNanny",
company: "FannyInternational",
twitter_username: "fannyfannyfanny",
email: "fanny@fanny.com",
slack_username: "fannyfunnyfanny"
)
end
b... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/spec/views/api/v1/metrics/show.json.jbuilder_spec.rb | Ruby | apache-2.0 | 214 | main | 717 | require "spec_helper"
describe "api/v1/metrics/show" do
before do
assign(:metrics,
total_cookbook_downloads: 5,
total_cookbook_versions: 4,
total_cookbooks: 3,
total_follows: 2,
total_users: 6,
total_hits: {
"/universe" => 3,
... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/spec/views/api/v1/cookbook_versions/show.json.jbuilder_spec.rb | Ruby | apache-2.0 | 214 | main | 1,874 | require "spec_helper"
describe "api/v1/cookbook_versions/show" do
let(:cookbook) { create(:cookbook, name: "redis") }
let(:apt) { create(:cookbook, name: "apt") }
let(:tarball) do
File.open("spec/support/cookbook_fixtures/redis-test-v1.tgz")
end
let(:cookbook_version) do
create(
:cookbook_vers... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/spec/views/api/v1/cookbook_uploads/create.json.jbuilder_spec.rb | Ruby | apache-2.0 | 214 | main | 411 | require "spec_helper"
describe "api/v1/cookbook_uploads/create" do
let(:cookbook) do
create(
:cookbook,
name: "redis",
source_url: "http://example.com",
deprecated: false
)
end
before do
assign(
:cookbook,
cookbook
)
end
it "displays the cookbook's URI" d... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/spec/views/users/followed_cookbook_activity.atom.builder_spec.rb | Ruby | apache-2.0 | 214 | main | 2,508 | require "spec_helper"
describe "users/followed_cookbook_activity.atom.builder" do
let(:template_path) { "users/followed_cookbook_activity" }
let!(:test_cookbook_5_0) do
create(
:cookbook_version,
version: "5.0",
description: "this cookbook is so rad",
changelog: "we added so much stuff!... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/spec/views/tools/index.atom.builder_spec.rb | Ruby | apache-2.0 | 214 | main | 1,345 | require "spec_helper"
describe "tools/index.atom.builder" do
let(:template_path) { "tools/index" }
let(:render_formats) { [:atom] }
let(:test_tool) do
create(
:tool,
name: "test"
)
end
let(:test_tool2) do
create(
:cookbook,
name: "test-2"
)
end
before do
assi... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/spec/views/cookbooks/index.html.erb_spec.rb | Ruby | apache-2.0 | 214 | main | 1,627 | require "spec_helper"
describe "cookbooks/index.html.erb" do
let(:template_path) { "cookbooks/index" }
let!(:current_user) { create(:user, first_name: "test_user") }
let(:cookbook_version) {
create(
:cookbook_version,
version: "0.2.0",
license: "MIT",
changelog: "we added so much stu... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/spec/views/cookbooks/show.html.erb_spec.rb | Ruby | apache-2.0 | 214 | main | 2,828 | require "spec_helper"
describe "cookbooks/show.html.erb" do
context "renders detail page for a cookbook" do
let(:template_path) { "cookbooks/show" }
let!(:current_user) { create(:user, first_name: "Fanny") }
let(:cookbook_version) {
create(
:cookbook_version,
version: "0.2.0",
... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/spec/views/cookbooks/index.atom.builder_spec.rb | Ruby | apache-2.0 | 214 | main | 2,128 | require "spec_helper"
describe "cookbooks/index.atom.builder" do
let(:template_path) { "cookbooks/index" }
let(:render_formats) { [:atom] }
let!(:test_cookbook_5_0) do
create(
:cookbook_version,
version: "5.0",
description: "this cookbook is so rad",
changelog: "we added so much stuff... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/spec/views/cookbooks/directory.html.erb_spec.rb | Ruby | apache-2.0 | 214 | main | 778 | require "spec_helper"
describe "cookbooks/directory.html.erb" do
let(:template_path) { "cookbooks/directory" }
before do
assign(:featured_cookbooks, [])
assign(:recently_updated_cookbooks, [])
assign(:most_downloaded_cookbooks, [])
assign(:most_followed_cookbooks, [])
end
it "has Test Kitchen... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/spec/views/cookbooks/show.atom.builder_spec.rb | Ruby | apache-2.0 | 214 | main | 1,546 | require "spec_helper"
describe "cookbooks/show.atom.builder" do
let(:template_path) { "cookbooks/show" }
let(:render_formats) { [:atom] }
let!(:kiwi_0_1_0) do
create(
:cookbook_version,
version: "0.1.0",
license: "MIT"
)
end
let!(:kiwi_0_2_0) do
create(
:cookbook_version,... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/spec/views/profile/edit.html.erb_spec.rb | Ruby | apache-2.0 | 214 | main | 2,805 | require "spec_helper"
describe "profile/edit.html.erb" do
let(:template_path) { "profile/edit" }
context "page with github enterprise account content" do
let(:user) { create(:user) }
before do
allow(view).to receive(:policy) do |record|
Pundit.policy(user, record)
end
allow(view)... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/spec/views/pages/robots.text.erb_spec.rb | Ruby | apache-2.0 | 214 | main | 741 | require "spec_helper"
describe "pages/robots.text.erb" do
let(:template_path) { "pages/robots" }
include_context "env stashing"
it "uses the full host" do
ENV["FQDN"] = "example.com"
ENV["PORT"] = "80"
ENV["PROTOCOL"] = "http"
render template: template_path
expect(rendered).to match(%r{Site... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/spec/views/pages/welcome.html.erb_spec.rb | Ruby | apache-2.0 | 214 | main | 409 | require "spec_helper"
describe "pages/welcome.html.erb" do
let(:template_path) { "pages/welcome" }
it "has correct text" do
render template: template_path
welcome_text = "Welcome to Supermarket. Find, explore and view Chef Infra Cookbooks for all of your ops needs."
expect(rendered).to have_selector("... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/spec/views/pages/application.html.erb_spec.rb | Ruby | apache-2.0 | 214 | main | 891 | require "spec_helper"
describe "layouts/application.html.erb" do
let(:template_path) { "layouts/application" }
let!(:search) { { path: cookbooks_path, name: "Cookbooks" } }
before :each do
ENV["ANNOUNCEMENT_TEXT"] = "supermarket announcement text"
ENV["ANNOUNCEMENT_BANNER"] = "true"
assign(:search, ... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/spec/views/pages/documentation.html.erb_spec.rb | Ruby | apache-2.0 | 214 | main | 500 | require "spec_helper"
describe "pages/documentation.html.erb" do
let(:template_path) { "pages/documentation" }
context "page with links" do
it "refers to the title of the documentation page" do
render template: template_path
title_text = "Documentation, Guides, Tutorials"
expect(rendered).to ... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/spec/views/cookbook_mailer/cookbook_deprecated_email.html.erb_spec.rb | Ruby | apache-2.0 | 214 | main | 1,293 | require "spec_helper"
describe "cookbook_mailer/cookbook_deprecated_email.html.erb" do
let(:template_path) { "cookbook_mailer/cookbook_deprecated_email" }
context "renders mailer page" do
let!(:current_user) { create(:user, first_name: "test_user") }
let!(:system_email) { create(:system_email, name: "Cookbo... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/spec/mailers/adoption_mailer_spec.rb | Ruby | apache-2.0 | 214 | main | 2,012 | require "spec_helper"
describe AdoptionMailer do
describe "interest_email" do
let(:cookbook) { create(:cookbook) }
let(:user) { create(:user) }
subject do
AdoptionMailer.interest_email(cookbook.id, cookbook.class.name, user.id)
end
context "in the to address" do
it "includes the cur... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/spec/extractors/github_extractor_spec.rb | Ruby | apache-2.0 | 214 | main | 869 | require "spec_helper"
describe GithubExtractor do
let(:auth) { OmniAuth.config.mock_auth[:github] }
subject { described_class.new(auth) }
describe "#first_name" do
subject { super().first_name }
it { should eq("John") }
end
describe "#last_name" do
subject { super().last_name }
it { should... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/spec/extractors/chef_oauth2_extractor_spec.rb | Ruby | apache-2.0 | 214 | main | 902 | require "spec_helper"
describe ChefOauth2Extractor do
let(:auth) { OmniAuth.config.mock_auth[:chef_oauth2] }
subject { described_class.new(auth) }
describe "#first_name" do
subject { super().first_name }
it { should eq("John") }
end
describe "#last_name" do
subject { super().last_name }
it... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/spec/lib/extractors/base_spec.rb | Ruby | apache-2.0 | 214 | main | 741 | require "spec_helper"
#
# Test stub class for testing extractor objects.
#
class TestExtractor < Extractor::Base; end
describe Extractor::Base do
describe ".load" do
it "raises an exception when the extractor does not exist" do
expect { described_class.load("provider" => "fake") }
.to raise_error(... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/spec/lib/active_model/validations/chef_version_constraint_validator_spec.rb | Ruby | apache-2.0 | 214 | main | 1,506 | require "spec_helper"
describe ActiveModel::Validations::ChefVersionConstraintValidator do
let(:dependency_class) do
Class.new do
include ActiveModel::Model
attr_accessor :version
validates :version, chef_version_constraint: true
end
end
it "validates the model if the attribute is a ... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/spec/lib/supermarket/host_spec.rb | Ruby | apache-2.0 | 214 | main | 1,302 | require "spec_helper"
describe Supermarket::Host do
include_context "env stashing"
describe "#full_url" do
it "generates the correct url when there is no port present" do
ENV["PORT"] = nil
ENV["FQDN"] = "example.com"
ENV["PROTOCOL"] = "http"
expect(described_class.full_url).to eql("ht... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/spec/lib/supermarket/s3_config_spec.rb | Ruby | apache-2.0 | 214 | main | 6,075 | require "spec_helper"
describe Supermarket::S3Config do
context "#use_s3?" do
it "is true if required S3 configs are given in environment" do
mock_env = {
"S3_BUCKET" => "bettergetabucket",
"S3_REGION" => "over-yonder-1",
}
expect(Supermarket::S3Config.use_s3?(mock_env)).to be t... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/spec/lib/supermarket/location_storage_spec.rb | Ruby | apache-2.0 | 214 | main | 720 | require "spec_helper"
describe Supermarket::LocationStorage do
subject do
Class.new(ApplicationController) do
include Supermarket::LocationStorage
def request
Struct.new(:path).new("/profile")
end
def session
@session ||= {}
end
end.new
end
describe "#stor... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/spec/lib/supermarket/authorization_spec.rb | Ruby | apache-2.0 | 214 | main | 1,132 | require "spec_helper"
class ReadOnly
class Policy
def initialize(*_); end
def show?
true
end
def edit?
false
end
end
def policy_class
Policy
end
end
describe Supermarket::Authorization do
subject do
Class.new(ApplicationController) do
include Supermarket::Aut... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/spec/lib/supermarket/authentication_spec.rb | Ruby | apache-2.0 | 214 | main | 1,013 | require "spec_helper"
describe Supermarket::Authentication do
subject do
Class.new(ApplicationController) do
include Supermarket::Authentication
end.new
end
describe "#current_user" do
it "returns nil if there is no session" do
allow(subject).to receive(:session).and_return({})
exp... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/spec/lib/supermarket/migration/remove_duplicate_cookbook_dependencies_spec.rb | Ruby | apache-2.0 | 214 | main | 903 | require "spec_helper"
describe Supermarket::Migration::RemoveDuplicateCookbookDependencies do
it "deletes duplicate cookbook dependencies" do
cookbook_version = create(:cookbook).cookbook_versions.first
2.times do
cookbook_version.cookbook_dependencies.create(
name: "test",
version_con... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/spec/lib/supermarket/migration/mark_bad_readme_imports_for_reimport_spec.rb | Ruby | apache-2.0 | 214 | main | 1,367 | require "spec_helper"
describe Supermarket::Migration::MarkBadReadmeImportsForReimport do
it "resets the state of attributes set by metadata" do
cookbook_version = create(
:cookbook_version,
dependencies_imported: true,
readme: "some junk ctime=12345678 some other junk"
)
cookbook_vers... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/spec/lib/supermarket/utils/file_format_spec.rb | Ruby | apache-2.0 | 214 | main | 322 | require "spec_helper"
describe Utils::FileFormat do
describe "Utils::FileFormat" do
let(:filepath) { "spec/fixtures/sample.txt.gz" }
let(:mime_type) { "application/gzip" }
it "returns gzip for gz file" do
expect(Utils::FileFormat.get_mime_type(file_path: filepath)).to eq(mime_type)
end
end
en... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/spec/lib/authorizer/base_spec.rb | Ruby | apache-2.0 | 214 | main | 1,225 | require "spec_helper"
describe Authorizer::Base do
let(:user) { double(:user) }
let(:record) { double(:record) }
describe "#initialize" do
it "sets the user" do
instance = described_class.new(user, record)
expect(instance.user).to eq(user)
end
it "sets the user to a new instance if it i... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/spec/authorizers/cookbook_authorizer_spec.rb | Ruby | apache-2.0 | 214 | main | 3,241 | require "spec_helper"
describe CookbookAuthorizer do
let(:user) { build(:user) }
context "as the cookbook owner" do
let(:record) { build(:cookbook, owner: user) }
subject { described_class.new(user, record) }
context "when configuration permits owner artifact removal" do
before { allow(ENV).to... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/spec/authorizers/collaborator_authorizer_spec.rb | Ruby | apache-2.0 | 214 | main | 1,427 | require "spec_helper"
describe CollaboratorAuthorizer do
let(:sally) { create(:user) }
let(:hank) { create(:user) }
let(:cookbook) { create(:cookbook, owner: sally) }
let(:cookbook_collaborator) { create(:cookbook_collaborator, resourceable: cookbook, user: hank) }
context "as the cookbook owner" do
sub... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/spec/authorizers/tool_authorizer_spec.rb | Ruby | apache-2.0 | 214 | main | 1,867 | require "spec_helper"
describe ToolAuthorizer do
let(:user) { build(:user) }
context "as the tool owner" do
let(:record) { build(:tool, owner: user) }
subject { described_class.new(user, record) }
it { should permit_authorization(:edit) }
it { should permit_authorization(:update) }
it { shou... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/spec/authorizers/user_authorizer_spec.rb | Ruby | apache-2.0 | 214 | main | 1,111 | require "spec_helper"
describe UserAuthorizer do
let(:record) { build(:user) }
context "as an admin user" do
let(:user) { build(:user, roles: "admin") }
subject { described_class.new(user, record) }
it { should permit_authorization(:make_admin) }
it { should permit_authorization(:revoke_admin) }
... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/spec/concerns/badgeable_spec.rb | Ruby | apache-2.0 | 214 | main | 346 | require "spec_helper"
describe Badgeable do
describe "the badges order matters so" do
subject { Badgeable::BADGES }
it "partner is first" do
expect(subject[0]).to eq("partner")
end
end
# from spec/support/shared_examples/badgeable_shared.rb
describe BadgeableThing do
it_behaves_like "a b... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/spec/factories/group_member.rb | Ruby | apache-2.0 | 214 | main | 206 | FactoryBot.define do
factory :group_member do
association :user
association :group
admin { nil }
factory :admin_group_member, class: GroupMember do
admin { true }
end
end
end |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/spec/factories/email.rb | Ruby | apache-2.0 | 214 | main | 206 | FactoryBot.define do
factory :email do
association :user
email { "#{user.username}@example.com" }
confirmation_token { "ABCD1234" }
confirmed_at { 1.day.ago }
end
end |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/spec/factories/cookbook_version.rb | Ruby | apache-2.0 | 214 | main | 612 | FactoryBot.define do
factory :cookbook_version do
association :cookbook
association :user
description { "An awesome cookbook!" }
license { "MIT" }
sequence(:version) { |n| "1.2.#{n}" }
tarball { File.open("spec/support/cookbook_fixtures/redis-test-v1.tgz") }
readme { "# redis cookbook" }
... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/spec/factories/collaborator.rb | Ruby | apache-2.0 | 214 | main | 292 | FactoryBot.define do
factory :cookbook_collaborator, class: "Collaborator" do
association :resourceable, factory: :cookbook
association :user
end
factory :tool_collaborator, class: "Collaborator" do
association :resourceable, factory: :tool
association :user
end
end |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/spec/factories/cookbook.rb | Ruby | apache-2.0 | 214 | main | 623 | FactoryBot.define do
factory :cookbook do
association :category
association :owner, factory: :user
sequence(:name) { |n| "redis-#{n}" }
source_url { "http://example.com" }
issues_url { "http://example.com/issues" }
deprecated { false }
featured { false }
transient do
cookbook_ve... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/spec/factories/user.rb | Ruby | apache-2.0 | 214 | main | 579 | FactoryBot.define do
factory :user do
first_name { "John" }
last_name { "Doe" }
public_key { File.read("spec/support/key_fixtures/valid_public_key.pub") }
sequence(:email) { |n| "johndoe#{n}@example.com" }
transient do
create_chef_account { true }
end
after(:create) do |user, eval... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/spec/factories/quality_metric.rb | Ruby | apache-2.0 | 214 | main | 952 | FactoryBot.define do
factory :quality_metric, class: "QualityMetric" do
trait :collaborator_num do
name { "Collaborator Number" }
end
trait :license do
name { "License" }
end
trait :contributing_file do
name { "Contributing File" }
end
trait :testing_file do
nam... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/spec/factories/tool.rb | Ruby | apache-2.0 | 214 | main | 284 | FactoryBot.define do
factory :tool do
association :owner, factory: :user
sequence(:name) { |n| "butter-#{n}" }
type { "ohai_plugin" }
description { "Great plugin for ohai." }
source_url { "http://example.com" }
instructions { "Use with caution." }
end
end |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/spec/factories/account.rb | Ruby | apache-2.0 | 214 | main | 293 | FactoryBot.define do
factory :account do
association :user
uid { username }
sequence(:username) { |n| "johndoe#{n}" }
provider { "github" }
oauth_token { SecureRandom.hex(15) }
oauth_secret { SecureRandom.hex(20) }
oauth_expires { 10.days.from_now }
end
end |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/db/schema.rb | Ruby | apache-2.0 | 214 | main | 12,134 | # This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# This file is the source Rails uses to define your schema when running `bin/rai... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/db/seeds.rb | Ruby | apache-2.0 | 214 | main | 4,333 | QualityMetric.reset_column_information
QualityMetric.where(name: 'Cookstyle').first_or_create!
QualityMetric.where(name: 'Collaborator Number').first_or_create!
QualityMetric.where(name: 'License').first_or_create!
QualityMetric.where(name: 'Contributing File').first_or_create!
QualityMetric.where(name: 'Testing File'... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/db/migrate/20140710203503_create_contributor_requests.rb | Ruby | apache-2.0 | 214 | main | 325 | class CreateContributorRequests < ActiveRecord::Migration[4.2]
def change
create_table :contributor_requests do |t|
t.integer :organization_id, null: false
t.integer :user_id, null: false
t.timestamps
end
add_index :contributor_requests, [:organization_id, :user_id], unique: true
end... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/db/migrate/20160914215547_move_quality_metric_results.rb | Ruby | apache-2.0 | 214 | main | 1,033 | class MoveQualityMetricResults < ActiveRecord::Migration[4.2]
def change
foodcritic_qm = QualityMetric.create!(name: 'Foodcritic')
collab_num_qm = QualityMetric.create!(name: 'Collaborator Number')
CookbookVersion.where("foodcritic_failure IS NOT NULL or collaborator_failure IS NOT NULL").each do |cookbo... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/db/migrate/20170203223651_add_not_null_constraint_to_metric_results.rb | Ruby | apache-2.0 | 214 | main | 221 | class AddNotNullConstraintToMetricResults < ActiveRecord::Migration[4.2]
def change
MetricResult.where(quality_metric_id: nil).delete_all
change_column_null(:metric_results, :quality_metric_id, false)
end
end |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/db/migrate/20140313192158_remove_devise_attributes_from_users.rb | Ruby | apache-2.0 | 214 | main | 592 | class RemoveDeviseAttributesFromUsers < ActiveRecord::Migration[4.2]
def change
remove_column :users, :encrypted_password, :string
remove_column :users, :reset_password_token, :string
remove_column :users, :reset_password_sent_at, :datetime
remove_column :users, :remember_created_at, :datetime
rem... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/db/migrate/20140320153919_create_supported_platforms.rb | Ruby | apache-2.0 | 214 | main | 324 | class CreateSupportedPlatforms < ActiveRecord::Migration[4.2]
def change
create_table :supported_platforms do |t|
t.string :name, null: false
t.string :version_constraint, null: false, default: '>= 0.0.0'
t.references :cookbook_version, index: true, null: false
t.timestamps
end
end
... |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/db/migrate/20140109194347_create_organization_users.rb | Ruby | apache-2.0 | 214 | main | 266 | class CreateOrganizationUsers < ActiveRecord::Migration[4.2]
def change
create_table :organization_users do |t|
t.references :user, index: true
t.references :organization, index: true
t.boolean :admin
t.timestamps
end
end
end |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/db/migrate/20140730174846_add_slug_to_tools.rb | Ruby | apache-2.0 | 214 | main | 313 | class AddSlugToTools < ActiveRecord::Migration[4.2]
def up
add_column :tools, :slug, :string
add_index :tools, :slug, unique: true
Tool.all.each do |tool|
tool.update_attribute(:slug, "#{tool.id}-#{tool.name.parameterize}")
end
end
def down
remove_column :tools, :slug
end
end |
github | chef/supermarket | https://github.com/chef/supermarket | src/supermarket/db/migrate/20210830065034_drop_curry_related_tables.rb | Ruby | apache-2.0 | 214 | main | 499 | class DropCurryRelatedTables < ActiveRecord::Migration[6.1]
def change
drop_table :curry_commit_authors, if_exists: true
drop_table :curry_pull_request_comments, if_exists: true
drop_table :curry_pull_request_commit_authors, if_exists: true
drop_table :curry_pull_request_updates, if_exists: true
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.