blob: c5d0937d054c0e7724f62fcb9656e7bc39702893 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
|
# frozen_string_literal: true
require "spec_helper"
describe "bundler plugin install" do
before do
build_repo2 do
build_plugin "foo"
end
end
it "fails when source in not provided" do
bundle "plugin install foo"
expect(out).to include("You need to provide the source")
expect(out).not_to include("Installed plugin")
end
it "shows propper message when gem in not found in the source" do
bundle "plugin install no-foo --source file://#{gem_repo1}"
expect(out).to include("Could not find")
end
it "installs from rubygems source" do
bundle "plugin install foo --source file://#{gem_repo2}"
expect(out).to include("Installed plugin foo")
end
context "malformatted plugin" do
it "fails when plugin.rb is missing" do
build_repo2 do
build_gem "charlie"
end
bundle "plugin install charlie --source file://#{gem_repo2}"
expect(out).to include("plugin.rb was not found")
expect(out).not_to include("Installed plugin")
expect(plugin_gems("charlie-1.0")).not_to be_directory
end
it "fails when plugin.rb throws exception on load" do
build_repo2 do
build_plugin "chaplin" do |s|
s.write "plugin.rb", <<-RUBY
raise "I got you man"
RUBY
end
end
bundle "plugin install chaplin --source file://#{gem_repo2}"
expect(out).not_to include("Installed plugin")
expect(plugin_gems("chaplin-1.0")).not_to be_directory
end
end
context "git plugins" do
it "installs form a git source" do
build_git "foo" do |s|
s.write "plugin.rb"
end
bundle "plugin install foo --git file://#{lib_path("foo-1.0")}"
expect(out).to include("Installed plugin foo")
end
end
context "Gemfile eval" do
it "installs plugins listed in gemfile" do
gemfile <<-G
source 'file://#{gem_repo2}'
plugin 'foo'
gem 'rack', "1.0.0"
G
bundle "install"
expect(out).to include("Installed plugin foo")
expect(out).to include("Bundle complete!")
should_be_installed("rack 1.0.0")
end
it "accepts plugin version" do
update_repo2 do
build_plugin "foo", "1.1.0"
end
install_gemfile <<-G
source 'file://#{gem_repo2}'
plugin 'foo', "1.0"
G
bundle "install"
expect(out).to include("Installing foo 1.0")
expect(out).to include("Installed plugin foo")
expect(out).to include("Bundle complete!")
end
it "accepts git sources" do
build_git "ga-plugin" do |s|
s.write "plugin.rb"
end
install_gemfile <<-G
plugin 'ga-plugin', :git => "#{lib_path("ga-plugin-1.0")}"
G
expect(out).to include("Installed plugin ga-plugin")
end
end
end
|