Skip to content

Commit 987fea5

Browse files
author
Franklin Webber
committed
Initial Commit
Gemfile, Rakefile, and Guardfile Specs for reference that cover variable assignment, booleans, nil, strings, and symbols
0 parents  commit 987fea5

11 files changed

+504
-0
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.DS_Store

Gemfile

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
source :rubygems
2+
3+
gem 'rspec'
4+
gem 'guard'
5+
gem 'guard-rspec'

Gemfile.lock

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
GEM
2+
remote: http://rubygems.org/
3+
specs:
4+
diff-lcs (1.1.2)
5+
guard (0.5.1)
6+
thor (~> 0.14.6)
7+
guard-rspec (0.4.0)
8+
guard (>= 0.4.0)
9+
rspec (2.6.0)
10+
rspec-core (~> 2.6.0)
11+
rspec-expectations (~> 2.6.0)
12+
rspec-mocks (~> 2.6.0)
13+
rspec-core (2.6.4)
14+
rspec-expectations (2.6.0)
15+
diff-lcs (~> 1.1.2)
16+
rspec-mocks (2.6.0)
17+
thor (0.14.6)
18+
19+
PLATFORMS
20+
ruby
21+
22+
DEPENDENCIES
23+
guard
24+
guard-rspec
25+
rspec

Guardfile

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# A sample Guardfile
2+
# More info at https://github.com/guard/guard#readme
3+
4+
guard 'rspec', :version => 2, :cli => "--color --format d" do
5+
watch(%r{^spec/.+_spec\.rb$})
6+
end

README.md

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
## Sharpening your Weapons
2+
3+
1. Install Git
4+
2. Install RVM
5+
3. Install Ruby 1.9.2
6+
7+
## Using Git and Github
8+
9+
1. Create a Github account
10+
2. Send me a message so I know who you are @burtlo
11+
3. Add you the UWE Ruby organization
12+
3. Fork this repository to your account
13+
4. Clone the repository on your system
14+
15+
## Traveling through the Land of Ruby
16+
17+
1. Install Bundler
18+
2. bundle install
19+
2. Run the tests for week 1
20+
3. Fix the tests
21+
4. Commit the changes locally
22+
5. Push the changes to your repository
23+
24+
## Using the resources of the land
25+
26+
1. Login to Travis CI and authorize Travis CI
27+
2. Select your forked repository to be built
28+
29+
## Getting to know your neighbors
30+
31+
1. Find, follow and share a ruby blog through an RSS reader
32+
2. Watch a person or another project on Github
33+
3. Login to us.freenode.net
34+
4. Login to our Hipchat

Rakefile

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
task :default => :spec
3+
4+
task :spec do
5+
system "rspec -c spec/*_spec.rb"
6+
end

spec/assignment_spec.rb

+101
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
2+
describe "Variable assignment" do
3+
4+
context "when assignining values" do
5+
6+
it "should equal the value assigned to it" do
7+
8+
a = 1
9+
a.should eq 1
10+
11+
end
12+
13+
it "should allow integers" do
14+
15+
number = 12
16+
number.should eq 12
17+
18+
end
19+
20+
it "should allow decimal values" do
21+
22+
decimal = 3.1425
23+
decimal.should eq 3.1425
24+
25+
end
26+
27+
it "should allow letters (String)" do
28+
29+
words = "I welcome you to Munchkin land!"
30+
words.should eq "I welcome you to Munchkin land!"
31+
32+
end
33+
34+
it "should allow true value (boolean)" do
35+
36+
boolean = true
37+
boolean.should be_true
38+
39+
end
40+
41+
it "should allow false value (boolean)" do
42+
43+
boolean = false
44+
boolean.should be_false
45+
46+
end
47+
48+
end
49+
50+
context "when assigning a value multiple times" do
51+
52+
it "should be the last assigned value" do
53+
54+
number = 23
55+
number = 12
56+
57+
number.should eq 12
58+
59+
end
60+
61+
it "should allow multiple different assignments" do
62+
63+
value = 1
64+
value = "a"
65+
66+
value.should eq "a"
67+
68+
end
69+
70+
end
71+
72+
context "when comparing two" do
73+
74+
it "numbers should be equal" do
75+
76+
a = 1
77+
b = 1
78+
79+
a.should eq b
80+
81+
end
82+
83+
it "strings should be equal" do
84+
85+
a = "abba"
86+
b = 'abba'
87+
88+
a.should eq b
89+
90+
end
91+
92+
it "booleans should be equal" do
93+
94+
a = true
95+
b = true
96+
97+
a.should eq b
98+
99+
end
100+
end
101+
end

spec/boolean_spec.rb

+89
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
2+
describe "Boolean" do
3+
4+
context "when true" do
5+
6+
it "should be true" do
7+
8+
value = true
9+
10+
value.should be_true
11+
value.should eq true
12+
13+
end
14+
15+
it "should be a TrueClass" do
16+
17+
value = true
18+
value.should be_kind_of TrueClass
19+
20+
end
21+
22+
end
23+
24+
context "when false" do
25+
26+
it "should be false" do
27+
28+
value = false
29+
30+
value.should be_false
31+
value.should eq false
32+
33+
end
34+
35+
it "should be a FalseClass" do
36+
37+
value = false
38+
value.should be_kind_of FalseClass
39+
40+
end
41+
42+
end
43+
44+
context "when any assigned value" do
45+
46+
it "should be true" do
47+
48+
value = "false"
49+
50+
value.should be_true
51+
value.should_not be_kind_of TrueClass
52+
value.should be_kind_of String
53+
value.should eq "false"
54+
55+
end
56+
57+
end
58+
59+
context "when 0" do
60+
61+
it "should be true" do
62+
63+
value = 0
64+
65+
value.should be_true
66+
value.should_not be_kind_of TrueClass
67+
value.should be_kind_of Integer
68+
value.should eq 0
69+
70+
end
71+
72+
end
73+
74+
75+
context "when nil" do
76+
77+
it "should be false" do
78+
79+
value = nil
80+
81+
value.should be_false
82+
value.should be_kind_of NilClass
83+
value.should be_nil
84+
85+
end
86+
87+
end
88+
89+
end

spec/nil_spec.rb

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
2+
describe "Nil and the NilClass" do
3+
4+
context "when assigned to nil" do
5+
6+
it "should be nil" do
7+
8+
value = nil
9+
value.should be_nil
10+
11+
end
12+
13+
it "should be a NilClass" do
14+
15+
value = nil
16+
value.should be_kind_of NilClass
17+
18+
end
19+
20+
end
21+
22+
end

0 commit comments

Comments
 (0)