Sha256: d2d5a445621140990491315a4fdf27fa0d4d9a2f4bdbe0cf86334b36d5a7f092
Contents?: true
Size: 1.79 KB
Versions: 5
Compression:
Stored size: 1.79 KB
Contents
require 'schema_dev/gem' describe SchemaDev::Gem do let(:user_name) { "My Name" } let(:user_email) { "my_name@example.com" } before(:each) do stub_request(:get, 'https://rubygems.org/api/v1/versions/schema_monkey.json').to_return body: JSON.generate([{ built_at: Time.now, number: "0.1.2"}]) allow_any_instance_of(SchemaDev::Gem).to receive(:`).with("git config user.name").and_return user_name allow_any_instance_of(SchemaDev::Gem).to receive(:`).with("git config user.email").and_return user_email end around(:each) do |example| silence_stream(STDOUT) do example.run end end it "creates gemspec" do in_tmpdir do expect{SchemaDev::Gem.build("NewGem")}.not_to raise_error gemspec = File.read "new_gem/new_gem.gemspec" expect(gemspec).to include %q{"schema_monkey", "~> 0.1", ">= 0.1.2"} expect(gemspec).to match(/authors.*#{user_name}/) expect(gemspec).to match(/email.*#{user_email}/) end end context "complains" do around(:each) do |example| silence_stream(STDERR) do example.run end end it "when no git user.name" do in_tmpdir do expect_any_instance_of(SchemaDev::Gem).to receive(:`).with("git config user.name").and_return "" expect{SchemaDev::Gem.build("NewGem")}.to raise_error SystemExit, /who are you/i end end it "when in git worktree" do in_tmpdir do expect_any_instance_of(SchemaDev::Gem).to receive(:system).with(/^git rev-parse/).and_return true expect{SchemaDev::Gem.build("NewGem")}.to raise_error SystemExit, /\bgit\b/ end end it "when gem directory exists" do in_tmpdir do FileUtils.touch "new_gem" expect{SchemaDev::Gem.build("NewGem")}.to raise_error SystemExit, /exists/ end end end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
schema_dev-3.0.0 | spec/gem_spec.rb |
schema_dev-2.0.4 | spec/gem_spec.rb |
schema_dev-2.0.3 | spec/gem_spec.rb |
schema_dev-2.0.2 | spec/gem_spec.rb |
schema_dev-2.0.1 | spec/gem_spec.rb |