1
1
require " ./spec_helper"
2
2
3
3
describe " outdated" do
4
- it " up_to_date " do
4
+ it " up to date " do
5
5
with_shard({dependencies: {web: " *" }}) do
6
6
run " shards install"
7
7
@@ -10,7 +10,7 @@ describe "outdated" do
10
10
end
11
11
end
12
12
13
- it " not_latest_version " do
13
+ it " not latest version " do
14
14
with_shard({dependencies: {orm: " *" }}, {orm: " 0.3.1" }) do
15
15
run " shards install"
16
16
@@ -20,7 +20,7 @@ describe "outdated" do
20
20
end
21
21
end
22
22
23
- it " available_version_matching_pessimistic_operator " do
23
+ it " available version matching pessimistic operator " do
24
24
with_shard({dependencies: {orm: " ~> 0.3.0" }}, {orm: " 0.3.1" }) do
25
25
run " shards install"
26
26
@@ -30,7 +30,7 @@ describe "outdated" do
30
30
end
31
31
end
32
32
33
- it " reports_new_prerelease " do
33
+ it " reports new prerelease " do
34
34
with_shard({dependencies: {unstable: " 0.3.0.alpha" }}) do
35
35
run " shards install"
36
36
end
@@ -41,7 +41,7 @@ describe "outdated" do
41
41
end
42
42
end
43
43
44
- it " wont_report_prereleases_by_default " do
44
+ it " won't report prereleases by default " do
45
45
with_shard({dependencies: {preview: " *" }}, {preview: " 0.2.0" }) do
46
46
run " shards install"
47
47
@@ -51,7 +51,7 @@ describe "outdated" do
51
51
end
52
52
end
53
53
54
- it " reports_prereleases_when_asked " do
54
+ it " reports prereleases when asked " do
55
55
with_shard({dependencies: {preview: " *" }}, {preview: " 0.2.0" }) do
56
56
run " shards install"
57
57
@@ -60,4 +60,82 @@ describe "outdated" do
60
60
stdout.should contain(" * preview (installed: 0.2.0, available: 0.4.0.a)" )
61
61
end
62
62
end
63
+
64
+ it " fails when source has changed" do
65
+ with_shard({dependencies: {awesome: " 0.1.0" }}) do
66
+ run " shards install"
67
+ end
68
+
69
+ with_shard({dependencies: {awesome: {git: git_url(:forked_awesome )}}}) do
70
+ ex = expect_raises(FailedCommand ) { run " shards outdated --no-color" }
71
+ ex.stdout.should contain(" Outdated shard.lock (awesome source changed)" )
72
+ end
73
+ end
74
+
75
+ it " fails when requirements would require an update" do
76
+ with_shard({dependencies: {awesome: " 0.1.0" }}) do
77
+ run " shards install"
78
+ end
79
+
80
+ with_shard({dependencies: {awesome: " 0.2.0" }}) do
81
+ ex = expect_raises(FailedCommand ) { run " shards outdated --no-color" }
82
+ ex.stdout.should contain(" Outdated shard.lock (awesome requirements changed)" )
83
+ end
84
+ end
85
+
86
+ it " fails when requirements would require an update due to override" do
87
+ metadata = {dependencies: {awesome: " 0.1.0" }}
88
+
89
+ with_shard(metadata) do
90
+ run " shards install"
91
+ end
92
+
93
+ override = {dependencies: {awesome: " 0.2.0" }}
94
+
95
+ with_shard(metadata, nil , override) do
96
+ ex = expect_raises(FailedCommand ) { run " shards outdated --no-color" }
97
+ ex.stdout.should contain(" Outdated shard.lock (awesome requirements changed)" )
98
+ end
99
+ end
100
+
101
+ it " not latest version in override (same source)" do
102
+ metadata = {dependencies: {awesome: " 0.1.0" }}
103
+ lock = {awesome: " 0.1.0" }
104
+ override = {dependencies: {awesome: " *" }}
105
+
106
+ with_shard(metadata, lock, override) do
107
+ run " shards install"
108
+
109
+ stdout = run " shards outdated --no-color"
110
+ stdout.should contain(" W: Outdated dependencies:" )
111
+ stdout.should contain(" * awesome (installed: 0.1.0, available: 0.3.0)" )
112
+ end
113
+ end
114
+
115
+ it " not latest version in override (different source)" do
116
+ metadata = {dependencies: {awesome: " 0.1.0" }}
117
+ lock = {awesome: {version: " 0.1.0" , git: git_url(:forked_awesome )}}
118
+ override = {dependencies: {awesome: {git: git_url(:forked_awesome )}}}
119
+
120
+ with_shard(metadata, lock, override) do
121
+ run " shards install"
122
+
123
+ stdout = run " shards outdated --no-color"
124
+ stdout.should contain(" W: Outdated dependencies:" )
125
+ stdout.should contain(" * awesome (installed: 0.1.0, available: 0.2.0)" )
126
+ end
127
+ end
128
+
129
+ it " up to date in override" do
130
+ metadata = {dependencies: {awesome: " 0.1.0" }}
131
+ lock = {awesome: {version: " 0.2.0" , git: git_url(:forked_awesome )}}
132
+ override = {dependencies: {awesome: {git: git_url(:forked_awesome )}}}
133
+
134
+ with_shard(metadata, lock, override) do
135
+ run " shards install"
136
+
137
+ stdout = run " shards outdated --no-color"
138
+ stdout.should contain(" I: Dependencies are up to date!" )
139
+ end
140
+ end
63
141
end
0 commit comments